Пример #1
0
 static ContainerVideoAudio()
 {
     _aqEvents = new ThreadBufferQueue<Tuple<EventDelegate, Effect, Effect>>(false, true);
     _cThreadEvents = new System.Threading.Thread(WorkerEvents);
     _cThreadEvents.IsBackground = true;
     _cThreadEvents.Start();
 }
Пример #2
0
 static Plugin()
 {
     _aqEvents = new ThreadBufferQueue<Tuple<EventDelegate, IPlugin>>(false, true);
     _cThreadEvents = new System.Threading.Thread(WorkerEvents);
     _cThreadEvents.IsBackground = true;
     _cThreadEvents.Start();
 }
Пример #3
0
		static PixelsMap()
		{
			if (0 < Preferences.nCUDAVersion)
			{
				_aqCommands = new ThreadBufferQueue<Command>(0, false);
				System.Threading.ThreadPool.QueueUserWorkItem(Worker);
			}
		}
Пример #4
0
		public Playlist()
			: base(EffectType.Playlist)
        {
			try
			{
				_nDefaultTransitionDuration = 0;
                _nEndTransDuration = 0;
				_aqContainerActions = new Queue<Dictionary<IEffect, ContainerAction>>();
				_aqPrepareQueue = new ThreadBufferQueue<IEffect>(false, true);
                _aItemsEffectHashCodesToDelete = new List<int>();
				_aItemsQueue = new List<Item>();
				_aItemsOnAir = new List<Item>();
				_cTransition = new Item(new Transition());
				_cTransition.bIsActive = false;
				_nNextTransDuration = ushort.MaxValue;
				_aAudioSilence = new byte[2 * Preferences.nAudioBytesPerFramePerChannel];
				System.Threading.ThreadPool.QueueUserWorkItem(PrepareAsync);
				//_nPrepareFrameQty = (ushort)(_nTransitionFrameQty * 4);

				aChannelsAudio = new byte[0];  // UNDONE
			}
			catch
			{
				Fail();
				throw;
			}
		}
Пример #5
0
        public Baetylus()
        {
            (new Logger()).WriteDebug3("in");
            lock (_cSyncRoot)
            {
                if (1 > _nReferencesQty)
                {
                    (new Logger()).WriteDebug4("baetylus:constructor:init");
                    _aqContainerActions = new Queue<Dictionary<IEffect, ContainerAction>>();

                    _aEffects = new List<IEffect>();
                    _stFullFrameArea = cBoard.stArea;
					_aqBufferFrame = new ThreadBufferQueue<Device.Frame>(Preferences.nQueueBaetylusLength, true, false);
					_aqPixelsMapsDisposed = new Queue<PixelsMap>();
                    _bNeedEffectsReorder = false;
					_cThreadWorker = new System.Threading.Thread(Worker);
					_cThreadWorker.IsBackground = true;
					_cThreadWorker.Priority = System.Threading.ThreadPriority.AboveNormal;
					_cThreadWorker.Start();
					_bDoWritingFrames = false;
					_aqWritingFrames = new Queue<byte[]>();
					_cThreadWritingFramesWorker = new System.Threading.Thread(WritingFramesWorker);
					_cThreadWritingFramesWorker.IsBackground = true;
					_cThreadWritingFramesWorker.Priority = System.Threading.ThreadPriority.Normal;
					_cThreadWritingFramesWorker.Start();

					cBoard.NextFrame += new NextFrameCallback(OnNextFrame);
                    cBoard.TurnOn();
                }
                _nReferencesQty++;
            }
            (new Logger()).WriteDebug4("return [refqty:" + _nReferencesQty + "]");
        }
