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

illiminable at svn.xiph.org illiminable at svn.xiph.org
Fri Nov 18 09:14:44 PST 2005


Author: illiminable
Date: 2005-11-18 09:14:28 -0800 (Fri, 18 Nov 2005)
New Revision: 10403

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/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
Log:
* Crude stream offset handling. Only tested for 1 stream.

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-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-11-18 17:14:28 UTC (rev 10403)
@@ -57,6 +57,8 @@
 	,	mDecodedBuffer(NULL)
 	,	mDecodedByteCount(0)
 	,	mRateNumerator(RATE_DENOMINATOR)
+	,	mOggOutputPinInterface(NULL)
+	,	mSentStreamOffset(false)
 		
 {
 	//debugLog.open("g:\\logs\\vorbislog.log", ios_base::out);
@@ -218,6 +220,18 @@
 				unsigned long locBytesToCopy = 0;
 
 				locStart = convertGranuleToTime(locEnd) - (((mDecodedByteCount / mFrameSize) * UNITS) / mSampleRate);
+
+				REFERENCE_TIME locGlobalOffset = 0;
+				//Handle stream offsetting
+				if (!mSentStreamOffset && (mOggOutputPinInterface != NULL)) {
+					mOggOutputPinInterface->notifyStreamBaseTime(locStart);
+					mSentStreamOffset = true;
+					
+				}
+
+				if (mOggOutputPinInterface != NULL) {
+					locGlobalOffset = mOggOutputPinInterface->getGlobalBaseTime();
+				}
 				do {
 					HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, NULL, NULL, NULL);
 					if (locHR != S_OK) {
@@ -240,8 +254,8 @@
 					//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;
+					locAdjustedStart -= (m_tStart + locGlobalOffset);
+					locAdjustedEnd -= (m_tStart + locGlobalOffset);
 
 					__int64 locSeekStripOffset = 0;
 					if (locAdjustedEnd < 0) {
@@ -419,4 +433,19 @@
 {
 	//TODO:::
 	return "vorbis";
+}
+
+HRESULT VorbisDecodeInputPin::CompleteConnect(IPin *inReceivePin)
+{
+	IOggOutputPin* locOggOutput = NULL;
+	mSentStreamOffset = false;
+	HRESULT locHR = inReceivePin->QueryInterface(IID_IOggOutputPin, (void**)&locOggOutput);
+	if (locHR == S_OK) {
+		mOggOutputPinInterface = locOggOutput;
+		
+	} else {
+		mOggOutputPinInterface = NULL;
+	}
+	return AbstractTransformInputPin::CompleteConnect(inReceivePin);
+	
 }
\ No newline at end of file

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-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-11-18 17:14:28 UTC (rev 10403)
@@ -38,6 +38,7 @@
 
 
 #include "IOggDecoder.h"
+#include "IOggOutputPin.h"
 #include "AbstractTransformInputPin.h"
 #include "VorbisDecodeInputPin.h"
 
@@ -68,6 +69,7 @@
 	virtual STDMETHODIMP EndFlush();
 
 	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
+	virtual HRESULT CompleteConnect(IPin *inReceivePin);
 
 	//Overriden from AbstractTransform input pin
 	virtual STDMETHODIMP Receive(IMediaSample* inSample);
@@ -122,5 +124,8 @@
 	__int64 mRateNumerator;
 	static const __int64 RATE_DENOMINATOR = 65536;
 
+	IOggOutputPin* mOggOutputPinInterface;
+	bool mSentStreamOffset;
+
 };
 

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h	2005-11-18 17:14:28 UTC (rev 10403)
@@ -83,6 +83,11 @@
 DEFINE_GUID(IID_IOggDecoder, 
 0x43f0f818, 0x10b0, 0x4c86, 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62);
 
+
+// {83D7F506-53ED-4f15-B6D8-7D8E9E72A918}
+DEFINE_GUID(IID_IOggOutputPin, 
+0x83d7f506, 0x53ed, 0x4f15, 0xb6, 0xd8, 0x7d, 0x8e, 0x9e, 0x72, 0xa9, 0x18);
+
 const REGPINTYPES VorbisDecodeOutputTypes = {
     &MEDIATYPE_Audio,
 	&MEDIASUBTYPE_PCM

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-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-11-18 17:14:28 UTC (rev 10403)
@@ -104,6 +104,7 @@
 	,	mPendingPage(NULL)
 	,	mJustReset(true)
 	,	mSeekTable(NULL)
+	,	mGlobalBaseTime(0)
 {
 	//Why do we do this, should the base class do it ?
 	m_pLock = new CCritSec;
@@ -266,6 +267,7 @@
 		mBufferedPages.push_back(inOggPage);
 		return true;
 	} else {
+		//OGGCHAIN::: Here, need to check for an eos, and reset stream, else do it in strmapper
 		return mStreamMapper->acceptOggPage(inOggPage);
 	}
 }
@@ -707,3 +709,18 @@
 
 }
 
+
+//HHHH:::
+bool OggDemuxPacketSourceFilter::notifyStreamBaseTime(__int64 inStreamBaseTime)
+{
+	if (inStreamBaseTime > mGlobalBaseTime) {
+		mGlobalBaseTime = inStreamBaseTime;
+	}
+	return true;
+}
+__int64 OggDemuxPacketSourceFilter::getGlobalBaseTime()
+{
+	return mGlobalBaseTime;
+}
+
+

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-11-18 17:14:28 UTC (rev 10403)
@@ -112,6 +112,11 @@
 	CCritSec* streamLock()			{		return mStreamLock;		}
 
 	virtual void notifyPinConnected();
+
+	//HHHH:::
+	virtual bool notifyStreamBaseTime(__int64 inStreamBaseTime);
+	virtual __int64 getGlobalBaseTime();
+	//
 protected:
 	static const unsigned long SETUP_BUFFER_SIZE = 24;
 	virtual HRESULT SetUpPins();
@@ -144,5 +149,8 @@
 
 	bool mJustReset;
 
+	//HHHH:::
+	__int64 mGlobalBaseTime;
+
 	//double mPlaybackRate;
 };

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-11-18 17:14:28 UTC (rev 10403)
@@ -69,6 +69,10 @@
 		*ppv = (IMediaSeeking*)this;
 		((IUnknown*)*ppv)->AddRef();
 		return NOERROR;
