public void UnregisterExplorer(DeckLink deckLink) { _components.Remove(deckLink); if (_currDeckLink == deckLink) { _currDeckLink = null; } }
public void RegisterExplorer(DeckLink deckLink) { if (_components.Find(d => d == deckLink) != null) { return; } _components.Add(deckLink); }
protected int FindClosestMatchingMode(int deviceIndex, bool isInput) { if (deviceIndex < 0) { return(-1); } Device device = DeckLink.GetDevice(deviceIndex); List <DeviceMode> modes = isInput ? device.InputModes : device.OutputModes; for (int i = 0; i < modes.Count; ++i) { if (_filterModeByResolution) { if (modes[i].Width != _modeWidth || modes[i].Height != _modeHeight) { continue; } } if (_filterModeByFormat) { if (modes[i].PixelFormat != _modeFormat) { continue; } } if (_filterModeByFPS) { float modeFps = modes[i].InterlacedFieldMode ? modes[i].FrameRate * 2 : modes[i].FrameRate; if (Mathf.Abs(modeFps - _modeFPS) > EPSILON) { continue; } } if (_filterModeByInterlacing) { if (_modeInterlacing != modes[i].InterlacedFieldMode) { continue; } } if (_enable3D && !modes[i].SupportStereo3D) { continue; } return(modes[i].Index); } return(-1); }
public void RegisterExplorer(DeckLink deckLink) { if (_components.Contains(deckLink)) { return; } _components.Add(deckLink); }
public void UnregisterExplorer(DeckLink deckLink) { _components.Remove(deckLink); if (_currDeckLink == deckLink) { _currDeckLink = null; } if (_components.Count <= 0) { this.enabled = false; } }
public void RegisterExplorer(DeckLink deckLink) { if (_components.Contains(deckLink)) { return; } _components.Add(deckLink); if (_components.Count > 0) { this.enabled = true; } }
void OnGUI() { if (_components.Count == 0) { return; } int prevDepth = GUI.depth; GUI.depth = _depth; GUISkin prevSkin = GUI.skin; GUI.skin = _skin; if (_showExplorer) { GUILayout.BeginHorizontal(); GUILayout.BeginVertical("box", GUILayout.MinWidth(250), GUILayout.MaxHeight(150)); if (GUILayout.Button("Select DeckLink Object")) { _currDeckLink = null; } _lastScrollPos = GUILayout.BeginScrollView(_lastScrollPos); foreach (DeckLink component in _components) { if (component == _currDeckLink) { GUI.color = Color.green; } if (GUILayout.Button(component.gameObject.name)) { _currDeckLink = component; } GUI.color = Color.white; } GUILayout.EndScrollView(); GUILayout.EndVertical(); if (_currDeckLink != null) { _currDeckLink.RenderExplorer(); } if (GUILayout.Button("x", GUILayout.MaxWidth(20))) { _showExplorer = false; _maxButtonTime = 0f; } GUILayout.EndHorizontal(); } else { if (_maxButtonTime < _showMaxButtonTime) { if (GUILayout.Button("Explorer", GUILayout.Width(100))) { _showExplorer = true; } } } GUI.skin = prevSkin; GUI.depth = prevDepth; }
public void RenderExplorer() { if (!_showExplorer) { return; } bool restartDevice = false; if (_modeListStyle == null) { _modeListStyle = GUI.skin.GetStyle("ModeList"); } // List the devices GUILayout.BeginVertical("box", GUILayout.MinWidth(200), GUILayout.MaxHeight(200)); if (GUILayout.Button("Select Device")) { _deviceIndex = -1; _modeIndex = -1; restartDevice = true; } _deviceScrollPos = GUILayout.BeginScrollView(_deviceScrollPos, false, false); for (int i = 0; i < DeckLink.GetNumDevices(); i++) { Device device = DeckLink.GetDevice(i); if (device.DeviceIndex == _deviceIndex) { DeviceMode mode = IsInput() ? device.CurrentMode : device.CurrentOutputMode; if (mode != null && _modeIndex == mode.Index) { GUI.color = Color.green; } else { GUI.color = Color.blue; } } bool deviceValid = IsInput() ? device.CanInput() : device.CanOutput(); if (device.DeviceIndex == _deviceIndex || deviceValid) { if (GUILayout.Button(device.Name + " " + device.ModelName, _modeListStyle)) { if (_deviceIndex != device.DeviceIndex) { _deviceIndex = device.DeviceIndex; _modeIndex = -1; restartDevice = true; } } } GUI.color = Color.white; } GUILayout.EndScrollView(); GUILayout.EndVertical(); Device currDevice = DeckLink.GetDevice(_deviceIndex); if (currDevice != null) { GUILayout.BeginVertical("box", GUILayout.MinWidth(500), GUILayout.MaxHeight(200)); if (GUILayout.Button("Select Mode:")) { _modeIndex = -1; restartDevice = true; } _modeScrollPos = GUILayout.BeginScrollView(_modeScrollPos, false, false); int numModes = IsInput() ? currDevice.NumInputModes : currDevice.NumOutputModes; for (int j = 0; j < numModes; j++) { DeviceMode mode = IsInput() ? currDevice.GetInputMode(j) : currDevice.GetOutputMode(j); if (mode.Index == _modeIndex) { bool streamRunning = IsInput() ? currDevice.IsStreamingInput : currDevice.IsStreamingOutput; if (streamRunning) { GUI.color = Color.green; } else { GUI.color = Color.blue; } } if (GUILayout.Button("" + j.ToString("D2") + ") " + mode.ModeDescription + " - " + mode.PixelFormatDescription + " - " + mode.Width + "x" + mode.Height, _modeListStyle)) { if (mode.Index != _modeIndex) { _modeIndex = mode.Index; restartDevice = true; } } GUI.color = Color.white; } GUILayout.EndScrollView(); GUILayout.EndVertical(); } if (restartDevice) { Begin(); } }