Пример #1
0
        public Device(string modelName, string name, int index)
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            IsStreamingAudio = false;
            IsStreaming      = false;
            IsPaused         = true;
            IsPicture        = false;
            _name            = name;
            _modelName       = modelName;
            _deviceIndex     = index;
            _genlockOffset   = 0;
            _supportsInputModeAutoDetection = DeckLinkPlugin.SupportsInputModeAutoDetection(_deviceIndex);
            _supportsInternalKeying         = DeckLinkPlugin.SupportsInternalKeying(_deviceIndex);
            _supportsExternalKeying         = DeckLinkPlugin.SupportsExternalKeying(_deviceIndex);
            _maxSupportedAudioChannels      = DeckLinkPlugin.GetMaxSupportedAudioChannels(_deviceIndex);
            _supportsFullFrameGenlockOffset = DeckLinkPlugin.SupportsFullFrameGenlockOffset(_deviceIndex);
            _supportsConfigurableDuplex     = DeckLinkPlugin.ConfigurableDuplexMode(_deviceIndex);
            _inputModes      = new List <DeviceMode>(256);
            _outputModes     = new List <DeviceMode>(256);
            _formatConverter = new FormatConverter();

            _ancPacketsBufferHandle = GCHandle.Alloc(_ancPackets, GCHandleType.Pinned);
            _ancPacketsBufferPtr    = _ancPacketsBufferHandle.AddrOfPinnedObject();
            _ancDataBufferHandle    = GCHandle.Alloc(_ancData, GCHandleType.Pinned);
            _ancDataBufferPtr       = _ancDataBufferHandle.AddrOfPinnedObject();

            _fullDuplexSupported = DeckLinkPlugin.FullDuplexSupported(_deviceIndex);
            EnumModes();
#if AVPRODECKLINK_UNITYFEATURE_NONPOW2TEXTURES
            DeckLinkPlugin.SetPotTextures(_deviceIndex, SystemInfo.npotSupport == NPOTSupport.None);
            DeckLinkPlugin.SetGammaSpace(_deviceIndex, QualitySettings.activeColorSpace == ColorSpace.Gamma);
#endif
#endif
        }
Пример #2
0
        public void Dispose()
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            if (_formatConverter != null)
            {
                _formatConverter.Dispose();
                _formatConverter = null;
            }
#endif
        }
Пример #3
0
        public void Update()
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            if (_isStreamingInput)
            {
                // Check if the input mode has changed
                if (DeckLinkPlugin.IsNoInputSignal(_deviceIndex))
                {
                    _receivedSignal = false;
                    DroppedInputSignalCount++;
                    return;
                }
                else
                {
                    _receivedSignal = true;
                }

                int modeIndex = DeckLinkPlugin.GetVideoInputModeIndex(_deviceIndex);
                if (modeIndex != _currentMode.Index)
                {
                    var newMode = _inputModes[modeIndex];

                    if (!FormatConverter.InputFormatSupported(newMode.PixelFormat))
                    {
                        Debug.LogWarning("Auto detected format for input device not currently supported");
                    }

                    if (modeIndex >= 0 && modeIndex < _inputModes.Count)
                    {
                        // If the device has changed mode we may need to rebuild buffers
                        ChangeInput(modeIndex, true);
                        return;
                    }
                }

                if (EnableAncillaryDataInput)
                {
                    UpdateAncillaryData();
                }
                if (EnableTimeCodeInput)
                {
                    UpdateTimeCode();
                }

                // Update textures
                if (_formatConverter != null)
                {
                    UpdateFPS(_formatConverter.Update());
                }
            }
#endif
        }
Пример #4
0
        public void Dispose()
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            // Free the pinned buffer
            if (_ancPacketsBufferPtr != System.IntPtr.Zero)
            {
                _ancPacketsBufferHandle.Free();
                _ancPacketsBufferPtr = System.IntPtr.Zero;
            }
            // Free the pinned buffer
            if (_ancDataBufferPtr != System.IntPtr.Zero)
            {
                _ancDataBufferHandle.Free();
                _ancDataBufferPtr = System.IntPtr.Zero;
            }

            if (_formatConverter != null)
            {
                _formatConverter.Dispose();
                _formatConverter = null;
            }
#endif
        }
Пример #5
0
        public Device(string modelName, string name, int index)
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            IsStreamingAudio = false;
            IsStreaming      = false;
            IsPaused         = true;
            IsPicture        = false;
            _name            = name;
            _modelName       = ModelName;
            _deviceIndex     = index;
            _genlockOffset   = 0;
            _supportsInputModeAutoDetection = DeckLinkPlugin.SupportsInputModeAutoDetection(_deviceIndex);
            _supportsInternalKeying         = DeckLinkPlugin.SupportsInternalKeying(_deviceIndex);
            _supportsExternalKeying         = DeckLinkPlugin.SupportsExternalKeying(_deviceIndex);
            _maxSupportedAudioChannels      = DeckLinkPlugin.GetMaxSupportedAudioChannels(_deviceIndex);
            _supportsFullFrameGenlockOffset = DeckLinkPlugin.SupportsFullFrameGenlockOffset(_deviceIndex);
            _supportsConfigurableDuplex     = DeckLinkPlugin.ConfigurableDuplexMode(_deviceIndex);
            _inputModes          = new List <DeviceMode>(32);
            _outputModes         = new List <DeviceMode>(32);
            _formatConverter     = new FormatConverter();
            _fullDuplexSupported = DeckLinkPlugin.FullDuplexSupported(_deviceIndex);
            EnumModes();
#endif
        }