[xiph-commits] r10794 - in branches/oggdsf_new_demux/src/lib: codecs/ogm/filters/dsfOGMDecoder core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Fri Feb 10 12:12:34 PST 2006


Author: illiminable
Date: 2006-02-10 12:12:24 -0800 (Fri, 10 Feb 2006)
New Revision: 10794

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/dsfOGMDecoder.vcproj
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
Log:
* Improved ogm... for some reason crashes if the text stream gets connected to the official divx filter.

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp	2006-02-10 12:43:30 UTC (rev 10793)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp	2006-02-10 20:12:24 UTC (rev 10794)
@@ -54,7 +54,7 @@
 	:	CTransformFilter(NAME("OGM Video Decoder"), NULL, CLSID_OGMDecodeFilter)
 	,	mInputPin(NULL)
 	,	mOutputPin(NULL)
-	,	mFramesBuffered(0)
+	,	mOGMGranulesBuffered(0)
 	,	mSegStart(0)
 	,	mSegEnd(0)
 	,	mSegRate(0)
@@ -210,12 +210,17 @@
 	HRESULT locHR = inSample->GetPointer(&locInBuff);
 
 	if (locHR == S_OK) {
+		//Get the time input
 		REFERENCE_TIME locStart = -1;
 		REFERENCE_TIME locEnd = -1;
 		inSample->GetTime(&locStart, &locEnd);
+
+		//Do nothing if it's a header packet
 		if ((locInBuff[0] & 1) != 0) {
 			return S_OK;
 		}
+
+		//Get the sample length and setup some buffers
 		unsigned long locLength = inSample->GetActualDataLength();
 		unsigned char* locBuff = new unsigned char[locLength];
 		sSimplePack locPack;
@@ -223,14 +228,19 @@
 		locPack.mBuff = locBuff;
 		locPack.mLength = locLength;
 
-		unsigned long locNumLenBytes = locInBuff[0];
 		
-		
 		//Find out how many bytes of the header are the length field
+		unsigned long locNumLenBytes = locInBuff[0];
 		const unsigned char LEN_MASK = 0xC2; //11000010
 		locNumLenBytes &= LEN_MASK;
 		locNumLenBytes = (locNumLenBytes >> 6) | ((locNumLenBytes&2) << 1);
 
+		//Find out how many frames this will gnerate
+		//locPackTime represents different things for text, audio and video
+		//
+		//video	-	number of frames duration (can be more than 1 frame generated from a packet)
+		//audio	-	number of samples generated by this packet
+		//text	-	duration of text in 1ms units (ie 1000 = 1sec)
 		__int64 locPackTime = 0;
 		if (locNumLenBytes != 0) {
 			for (int i = 0; i <  locNumLenBytes; i++) {
@@ -240,8 +250,9 @@
 			locPackTime = 1;
 		}
 		
-		mFramesBuffered += locPackTime;
-		locPack.mDuration = locPackTime;
+		//Buffer up the packet	-	
+		mOGMGranulesBuffered += locPackTime;			//VS:::
+		locPack.mDuration = locPackTime;		//VS:::
 		locPack.mHeaderSize = locNumLenBytes + 1;
 		locPack.mIsKeyframe = ((locInBuff[0] & (1<<3)) != 0);
 
@@ -251,11 +262,11 @@
 			REFERENCE_TIME locGlobalStart = 0;
 			REFERENCE_TIME locGlobalEnd = 0;
 
-			__int64 locFrameDuration = mInputPin->getVideoFormatBlock()->AvgTimePerFrame;
+			//__int64 locFrameDuration = mInputPin->getVideoFormatBlock()->AvgTimePerFrame;		//VS:::
 			__int64 locNumBuffered = mPacketBuffer.size();
 
-			locGlobalEnd = locEnd * locFrameDuration;
-			locGlobalStart = locGlobalEnd - (mFramesBuffered * locFrameDuration);
+			locGlobalEnd = mInputPin->convertGranuleToTime(locEnd); //locEnd * locFrameDuration;											//VS:::
+			locGlobalStart = locGlobalEnd - (mInputPin->convertGranuleToTime(mOGMGranulesBuffered));//locGlobalEnd - (mOGMGranulesBuffered * locFrameDuration);				//VS:::
 
 			__int64 locUptoStart = locGlobalStart;
 			__int64 locUptoEnd = locGlobalStart;
@@ -267,7 +278,7 @@
 				
 				locHR = InitializeOutputSample(inSample, &locOutSample);
 				if (locHR == S_OK) {
-					locUptoEnd = locUptoStart + (mPacketBuffer[i].mDuration * locFrameDuration);
+					locUptoEnd = locUptoStart + (mInputPin->convertGranuleToTime(mPacketBuffer[i].mDuration));//locUptoStart + (mPacketBuffer[i].mDuration * locFrameDuration);		//VS:::
 
 					locAdjustedStart = locUptoStart - mSegStart;
 					locAdjustedEnd = locUptoEnd - mSegStart;
@@ -308,6 +319,8 @@
 			return S_OK;
 		}
 
+	} else {
+		return locHR;
 	}
 }
 
@@ -317,7 +330,7 @@
 		delete[] mPacketBuffer[i].mBuff;
 	}
 	mPacketBuffer.clear();
-	mFramesBuffered = 0;
+	mOGMGranulesBuffered = 0;
 }
 HRESULT OGMDecodeFilter::Transform(IMediaSample* inInputSample, IMediaSample* inOutputSample)
 {

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h	2006-02-10 12:43:30 UTC (rev 10793)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h	2006-02-10 20:12:24 UTC (rev 10794)
@@ -83,8 +83,11 @@
 		bool mIsKeyframe;
 		
 	};
-	unsigned long mFramesBuffered;
 
+
+	
+	unsigned long mOGMGranulesBuffered;
+
 	__int64 mSegStart;
 	__int64 mSegEnd;
 	double mSegRate;

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/dsfOGMDecoder.vcproj
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/dsfOGMDecoder.vcproj	2006-02-10 12:43:30 UTC (rev 10793)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/dsfOGMDecoder.vcproj	2006-02-10 20:12:24 UTC (rev 10794)
@@ -25,7 +25,7 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="3"
-				WarningLevel="3"
+				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"
 				CallingConvention="2"/>

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2006-02-10 12:43:30 UTC (rev 10793)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2006-02-10 20:12:24 UTC (rev 10794)
@@ -25,7 +25,7 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"
 				CallingConvention="2"/>



More information about the commits mailing list