Пример #1
0
        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
        }