Пример #6
0
        public Aja(DeviceScanner.NTV2DeviceInfo cDeviceInfo, uint nDeviceIndex)
            : base("Aja-" + nDeviceIndex + "_")
        {
            try
            {
                _nDeviceIndex      = nDeviceIndex;
                _nAudioQueueLength = 0;
                _bDoMultichannel   = true; // separate channels (if false, all channels provides one signal)
                string sMessage = "aja card [devid=" + cDeviceInfo.stWrapper.deviceID + "][device_id=" + cDeviceInfo.deviceIdentifier + "][multiformat=" + cDeviceInfo.stWrapper.multiFormat + "][ins=" + cDeviceInfo.stWrapper.numVidInputs + "][outs=" + cDeviceInfo.stWrapper.numVidOutputs + "]";
                if (bInput)
                {
                    throw new Exception("aja input mode has not relized yet");
                }
                else
                {
                    _eChannel = (AjaInterop.NTV2Channel)Preferences.nTargetChannel;

                    sMessage += "<br>\tsupported video formats:<br>\t\t" + cDeviceInfo.videoFormatsList.ToEnumerationString("<br>\t\t", "", null, null, true);
                    sMessage += "<br>\tsupported audio Bits Per Sample:<br>\t\t" + cDeviceInfo.audioBitsPerSampleList.ToEnumerationString("<br>\t\t", "", null, null, true);
                    sMessage += "<br>\tsupported audio in sources:<br>\t\t" + cDeviceInfo.audioInSourceList.ToEnumerationString("<br>\t\t", "", null, null, true);
                    sMessage += "<br>\tsupported audio out sources:<br>\t\t" + cDeviceInfo.audioOutSourceList.ToEnumerationString("<br>\t\t", "", null, null, true);
                    sMessage += "<br>\tsupported audio sample rates:<br>\t\t" + cDeviceInfo.audioSampleRateList.ToEnumerationString("<br>\t\t", "", null, null, true);
                    (new Logger("Aja", sName)).WriteNotice(sMessage);

                    if (Preferences.bAudio)
                    {
                        _nAudioChannelsQty = Preferences.nAudioChannelsQty;  // can be only 6, 8, 16
                        if (_nAudioChannelsQty != 6 && _nAudioChannelsQty != 8 && _nAudioChannelsQty != 16)
                        {
                            throw new Exception("unsupported audio channels qty (only 6, 8, 16) [" + _nAudioChannelsQty + "]");
                        }

                        switch (Preferences.nAudioSamplesRate)
                        {
                        case 48000:
                            _eAudioSampleRate = AjaInterop.NTV2AudioRate.NTV2_AUDIO_48K;
                            break;

                        case 96000:
                            _eAudioSampleRate = AjaInterop.NTV2AudioRate.NTV2_AUDIO_96K;
                            throw new Exception("96000 audio sample rate has not realised yet");

                        default:
                            throw new Exception("unsupported audio sample rate [" + Preferences.nAudioSamplesRate + "]");
                        }
                        //for (int nIndx = 0; _nAudioFrameSize_InBytes > nIndx; nIndx++)
                        //    Marshal.WriteByte(_pAudioSamplesBuffer, nIndx, 0);
                    }

                    _cCard = new NTV2Card(_nDeviceIndex, Preferences.bAudio, _eChannel, ePixelFormat, AjaTools.NTV2ChannelToOutputDestination(_eChannel), eVideoFormat, _eAudioSampleRate, _bDoMultichannel, _nAudioChannelsQty, false, false);
                    _cCard.SetVideoFormat();
                    ushort nW, nH;
                    _cCard.GetActiveFrameDimensions(out nW, out nH);
                    stArea          = new Area(0, 0, nW, nH);
                    _nVideoBytesQty = stArea.nWidth * stArea.nHeight * 4;

                    AjaInterop.NTV2FrameRate eFR;
                    switch (eFR = _cCard.GetCurrentFramrRate())
                    {
                    case AjaInterop.NTV2FrameRate.NTV2_FRAMERATE_2500:
                        Preferences.nFPS = 25;
                        break;

                    default:
                        throw new Exception("unsupported frame rate [" + eFR + "][video_format=" + _eVideoFormat + "]");
                    }
                    if (Preferences.bAudio)
                    {
                        _nAudioBufferCapacity_InSamples = Preferences.nAudioSamplesPerFrame * Preferences.nQueueDeviceLength;
                        _nChannelBytesQty = Preferences.nAudioSamplesPerFrame * Preferences.nAudioByteDepth;
                        _nAudioBytesQty   = _nAudioChannelsQty * _nChannelBytesQty;
                    }
                    _AjaFramesBufferMaxCount = 3;
                    _AjaFramesVideoBuffer    = new ThreadBufferQueue <Frame.Video>(_AjaFramesBufferMaxCount, true, true);
                    _AjaFramesVideoToDispose = new ThreadBufferQueue <Frame.Video>(false, false);
                    if (Preferences.bAudio)
                    {
                        _AjaFramesAudioBuffer    = new ThreadBufferQueue <Frame.Audio>(_AjaFramesBufferMaxCount, true, true);
                        _AjaFramesAudioToDispose = new ThreadBufferQueue <Frame.Audio>(false, false);
                    }
                    _bDoWritingFrames = false;
#if DEBUG
                    _aqWritingFrames            = new Queue <byte[]>();
                    _cThreadWritingFramesWorker = new System.Threading.Thread(WritingFramesWorker);
                    _cThreadWritingFramesWorker.IsBackground = true;
                    _cThreadWritingFramesWorker.Priority     = System.Threading.ThreadPriority.Normal;
                    _cThreadWritingFramesWorker.Start();
#endif

                    if (null != Preferences.cDownStreamKeyer)
                    {
                        throw new Exception("aja keyer has not realised yet");
                    }
                }
            }
            catch (Exception ex)
            {
                (new Logger("Aja", sName)).WriteError(ex);
                throw;
            }
        }