public void ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
        {
            /*
             * Have the roating cube here as it will
             * Move at a realtive frequency to the updates
             * to the decklink card
             */
            if (squareRotx >= 360)
            {
                squareRotx = 0.0f;
            }

            if (squareRoty >= 360)
            {
                squareRoty = 0.0f;
            }

            squareRotx += 1.5f;
            squareRoty += 0.5f;

            _deckLinkOutput.ScheduleVideoFrame(_videoFrame, (_totalFrames * _frameDuration), _frameDuration, _frameTimescale);
            _totalFrames++;
        }
Exemple #2
0
 public DeckLinkOutputFrameCompletitonEventArgs(_BMDOutputFrameCompletionResult completionResult)
 {
     this.completionResult = completionResult;
 }
Exemple #3
0
        // Explicit implementation of IDeckLinkVideoOutputCallback and IDeckLinkAudioOutputCallback
        void IDeckLinkVideoOutputCallback.ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
        {
            // When a video frame has been completed, generate event to schedule next frame
            var handler = VideoFrameCompletedHandler;

            // Check whether any subscribers to VideoFrameCompletedHandler event
            if (handler != null)
            {
                handler(this, new DeckLinkOutputFrameCompletitonEventArgs(result));
            }
        }
 // Explicit implementation of IDeckLinkVideoOutputCallback and IDeckLinkAudioOutputCallback
 void IDeckLinkVideoOutputCallback.ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
 {
     if (FrameDrawnCallback != null)
     {
         FrameDrawnCallback((int)m_totalFramesScheduled);
     }
 }
Exemple #5
0
 public void ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
 {
     System.Diagnostics.Debug.WriteLine("ScheduledFrameCompleted: " + result);
     ScheduleNextFrame(false);
 }
        // Explicit implementation of IDeckLinkVideoOutputCallback and IDeckLinkAudioOutputCallback
        void IDeckLinkVideoOutputCallback.ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
        {
            // Note: if you throw an exception, it will be ignored by the caller.

            // When a frame has been completed
            ScheduleNextFrame(false);
        }
 // Explicit implementation of IDeckLinkVideoOutputCallback and IDeckLinkAudioOutputCallback
 void IDeckLinkVideoOutputCallback.ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
 {
     // When a video frame has been completed, generate event to schedule next frame
     VideoFrameCompleted(false);
 }
Exemple #8
0
		public void ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
		{
			ScheduleFrame(false);
		}
 public void ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
 {
     ScheduleFrame(false);
 }
Exemple #10
0
		void IDeckLinkVideoOutputCallback.ScheduledFrameCompleted(IDeckLinkVideoFrame completedFrame, _BMDOutputFrameCompletionResult result)
		{
			try
			{
				switch (result)
				{
					case _BMDOutputFrameCompletionResult.bmdOutputFrameDisplayedLate:
						_nFramesLated++;
						(new Logger()).WriteNotice("frame lated. total:" + _nFramesLated);
						break;
					case _BMDOutputFrameCompletionResult.bmdOutputFrameDropped:
						_nFramesDropped++;
						(new Logger()).WriteNotice("frame dropped. total:" + _nFramesDropped);
						break;
					case _BMDOutputFrameCompletionResult.bmdOutputFrameFlushed:
						_nFramesFlushed++;
						(new Logger()).WriteNotice("frame flushed. total:" + _nFramesFlushed);
						break;
					//default:
					//    (new Logger()).WriteDebug4("ScheduledFrameCompleted normal");
					//    break;
				}
				Frame.Video oFrame;
				Frame.Video[] aFramesOvertimed;
				long nNow = _cStopWatch.ElapsedMilliseconds;
				lock (_ahFramesBuffersBinds)
				{
					oFrame = _ahFramesBuffersBinds.FirstOrDefault(o => o.Value == completedFrame).Key;
					if (null != oFrame && _aCurrentFramesIDs.ContainsKey(oFrame.nID))
					{
						(new Logger()).WriteDebug4("frame " + oFrame.nID + " was passed in " + (nNow - _aCurrentFramesIDs[oFrame.nID]) + " ms");  
						_aCurrentFramesIDs.Remove(oFrame.nID);
					}
					else if (0 < oFrame.nID)
						(new Logger()).WriteError("VERY STRANGE - 1  [id=" + oFrame.nID + "]");

					foreach (ulong nVFid in _aCurrentFramesIDs.Keys.Where(o => (Preferences.nQueueDeviceLength * 40 + 500) < nNow - _aCurrentFramesIDs[o]))
					{
						(new Logger()).WriteDebug2("There are some over timed frames in decklink buffer: \n");
						(new Logger()).WriteDebug2("\t\t[id=" + nVFid + "][delta=" + _aCurrentFramesIDs[nVFid] + "]\n");
					}
				}


				if (null == oFrame)
					(new Logger()).WriteWarning("frame is not in _ahFramesBuffersBinds");
				else
				{
					FrameBufferReleased(oFrame);
				}

				long nDelta = _cStopWatch.ElapsedMilliseconds - _nLastScTimeComplited;
				if (100 < nDelta || 1 > nDelta)
					(new Logger()).WriteDebug2("Last ScheduledFrameCompleted was " + nDelta + " ms ago");
				_nLastScTimeComplited = _cStopWatch.ElapsedMilliseconds;

				_bNeedToAddFrame = true;
				#region закаменчено /*   */ 
				//bool bFound = false;
				//IntPtr pFrameLast = IntPtr.Zero;
				//if (completedFrame != _cFrameEmpty)
				//{
				//    IDeckLinkMutableVideoFrame iFrame = (IDeckLinkMutableVideoFrame)completedFrame;
				//    if (0 > _aFramesRecovered.IndexOf(iFrame))
				//    {
				//        lock (_ahFramesBuffersBinds)
				//        {
				//            foreach (IntPtr pFB in _ahFramesBuffersBinds.Keys.ToArray())
				//            {
				//                if (iFrame == _ahFramesBuffersBinds[pFB])
				//                {
				//                    _ahFramesBuffersBinds.Remove(pFB);
				//                    pFrameLast = pFB;
				//                    bFound = true;
				//                    break;
				//                }
				//            }
				//        }
				//    }
				//    else
				//    {
				//        bFound = true;
				//        _aFramesRecovered.Remove(iFrame);
				//    }
				//}
				//if (!bFound)
				//    throw new Exception("не найден показанный кадр");
				//if (Preferences.bFrameLastSave && IntPtr.Zero != pFrameLast)
				//{
				//    if (null == aFrameLastBytes)
				//        aFrameLastBytes = new byte[completedFrame.GetHeight() * completedFrame.GetRowBytes()];
				//    lock (aFrameLastBytes)
				//        Marshal.Copy(pFrameLast, aFrameLastBytes, 0, aFrameLastBytes.Length);
				//}
				#endregion
			}
			catch (Exception ex)
			{
				(new Logger()).WriteError(ex);
			}
		}