[xiph-commits] r10365 - branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Fri Nov 11 00:16:20 PST 2005


Author: illiminable
Date: 2005-11-11 00:16:15 -0800 (Fri, 11 Nov 2005)
New Revision: 10365

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
Log:
* OGM video streams working properly, including seeking (but not keyframe seeking)

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	2005-11-11 07:28:09 UTC (rev 10364)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp	2005-11-11 08:16:15 UTC (rev 10365)
@@ -56,6 +56,9 @@
 	,	mInputPin(NULL)
 	,	mOutputPin(NULL)
 	,	mFramesBuffered(0)
+	,	mSegStart(0)
+	,	mSegEnd(0)
+	,	mSegRate(0)
 	
 {
 
@@ -136,6 +139,14 @@
 	}
 	
 }
+
+HRESULT OGMDecodeFilter::NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate)
+{
+	mSegStart = inStartTime;
+	mSegEnd = inStopTime;
+	mSegRate = inRate;
+	return CTransformFilter::NewSegment(inStartTime, inStopTime, inRate);
+}
 HRESULT OGMDecodeFilter::GetMediaType(int inPosition, CMediaType* outMediaType)
 {
 	
@@ -183,13 +194,17 @@
 		
 		
 		//Find out how many bytes of the header are the length field
-		const unsigned char LEN_MASK = 0x43; //01000011
+		const unsigned char LEN_MASK = 0xC2; //11000010
 		locNumLenBytes &= LEN_MASK;
 		locNumLenBytes = (locNumLenBytes >> 6) | ((locNumLenBytes&2) << 1);
 
 		__int64 locPackTime = 0;
-		for (int i = 0; i <  locNumLenBytes; i++) {
-			locPackTime |= ((__int64)locInBuff[1+i] << (i * 8));
+		if (locNumLenBytes != 0) {
+			for (int i = 0; i <  locNumLenBytes; i++) {
+				locPackTime |= ((__int64)locInBuff[1+i] << (i * 8));
+			}
+		} else {
+			locPackTime = 1;
 		}
 		
 		mFramesBuffered += locPackTime;
@@ -211,14 +226,20 @@
 
 			__int64 locUptoStart = locGlobalStart;
 			__int64 locUptoEnd = locGlobalStart;
+
+			__int64 locAdjustedStart = 0;
+			__int64 locAdjustedEnd = 0;
 			for (int i = 0; i < locNumBuffered; i++) {
 				IMediaSample* locOutSample = NULL;
 				
 				locHR = InitializeOutputSample(inSample, &locOutSample);
 				if (locHR == S_OK) {
 					locUptoEnd = locUptoStart + (mPacketBuffer[i].mDuration * locFrameDuration);
-					locOutSample->SetTime(&locUptoStart, &locUptoEnd);
-					locOutSample->SetMediaTime(&locUptoStart, &locUptoEnd);
+
+					locAdjustedStart = locUptoStart - mSegStart;
+					locAdjustedEnd = locUptoEnd - mSegStart;
+					locOutSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
+					locOutSample->SetMediaTime(&locAdjustedStart, &locAdjustedEnd);
 					locOutSample->SetSyncPoint(mPacketBuffer[i].mIsKeyframe);
 					locOutSample->SetActualDataLength(mPacketBuffer[i].mLength - mPacketBuffer[i].mHeaderSize);
 					BYTE* locOutBuff = NULL;
@@ -233,8 +254,8 @@
 					}
 
 					
+					locUptoStart = locUptoEnd;
 
-
 					
 				} else {
 					deleteBufferedPackets();

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	2005-11-11 07:28:09 UTC (rev 10364)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h	2005-11-11 08:16:15 UTC (rev 10365)
@@ -65,6 +65,8 @@
 
 	virtual HRESULT Receive(IMediaSample* inSample);
 
+	virtual HRESULT NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
+
 	virtual CBasePin* GetPin(int inPinNo);
 
 
@@ -83,5 +85,9 @@
 	};
 	unsigned long mFramesBuffered;
 
+	__int64 mSegStart;
+	__int64 mSegEnd;
+	double mSegRate;
+
 	vector<sSimplePack> mPacketBuffer;
 };



More information about the commits mailing list