Hi,

attached patch implement kind of timecode barrier i.e. skip frames if their timecode less then specified. this patch makes possible a frame-accurate capturing from VTR sources.

--
________________________________________
Maksym Veremeyenko
>From d6cf2b875e6bfe1ef5802942408076e87c18196c Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1.tv>
Date: Sun, 22 Jun 2014 17:43:48 +0300
Subject: [PATCH 3/6] implement timecode barier - skip all frames with VITC
 less then specified with vitc_in property (BCD
 formatted)

---
 src/modules/decklink/producer_decklink.cpp |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp
index c580080..df46d7b 100644
--- a/src/modules/decklink/producer_decklink.cpp
+++ b/src/modules/decklink/producer_decklink.cpp
@@ -406,8 +406,29 @@ public:
 		// Copy video
 		if ( video )
 		{
+			IDeckLinkTimecode* timecode = 0;
+
 			if ( !( video->GetFlags() & bmdFrameHasNoInputSource ) )
 			{
+				int vitc_in = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( getProducer() ), "vitc_in" );
+				if ( vitc_in && ( S_OK == video->GetTimecode( bmdTimecodeRP188, &timecode ) ||
+					S_OK == video->GetTimecode( bmdTimecodeVITC, &timecode ))  && timecode )
+				{
+					int vitc = timecode->GetBCD();
+					SAFE_RELEASE( timecode );
+
+					mlt_log_verbose( getProducer(),
+						"VideoInputFrameArrived: vitc=%.8X vitc_in=%.8X\n", vitc, vitc_in);
+
+					if ( vitc < vitc_in )
+					{
+						pthread_cond_broadcast( &m_condition );
+						return S_OK;
+					}
+
+					mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( getProducer() ), "vitc_in", 0 );
+				}
+
 				int size = video->GetRowBytes() * ( video->GetHeight() + m_vancLines );
 				void* image = mlt_pool_alloc( size );
 				void* buffer = 0;
@@ -457,7 +478,6 @@ public:
 				mlt_log_verbose( getProducer(), "frame is invalid\n" );
 
 			// Get timecode
-			IDeckLinkTimecode* timecode = 0;
 			if ( video->GetTimecode( bmdTimecodeVITC, &timecode ) == S_OK && timecode )
 			{
 				DLString timecodeString = 0;
-- 
1.7.7.6

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to