protected override void BeginDevice() { _currCapturedFrame = 0; #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN _device.GenlockOffset = _genlockPixelOffset; if (_current3DEnabled) { if (!DeckLinkPlugin.IsOutputMode3DSupported(_deviceIndex, _modeIndex)) { _current3DEnabled = false; Debug.LogWarning("[AVProDeckLink] Output mode does not support stereo mode " + _modeIndex + ", disabling"); } } DeckLinkPlugin.Set3DPlaybackEnabled(_device.DeviceIndex, _current3DEnabled); _device.LowLatencyMode = _lowLatencyMode; // Set keying mode before the output has started, as this can affect buffer allocation sizes if (_keyerMode != KeyerMode.None) { _device.CurrentKeyingMode = _keyerMode; } // Try starting output if (!_device.StartOutput(_modeIndex)) { Debug.LogWarning("[AVProDeckLink] device failed to start."); StopOutput(); _device = null; } else { DeviceMode mode = _device.GetOutputMode(_modeIndex); RegisterAudioOutput(); float framerate = mode.FrameRate; InitCaptureBlendResources(mode.Width, mode.Height); if (mode.InterlacedFieldMode) { _interlaced = true; framerate *= 2; InitInterlaceResources(mode.Width, mode.Height); } else { _interlaced = false; } InitConversionResources(mode.PixelFormat, mode.Width, mode.Height); if (!DeckLinkSettings.Instance._multiOutput && !_syncedToInput) { Application.targetFrameRate = _targetFrameRate = Mathf.CeilToInt(framerate); #if !UNITY_2018_2_OR_NEWER Time.captureFramerate = _targetFrameRate; #endif } else { Application.targetFrameRate = Time.captureFramerate = -1; _outputFrameRate = _targetFrameRate = Mathf.CeilToInt(framerate); } AttachToCamera(); } #endif }