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

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sun Oct 23 11:58:32 PDT 2005


Author: illiminable
Date: 2005-10-23 11:58:24 -0700 (Sun, 23 Oct 2005)
New Revision: 10280

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
Log:
* Grab rate messages, to allow future implementation of variable play rates
* Override flush messages to clear out the demux and packetiser state

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-23 17:40:31 UTC (rev 10279)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-23 18:58:24 UTC (rev 10280)
@@ -56,6 +56,7 @@
 	,	mSetupState(VSS_SEEN_NOTHING)
 	,	mDecodedBuffer(NULL)
 	,	mDecodedByteCount(0)
+	,	mRateNumerator(RATE_DENOMINATOR)
 		
 {
 	//debugLog.open("g:\\logs\\vorbislog.log", ios_base::out);
@@ -111,10 +112,23 @@
 	CAutoLock locLock(mStreamLock);
 	//debugLog<<"New segment "<<inStartTime<<" - "<<inStopTime<<endl;
 	mUptoFrame = 0;
+	mRateNumerator = RATE_DENOMINATOR * inRate;
+	if (mRateNumerator > RATE_DENOMINATOR) {
+		mRateNumerator = RATE_DENOMINATOR;
+	}
 	return AbstractTransformInputPin::NewSegment(inStartTime, inStopTime, inRate);
 	
 }
 
+STDMETHODIMP VorbisDecodeInputPin::EndFlush()
+{
+	CAutoLock locLock(m_pLock);
+	
+	HRESULT locHR = AbstractTransformInputPin::EndFlush();
+	mDecodedByteCount = 0;
+	return locHR;
+}
+
 int __cdecl VorbisDecodeInputPin::VorbisDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer) 
 {
 	
@@ -371,7 +385,10 @@
 
 					//Write the sample meta data
 					//TODO:: Seeking offset
-					locSample->SetTime(&locStart, &locEnd);
+
+					REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
+					REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
+					locSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
 					locSample->SetMediaTime(&locStart, &locEnd);
 					locSample->SetSyncPoint(TRUE);
 					locSample->SetActualDataLength(locBytesToCopy);

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-10-23 17:40:31 UTC (rev 10279)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-10-23 18:58:24 UTC (rev 10280)
@@ -65,8 +65,8 @@
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
 	virtual HRESULT CheckMediaType(const CMediaType *inMediaType);
 	virtual STDMETHODIMP NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
+	virtual STDMETHODIMP EndFlush();
 
-
 	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
 
 	//Overriden from AbstractTransform input pin
@@ -118,5 +118,8 @@
 	unsigned char* mDecodedBuffer;
 	unsigned long mDecodedByteCount;
 
+	__int64 mRateNumerator;
+	static const __int64 RATE_DENOMINATOR = 65536;
+
 };
 

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-10-23 17:40:31 UTC (rev 10279)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-10-23 18:58:24 UTC (rev 10280)
@@ -309,5 +309,6 @@
 HRESULT OggDemuxPacketSourcePin::DeliverBeginFlush(void)
 {
 	mDataQueue->BeginFlush();
+	mPacketiser.reset();
     return S_OK;
 }
\ No newline at end of file



More information about the commits mailing list