/*public bool StartAudioOutput(int numChannels) * { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN * if (IsStreamingAudio) * { * StopAudio(); * } * * if (numChannels > 0 && numChannels <= MaxAudioChannels) * { * IsStreamingAudio = DeckLinkPlugin.StartAudioOutput(_deviceIndex, numChannels); * } * else * { * Debug.LogError("Unsupported number of audio channels " + numChannels + " vs " + MaxAudioChannels); * } * * return IsStreamingAudio; #else * return false; #endif * }*/ public bool StartOutput(int modeIndex) { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN bool result = false; if (_isStreamingOutput) { Debug.Log("Warning: Please stop device before starting new stream"); return(false); } if (_formatConverter.Enable3DInput) { if (!DeckLinkPlugin.IsInputMode3DSupported(_deviceIndex, modeIndex)) { _formatConverter.Enable3DInput = false; Debug.LogWarning("[AVProDeckLink] Input mode does not support stereo mode " + modeIndex + ", disabling"); } } DeckLinkPlugin.SetGenlockOffset(_deviceIndex, _genlockOffset); if (DeckLinkPlugin.StartOutputStream(_deviceIndex, modeIndex)) { //_currentOutputMode = _outputModes[modeIndex]; _currentOutputMode = _outputModes[modeIndex]; if (_currentOutputMode.Width > 0 && _currentOutputMode.Width <= MaxWidth && _currentOutputMode.Height > 0 && _currentOutputMode.Height <= MaxHeight) { ResetFPS(); IsActive = true; IsStreaming = true; _isStreamingOutput = true; IsPicture = false; IsPaused = false; result = true; } else { Debug.LogWarning("[AVProDeckLink] Invalid width or height"); } } /*if(!DeckLinkPlugin.StartAudioOutput(_deviceIndex, 2)) * { * Debug.LogWarning("[AVProDeckLink] Unable to start audio output stream"); * }*/ if (!result) { Debug.LogWarning("[AVProDeckLink] Unable to start output device"); if (modeIndex < 0) { Debug.LogWarning("[AVProDeckLink] Possible that output resolution or pixel format isn't available"); } StopOutput(); } return(result); #else return(false); #endif }
public bool StartInput(int modeIndex, int numAudioChannels, bool delayResourceCreationUntilFramesStart = false, bool useHdr = false) { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN bool result = false; if (modeIndex == -1) { return(false); } if (!CanInput()) { Debug.LogWarning("[AVProDeckLink] Warning: Unable to start input for device " + _name + " as it is currently busy"); return(false); } if (_formatConverter.Enable3DInput) { if (!DeckLinkPlugin.IsInputMode3DSupported(_deviceIndex, modeIndex)) { _formatConverter.Enable3DInput = false; Debug.LogWarning("[AVProDeckLink] Input mode does not support stereo mode " + modeIndex + ", disabling"); } } DeckLinkPlugin.Set3DCaptureEnabled(_deviceIndex, _formatConverter.Enable3DInput); DeckLinkPlugin.SetAncillaryDataCaptureEnabled(_deviceIndex, EnableAncillaryDataInput); DeckLinkPlugin.SetTimeCodeCaptureEnabled(_deviceIndex, EnableTimeCodeInput); if (DeckLinkPlugin.StartInputStream(_deviceIndex, modeIndex, numAudioChannels)) { _audioChannels = numAudioChannels; _currentMode = _inputModes[modeIndex]; result = true; IsActive = true; IsStreaming = true; IsPicture = false; IsPaused = false; DroppedInputSignalCount = 0; result = true; _isStreamingInput = true; ResetFPS(); if (_currentMode.Width > 0 && _currentMode.Width <= MaxWidth && _currentMode.Height > 0 && _currentMode.Height <= MaxHeight) { _formatConverter.AutoDeinterlace = _autoDeinterlace; _formatConverter.Build(_deviceIndex, _currentMode, delayResourceCreationUntilFramesStart, useHdr); } else { Debug.LogWarning("[AVProDeckLink] invalid width or height"); } } else { Debug.LogWarning("[AVProDeckLink] Unable to start input stream on device " + _name); } if (!result) { StopInput(); } return(result); #else return(false); #endif }