+	} else if (riid == IID_IOggOutputPin) {
+		*ppv = (IOggOutputPin*)this;
+		//((IUnknown*)*ppv)->AddRef();
+		return NOERROR;		
 	}
 
 	return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); 
@@ -341,4 +345,13 @@
 	mDataQueue->BeginFlush();
 	
     return S_OK;
-}
\ No newline at end of file
+}
+
+bool OggDemuxPacketSourcePin::notifyStreamBaseTime(__int64 inStreamTime)
+{
+	return ((OggDemuxPacketSourceFilter*)m_pFilter)->notifyStreamBaseTime(inStreamTime);
+}
+__int64 OggDemuxPacketSourcePin::getGlobalBaseTime()
+{
+	return ((OggDemuxPacketSourceFilter*)m_pFilter)->getGlobalBaseTime();
+}

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h	2005-11-18 17:14:28 UTC (rev 10403)
@@ -34,10 +34,13 @@
 #include <libOOOgg/IOggCallback.h>
 #include <libOOOgg/OggPacketiser.h>
 #include "IOggDecoder.h"
+#include "IOggOutputPin.h"
+
 class OggDemuxPacketSourcePin
 	:	public CBaseOutputPin
 	,	public BasicSeekPassThrough
 	,	public IOggCallback
+	,	public IOggOutputPin
 	,	protected IStampedOggPacketSink
 {
 public:
@@ -83,6 +86,10 @@
 	virtual HRESULT DeliverEndOfStream(void);
 	virtual HRESULT DeliverEndFlush(void);
 	virtual HRESULT DeliverBeginFlush(void);
+
+	//IOggOutputPin interface
+	virtual bool notifyStreamBaseTime(__int64 inStreamTime);
+	virtual __int64 getGlobalBaseTime();
 protected:
 	//IStampedOggPacketSink
 	virtual bool acceptStampedOggPacket(StampedOggPacket* inPacket);

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h	2005-11-18 17:14:28 UTC (rev 10403)
@@ -31,6 +31,12 @@
 0x43f0f818, 0x10b0, 0x4c86, 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62);
 
 
+// {83D7F506-53ED-4f15-B6D8-7D8E9E72A918}
+DEFINE_GUID(IID_IOggOutputPin, 
+0x83d7f506, 0x53ed, 0x4f15, 0xb6, 0xd8, 0x7d, 0x8e, 0x9e, 0x72, 0xa9, 0x18);
+
+
+
 //// {3913F0AB-E7ED-41c4-979B-1D1FDD983C07}
 //DEFINE_GUID(MEDIASUBTYPE_FLAC, 
 //0x3913f0ab, 0xe7ed, 0x41c4, 0x97, 0x9b, 0x1d, 0x1f, 0xdd, 0x98, 0x3c, 0x7);

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2005-11-18 12:29:12 UTC (rev 10402)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2005-11-18 17:14:28 UTC (rev 10403)
@@ -197,6 +197,9 @@
 				RelativePath=".\IOggDecoder.h">
 			</File>
 			<File
+				RelativePath=".\IOggOutputPin.h">
+			</File>
+			<File
 				RelativePath=".\OggDemuxPacketSourceFilter.h">
 			</File>
 			<File



More information about the commits mailing list