Example #1
0
        void IBMDStreamingDeviceNotificationCallback.StreamingDeviceRemoved(IDeckLink device)
        {
            // We only care about removal of the device we are using
            if (device != streamingDevice)
            {
                return;
            }

            streamingDeviceInput.SetCallback(null);

            streamingDeviceInput = null;
            streamingDevice      = null;

            StopStreaming();

            if (callback != null)
            {
                callback.DeviceRemoved();
            }
        }
Example #2
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));
            }
        }