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

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Nov 19 00:36:54 PST 2005


Author: illiminable
Date: 2005-11-19 00:36:40 -0800 (Sat, 19 Nov 2005)
New Revision: 10405

Added:
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggOutputPin.h
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/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h
   branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
Log:
* Crude stream offsetting for theora

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-18 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2005-11-19 08:36:40 UTC (rev 10405)
@@ -394,6 +394,20 @@
 			REFERENCE_TIME locGlobalStart = locGlobalEnd - (locNumBufferedFrames * mFrameDuration);
 
 			locStart = locGlobalStart;
+
+
+			//Offsetting
+			REFERENCE_TIME locGlobalOffset = 0;
+			//Handle stream offsetting
+			if (!locInputPin->getSentStreamOffset() && (locInputPin->getOutputPinInterface() != NULL)) {
+				locInputPin->getOutputPinInterface()->notifyStreamBaseTime(locStart);
+				locInputPin->setSentStreamOffset(true);
+				
+			}
+
+			if (locInputPin->getOutputPinInterface() != NULL) {
+				locGlobalOffset = locInputPin->getOutputPinInterface()->getGlobalBaseTime();
+			}
 			
 			debugLog<<"Theora::Receive - "<<locNumBufferedFrames<<" frames buffered"<<endl;
 			for (unsigned long i = 0; i < locNumBufferedFrames; i++) {
@@ -401,8 +415,8 @@
 				bool locIsKeyFrame = mTheoraDecoder->isKeyFrame(mBufferedPackets[i]);
 				yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(mBufferedPackets[i]);		//This accept the packet and deletes it
 				locEnd = locStart + mFrameDuration;
-				REFERENCE_TIME locAdjustedStart = locStart - mSegStart;
-				REFERENCE_TIME locAdjustedEnd = locEnd - mSegStart;
+				REFERENCE_TIME locAdjustedStart = locStart - mSegStart - locGlobalOffset;
+				REFERENCE_TIME locAdjustedEnd = locEnd - mSegStart - locGlobalOffset;
 
 				if (locAdjustedStart < 0) {
 					locAdjustedStart = 0;

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-18 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2005-11-19 08:36:40 UTC (rev 10405)
@@ -36,6 +36,8 @@
 TheoraDecodeInputPin::TheoraDecodeInputPin(CTransformFilter* inParentFilter, HRESULT* outHR) 
 	:	CTransformInputPin(NAME("Theora Input Pin"), inParentFilter, outHR, L"Theora In")
 	,	mSetupState(VSS_SEEN_NOTHING)
+	,	mOggOutputPinInterface(NULL)
+	,	mSentStreamOffset(false)
 {
 	//debugLog.open("G:\\logs\\theoinput.log", ios_base::out);
 }
@@ -86,6 +88,19 @@
 }
 HRESULT TheoraDecodeInputPin::CompleteConnect (IPin *inReceivePin) {
 	CAutoLock locLock(m_pLock);
+
+	//Offsets
+	IOggOutputPin* locOggOutput = NULL;
+	mSentStreamOffset = false;
+	HRESULT locHR = inReceivePin->QueryInterface(IID_IOggOutputPin, (void**)&locOggOutput);
+	if (locHR == S_OK) {
+		mOggOutputPinInterface = locOggOutput;
+		
+	} else {
+		mOggOutputPinInterface = NULL;
+	}
+
+
 	//debugLog<<"Complete conenct"<<endl;
 	IMediaSeeking* locSeeker = NULL;
 	inReceivePin->QueryInterface(IID_IMediaSeeking, (void**)&locSeeker);

Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2005-11-18 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2005-11-19 08:36:40 UTC (rev 10405)
@@ -31,6 +31,7 @@
 
 #pragma once
 #include "IOggDecoder.h"
+#include "IOggOutputPin.h"
 #include "Theoradecoderdllstuff.h"
 #include "BasicSeekPassThrough.h"
 
@@ -69,6 +70,9 @@
 	virtual string getCodecIdentString();
 	//fstream debugLog;
 
+	virtual IOggOutputPin* getOutputPinInterface()		{		return mOggOutputPinInterface;	}
+	virtual bool getSentStreamOffset()					{		return mSentStreamOffset;		}
+	virtual void setSentStreamOffset(bool inSentStreamOffset)	{	mSentStreamOffset = inSentStreamOffset;	}
 protected:
 	static const unsigned long THEORA_NUM_BUFFERS = 50;
 	enum eTheoraSetupState {
@@ -80,4 +84,8 @@
 	};
 
 	eTheoraSetupState mSetupState;
+
+
+	IOggOutputPin* mOggOutputPinInterface;
+	bool mSentStreamOffset;
 };

Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h	2005-11-18 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h	2005-11-19 08:36:40 UTC (rev 10405)
@@ -73,6 +73,10 @@
 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 TheoraDecodeOutputTypes = {
     &MEDIATYPE_Video,
 	&MEDIASUBTYPE_YV12

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 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-11-19 08:36:40 UTC (rev 10405)
@@ -232,6 +232,7 @@
 				if (mOggOutputPinInterface != NULL) {
 					locGlobalOffset = mOggOutputPinInterface->getGlobalBaseTime();
 				}
+
 				do {
 					HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, NULL, NULL, NULL);
 					if (locHR != S_OK) {

Added: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggOutputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggOutputPin.h	2005-11-18 19:35:03 UTC (rev 10404)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggOutputPin.h	2005-11-19 08:36:40 UTC (rev 10405)
@@ -0,0 +1,8 @@
+
+#pragma once
+class IOggOutputPin {
+public:
+	virtual bool notifyStreamBaseTime(__int64 inStreamTime) = 0;
+	virtual __int64 getGlobalBaseTime() = 0;
+
+};
\ No newline at end of file



More information about the commits mailing list