void IBMDStreamingH264InputCallback.H264VideoInputModeChanged() { streamingDeviceInput.GetCurrentDetectedVideoInputMode(out inputMode); // reset current input mode to empty (unknown display mode is not in list) currentInputMode = new DisplayModeEntry(); foreach (DisplayModeEntry displayMode in displayModes) { if (((IDeckLinkDisplayMode)displayMode.displayMode).GetDisplayMode() == inputMode) { currentInputMode = displayMode; break; } } if (callback != null) { callback.InputModeChanged(currentInputMode, GetEncodingPresetsForInputMode(inputMode)); } }
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)); } }