[xiph-commits] r10295 - in branches/oggdsf_new_demux/src/lib: codecs/vorbis/filters/dsfVorbisDecoder core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Mon Oct 24 13:22:08 PDT 2005


Author: illiminable
Date: 2005-10-24 13:22:03 -0700 (Mon, 24 Oct 2005)
New Revision: 10295

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
Log:
* Sample accurate seeking in vorbis (or at least +- 1 sample, until i test it)

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-24 16:50:53 UTC (rev 10294)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-24 20:22:03 UTC (rev 10295)
@@ -376,33 +376,48 @@
 					}
 
 					locBytesToCopy = ((mDecodedByteCount - locBytesCopied) <= locSample->GetSize()) ? (mDecodedByteCount - locBytesCopied) : locSample->GetSize();
+					//locBytesCopied += locBytesToCopy;
 
-					memcpy((void*)locBuffer, (const void*)&mDecodedBuffer[locBytesCopied], locBytesToCopy);
-					locBytesCopied += locBytesToCopy;
-
 					locSampleDuration = (((locBytesToCopy/mFrameSize) * UNITS) / mSampleRate);
 					locEnd = locStart + locSampleDuration;
 
-					//Write the sample meta data
-					//TODO:: Seeking offset
-
+					//Adjust the time stamps for rate and seeking
 					REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
 					REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
-
 					locAdjustedStart -= m_tStart;
 					locAdjustedEnd -= m_tStart;
-					locSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
-					locSample->SetMediaTime(&locStart, &locEnd);
-					locSample->SetSyncPoint(TRUE);
-					locSample->SetActualDataLength(locBytesToCopy);
-					locHR = ((VorbisDecodeOutputPin*)(mOutputPin))->mDataQueue->Receive(locSample);
-					if (locHR != S_OK) {
-						return locHR;
-					}
-					locStart += locSampleDuration;
 
+					__int64 locSeekStripOffset = 0;
+					if (locAdjustedEnd < 0) {
+						locSample->Release();
+					} else {
+						if (locAdjustedStart < 0) {
+							locSeekStripOffset = (-locAdjustedStart) * mSampleRate;
+							locSeekStripOffset *= mFrameSize;
+							locSeekStripOffset /= UNITS;
+							locSeekStripOffset += (mFrameSize - (locSeekStripOffset % mFrameSize));
+							__int64 locStrippedDuration = (((locSeekStripOffset/mFrameSize) * UNITS) / mSampleRate);
+							locAdjustedStart += locStrippedDuration;
+						}
+							
 
+					
 
+						memcpy((void*)locBuffer, (const void*)&mDecodedBuffer[locBytesCopied + locSeekStripOffset], locBytesToCopy - locSeekStripOffset);
+
+						locSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
+						locSample->SetMediaTime(&locStart, &locEnd);
+						locSample->SetSyncPoint(TRUE);
+						locSample->SetActualDataLength(locBytesToCopy - locSeekStripOffset);
+						locHR = ((VorbisDecodeOutputPin*)(mOutputPin))->mDataQueue->Receive(locSample);
+						if (locHR != S_OK) {
+							return locHR;
+						}
+						locStart += locSampleDuration;
+
+					}
+					locBytesCopied += locBytesToCopy;
+
 				
 				} while(locBytesCopied < mDecodedByteCount);
 

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-10-24 16:50:53 UTC (rev 10294)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-10-24 20:22:03 UTC (rev 10295)
@@ -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