Exemple #1
0
        /*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);
            }

            DeckLinkPlugin.SetGenlockOffset(_deviceIndex, _genlockOffset);

            if (DeckLinkPlugin.StartOutputStream(_deviceIndex, modeIndex))
            {
                //_currentOutputMode = _outputModes[modeIndex];
                _currentOutputMode = _outputModes[modeIndex];

                //if (_currentOutputMode.Width > 0 && _currentOutputMode.Width <= 4096 && _currentOutputMode.Height > 0 && _currentOutputMode.Height <= 4096)
                if (_currentOutputMode.Width > 0 && _currentOutputMode.Width <= 4096 && _currentOutputMode.Height > 0 && _currentOutputMode.Height <= 4096)
                {
                    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");
                StopOutput();
            }

            return(result);
#else
            return(false);
#endif
        }
Exemple #2
0
        /*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
        }