Exemplo n.º 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
        }
Exemplo n.º 2
0
        protected override void BeginDevice()
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            DeckLinkPlugin.SetAutoDetectEnabled(_deviceIndex, _autoDetectMode);

            _device.AutoDeinterlace = _autoDeinterlace;
            int actualAudioChannels;

            if (_audioChannels <= 2)
            {
                actualAudioChannels = 2;
            }
            else
            {
                actualAudioChannels = 8;
            }

            int maxSupportedChannels = DeckLinkPlugin.GetMaxSupportedAudioChannels(_deviceIndex);
            if (actualAudioChannels > maxSupportedChannels)
            {
                actualAudioChannels = maxSupportedChannels;
            }

            if (!_device.StartInput(_modeIndex, actualAudioChannels))
            {
                _device.StopInput();
                _device = null;
            }
            if (_device != null)
            {
                _device.FlipInputX = _flipX;
                _device.FlipInputY = _flipY;

                DeviceMode mode = _device.GetInputMode(_modeIndex);
                _audioSource.clip = AudioClip.Create("DeckLink Input Audio", 48000 / (int)(mode.FrameRate + 0.5f), actualAudioChannels, 48000, false);
                _audioSource.Play();
            }
#endif
        }
Exemplo n.º 3
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
        }