コード例 #1
0
        // Check DeckLink Hardware
        public bool GetHardware()
        {
            // Create the COM instance
            IDeckLinkIterator deckLinkIterator = new CDeckLinkIterator();

            if (deckLinkIterator == null)
            {
                Console.Write("Deck link drivers are not installed!", "Error");
                return(false);
            }

            // Get the DeckLink card
            for (int i = 0; i < deckLinkCard; i++)
            {
                deckLinkIterator.Next(out DeckLink);
            }

            if (DeckLink == null)
            {
                Console.Write("No connected decklink device found", "Error");
                return(false);
            }

            string displayName;
            string modelName;

            DeckLink.GetDisplayName(out displayName);
            DeckLink.GetModelName(out modelName);

            // Compatibility: DeckLink 4K Extreme, DeckLink Quad 2
            Console.Write(string.Format("Device chosen: {0}", displayName, modelName));

            return(true);
        }
コード例 #2
0
        private void find_Click(object sender, EventArgs e)
        {
            // Create the COM instance
            IDeckLinkIterator deckLinkIterator = new CDeckLinkIterator();

            if (deckLinkIterator == null)
            {
                MessageBox.Show("Deck link drivers are not installed!", "Error");
                return;
            }

            // Get the first DeckLink card
            deckLinkIterator.Next(out _DeckLink);
            if (_DeckLink == null)
            {
                stream.Enabled = false;
                MessageBox.Show("No connected decklink device found", "Error");
                return;
            }

            string displayName;
            string modelName;

            _DeckLink.GetDisplayName(out displayName);
            _DeckLink.GetModelName(out modelName);

            stream.Enabled       = true;
            this.deviceName.Text = string.Format("Device chosen: {0}", FormatDevice(displayName, modelName));
        }
コード例 #3
0
 /// <summary>
 /// Construct a physical Mini-recorder device
 /// </summary>
 /// <param name="d"></param>
 /// <param name="channels"></param>
 public InputDevice(IDeckLink d, int channels)
 {
     device = d as IDeckLinkInput;
     if (device == null)
     {
         throw new ApplicationException("Not a Decklink input device");
     }
     this.channels = channels;
     d.GetDisplayName(out name);
 }
コード例 #4
0
        public void DeckLinkDeviceRemoved(IDeckLink deckLinkDevice)
        {
            string displayName;
            string modelName;

            deckLinkDevice.GetDisplayName(out displayName);
            deckLinkDevice.GetModelName(out modelName);

            Run(() => notifications.Text = string.Format("Device disconnected! {0}", FormatDevice(displayName, modelName)));
        }
コード例 #5
0
        void IBMDStreamingDeviceNotificationCallback.StreamingDeviceArrived(IDeckLink device)
        {
            // Check we don't already have a device.
            if (streamingDevice != null)
            {
                return;
            }

            // See if it can do input:
            streamingDeviceInput = device as IBMDStreamingDeviceInput;
            if (streamingDeviceInput == null)
            {
                // This device doesn't support input. We can ignore this device.
                return;
            }

            // Ok, we're happy with this device, hold a reference to the device.
            streamingDevice = device;
            string deviceName;

            streamingDevice.GetDisplayName(out deviceName);

            Debug.WriteLine("Device arrived: " + deviceName);

            // Now install our callbacks.
            streamingDeviceInput.SetCallback(this);
            Debug.WriteLine("Device callback installed");

            // Add video input modes:
            IDeckLinkDisplayModeIterator inputModeIterator;

            streamingDeviceInput.GetVideoInputModeIterator(out inputModeIterator);

            _BMDDisplayMode currentInputModeValue;

            streamingDeviceInput.GetCurrentDetectedVideoInputMode(out currentInputModeValue);

            displayModes = new List <DisplayModeEntry>();
            IDeckLinkDisplayMode inputMode;

            while (true)
            {
                inputModeIterator.Next(out inputMode);
                if (inputMode == null)
                {
                    break;
                }

                DisplayModeEntry displayModeEntry = new DisplayModeEntry(inputMode);
                displayModes.Add(displayModeEntry);

                if (inputMode.GetDisplayMode() == currentInputModeValue)
                {
                    currentInputMode = displayModeEntry;
                }
            }

            tcpStreamHandler.GetDeviceId();

            if (callback != null)
            {
                callback.DeviceArrived(deviceName, currentInputMode, displayModes, GetEncodingPresetsForInputMode(currentInputModeValue));
            }
        }