[xiph-commits] r10315 - in branches/oggdsf_new_demux/src/lib: codecs/theora/filters/dsfTheoraDecoder core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Mon Oct 31 23:51:35 PST 2005


Author: illiminable
Date: 2005-10-31 23:51:27 -0800 (Mon, 31 Oct 2005)
New Revision: 10315

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
   branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
Log:
* Improve seeking in theora... in theory it's jumping back far enough to get a keyframe... but it's not working yet. I think it's displaying some pre-keyframe gunk from the start of the page containing the keyframe

Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2005-11-01 06:24:58 UTC (rev 10314)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2005-11-01 07:51:27 UTC (rev 10315)
@@ -408,8 +408,13 @@
 					}
 					debugLog<<"Theora::Receive - Output sample initialisation suceeded"<<endl;
 
+					//REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
+					//REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
+					REFERENCE_TIME locAdjustedStart = locStart - m_tStart;
+					REFERENCE_TIME locAdjustedEnd = locStart - m_tStart;
+
 					//Fill the sample info
-					if (TheoraDecoded(locYUV, locOutSample, locIsKeyFrame, locStart, locEnd) != S_OK) {
+					if (TheoraDecoded(locYUV, locOutSample, locIsKeyFrame, locAdjustedStart, locAdjustedEnd) != S_OK) {
 						
 						//XTODO::: We need to trash our buffered packets
 						locOutSample->Release();

Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2005-11-01 06:24:58 UTC (rev 10314)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2005-11-01 07:51:27 UTC (rev 10315)
@@ -103,15 +103,29 @@
 	//} else {
 	//	return -1;
 	//}
+	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
 
-	//XTODO:::
-	return -1;
+
+	LOOG_INT64 locMod = ((LOOG_INT64)1)<<locParent->getTheoraFormatBlock()->maxKeyframeInterval; //(unsigned long)pow((double) 2, (double) mGranulePosShift);
+	LOOG_INT64 locInterFrameNo = (LOOG_INT64) ( inGranule % locMod );
+			
+
+	//LOOG_INT64 retTime ((((inGranule >> locParent->getTheoraFormatBlock()->maxKeyframeInterval) + locInterFrameNo) * UNITS) * locParent->getTheoraFormatBlock()->frameRateDenominator) / locParent->getTheoraFormatBlock()->frameRateNumerator;
+
+	LOOG_INT64 retTime = inGranule >> locParent->getTheoraFormatBlock()->maxKeyframeInterval;
+	retTime += locInterFrameNo;
+	retTime *= UNITS;
+	retTime *= locParent->getTheoraFormatBlock()->frameRateDenominator;
+	retTime /= locParent->getTheoraFormatBlock()->frameRateNumerator;
+	return retTime;
+
 }
 
 LOOG_INT64 TheoraDecodeInputPin::mustSeekBefore(LOOG_INT64 inGranule)
 {
-	//TODO::: Get adjustment from block size info... for now, it doesn't matter if no preroll
-	return inGranule;
+	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
+	LOOG_INT64 locShift = locParent->getTheoraFormatBlock()->maxKeyframeInterval;
+	return (inGranule >> locShift) << locShift;
 }
 IOggDecoder::eAcceptHeaderResult TheoraDecodeInputPin::showHeaderPacket(OggPacket* inCodecHeaderPacket)
 {

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-11-01 06:24:58 UTC (rev 10314)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-11-01 07:51:27 UTC (rev 10315)
@@ -629,7 +629,7 @@
 		
 		
 		//For now, seek to the position directly, later we will discard the preroll
-		//*pCurrent = locStartPos.first;
+		*pCurrent = locStartPos.first;
 
 		{
 			//debugLog<<"       : Delivering End Flush..."<<endl;



More information about the commits mailing list