[xiph-commits] r7915 - in trunk/oggdsf/src/lib: codecs/theora/filters/dsfTheoraEncoder codecs/vorbis/filters/dsfVorbisDecoder core/directshow/dsfAbstractAudioDecoder core/directshow/dsfOggDemux

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Oct 5 05:12:41 PDT 2004


Author: illiminable
Date: 2004-10-05 05:12:40 -0700 (Tue, 05 Oct 2004)
New Revision: 7915

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamFactory.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp
Log:
* Added support for certain types of chained files over the network. (Most vorbis only icecast streams)

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -766,7 +766,7 @@
 
 	//debugLog<<"EncodeRGB32 To YV12 : debugCount = "<<debugCount<<endl;
 
-	ASSERT(debugCount == locNumPixels);
+	//ASSERT(debugCount == locNumPixels);
 	
 	ASSERT(locDestPtr == (locAYUVBuf + inNumBytes));
 

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -40,7 +40,7 @@
 	,	mFishSound(NULL)
 		
 {
-	//debugLog.open("C:\\vorbislog.log", ios_base::out);
+	debugLog.open("g:\\logs\\vorbislog.log", ios_base::out);
 	ConstructCodec();
 }
 
@@ -71,7 +71,7 @@
 }
 VorbisDecodeInputPin::~VorbisDecodeInputPin(void)
 {
-	//debugLog.close();
+	debugLog.close();
 	DestroyCodec();
 }
 
@@ -110,8 +110,22 @@
 		
 		//REFERENCE_TIME locFrameStart = locThis->CurrentStartTime() + (((__int64)(locThis->mUptoFrame * UNITS)) / locThis->mSampleRate);
 
+
+		//New hacks for chaining.
+		if (locThis->mSeekTimeBase == -1) {
+			locThis->debugLog<<"Chaining was detected... setting chain time base to : "<<locThis->mPreviousEndTime<<endl;
+			//This is our signal this is the start of a chain...
+			// This can only happen on non-seekable streams.
+			locThis->mChainTimeBase = locThis->mPreviousEndTime;
+			
+			locThis->mSeekTimeBase = 0;
+		}
+
 		//Start time hacks
-		REFERENCE_TIME locTimeBase = ((locThis->mLastSeenStartGranPos * UNITS) / locThis->mSampleRate) - locThis->mSeekTimeBase;
+		REFERENCE_TIME locTimeBase = ((locThis->mLastSeenStartGranPos * UNITS) / locThis->mSampleRate) - locThis->mSeekTimeBase + locThis->mChainTimeBase;
+	
+		
+		
 		//locThis->aadDebug<<"Last Seen  : " <<locThis->mLastSeenStartGranPos<<endl;
 		//locThis->debugLog<<"Last Seen  : " << locThis->mLastSeenStartGranPos<<endl;
 		//locThis->debugLog<<"Time Base  : " << locTimeBase << endl;
@@ -126,8 +140,10 @@
 
 		//REFERENCE_TIME locFrameEnd = locThis->CurrentStartTime() + (((__int64)(locThis->mUptoFrame * UNITS)) / locThis->mSampleRate);
 		REFERENCE_TIME locFrameEnd = locTimeBase + (((__int64)(locThis->mUptoFrame * UNITS)) / locThis->mSampleRate);
+		locThis->mPreviousEndTime = locFrameEnd;
 
 
+
 		//locThis->debugLog<<"Start      : "<<locFrameStart<<endl;
 		//locThis->debugLog<<"End        : "<<locFrameEnd<<endl;
 		//locThis->debugLog<<"=================================================="<<endl;

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2004-10-05 12:12:40 UTC (rev 7915)
@@ -97,7 +97,7 @@
 	//VorbisDecodeOutputPin* mOutputPin;
 	//__int64 mUptoFrame;
 
-	//fstream debugLog;
+	fstream debugLog;
 
 	FishSound* mFishSound;
 	FishSoundInfo mFishInfo; 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -45,6 +45,7 @@
 	,	mFilterLock(inFilterLock)
 	,	mLastSeenStartGranPos(0)
 	,	mSeekTimeBase(0)
+	,	mChainTimeBase(0)
 {
 	//ConstructCodec();
 	//debugLog.open("g:\\logs\\aad.log", ios_base::out);

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.h	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.h	2004-10-05 12:12:40 UTC (rev 7915)
@@ -83,6 +83,11 @@
 	virtual STDMETHODIMP EndFlush();
 	virtual STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
 
+
+	//These really shouldn't be public !!
+	//Chaining hackery
+	REFERENCE_TIME mChainTimeBase;
+	REFERENCE_TIME mPreviousEndTime;
 protected:
 
 	virtual bool SetSampleParams(IMediaSample* outMediaSample, unsigned long inDataSize, REFERENCE_TIME* inStartTime, REFERENCE_TIME* inEndTime);
@@ -107,4 +112,6 @@
 	REFERENCE_TIME mSeekTimeBase;
 
 
+
+
 };

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -658,7 +658,6 @@
 		if (locNumRead > 0) {
 			mOggBuffer.feed((const unsigned char*)locBuff, locNumRead);
 		}
-
 	}
 	
 	mStreamMapper->setAllowDispatch(true);

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -86,6 +86,13 @@
 }
 bool OggDemuxSourcePin::deliverOggPacket(StampedOggPacket* inPacket) {
 	CAutoLock locStreamLock(mParentFilter->mStreamLock);
+
+	//Hack to try and suport chaining (only for non-seekables)
+	
+	//
+
+
+
 	IMediaSample* locSample = NULL;
 	REFERENCE_TIME locStart = inPacket->startTime();
 	REFERENCE_TIME locStop = inPacket->endTime();

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -51,7 +51,7 @@
 	//Need to do something here !
 	mSerialNo = inBOSPage->header()->StreamSerialNo();
 	string locLogName = "G:\\logs\\oggstream" + StringHelper::numToString(mSerialNo) + ".log";
-	//debugLog.open(locLogName.c_str(), ios_base::out);
+	debugLog.open(locLogName.c_str(), ios_base::out);
 	mStreamLock = new CCritSec;
 	//This may need to be moved to derived class
 	//Yep, Sure did !
@@ -65,7 +65,7 @@
 OggStream::~OggStream(void)
 {
 	//debugLog<<"Destructor..."<<endl;
-	//debugLog.close();
+	debugLog.close();
 	delete mSourcePin;
 	delete mCodecHeaders;
 	//delete mPartialPacket;
@@ -214,6 +214,17 @@
 	mLastEndGranulePos = inGranPos;
 }
 bool OggStream::acceptOggPage(OggPage* inOggPage) {
+	
+	//Chaining hack for icecast.
+	if ( (!mAllowSeek) && (inOggPage->header()->isBOS() )) {
+		//A BOS page can only be sent here if it's a chain... otherwise
+		// it would have already been stripped by the demux if it was at the
+		// start of the file.
+		debugLog<<"Detected chain... setting seek timebase to -1"<<endl;
+		mOwningFilter->mSeekTimeBase = -1;		
+
+	}
+
 	//FIX::: Add proper error checking.
 
 	//debugLog<<"acceptOggPage : "<<endl<<inOggPage->header()->toString()<<endl<<endl;;
@@ -247,3 +258,7 @@
 	return mSourcePin->deliverOggPacket(inPacket);
 }
 
+void OggStream::setSerialNo(unsigned long inSerialNo) {
+	mSerialNo = inSerialNo;
+}
+

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.h	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStream.h	2004-10-05 12:12:40 UTC (rev 7915)
@@ -57,6 +57,7 @@
 	//more hacks
 	virtual void setLastEndGranPos(__int64 inGranPos);
 	unsigned long serialNo();
+	void setSerialNo(unsigned long inSerialNo);
 	//virtual bool IdentifyCodec(OggPacket* inOggPacket) = 0;
 	virtual bool InitCodec(StampedOggPacket* inOggPacket) = 0;
 	virtual BYTE* getFormatBlock() = 0;
@@ -117,5 +118,5 @@
 	OggDemuxSourceFilter* mOwningFilter;
 	CCritSec* mStreamLock;
 
-	//fstream debugLog;
+	fstream debugLog;
 };

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamFactory.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamFactory.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamFactory.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -54,7 +54,6 @@
 			return new TheoraStream(inOggPage, inOwningFilter, inAllowSeek);
 		case StreamHeaders::FFDSHOW_VIDEO:
 			return new FFDShowVideoStream(inOggPage, inOwningFilter, inAllowSeek);
-		
 		case StreamHeaders::NONE:
 		default:
 			return NULL;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp	2004-10-05 06:38:21 UTC (rev 7914)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp	2004-10-05 12:12:40 UTC (rev 7915)
@@ -68,6 +68,16 @@
 			
 		}
 	}
+
+	//We only get here if the serial number wasn't in a header... this means either
+	// a) It's a chain, and we are going to hack around it
+	// b) The file is invalid.
+
+	//Only attempt a chain for a single stream (probably vorbis only)
+	if (mStreamList.size() == 1) {
+		mStreamList[0]->setSerialNo(inOggPage->header()->StreamSerialNo());
+		return mStreamList[0]->acceptOggPage(inOggPage);
+	}
 	//return false;
 	return true;
 }
@@ -87,9 +97,16 @@
 		bool locAllowSeekThrough = false;
 
 		//We only want one of the pins to delegate their seek to us.
-		if (mStreamList.size() == 0) {
-			locAllowSeekThrough = true;
-		}
+		//if (mStreamList.size() == 0) {
+		//	locAllowSeekThrough = true;
+		//}
+
+		locAllowSeekThrough = true;
+		//Above code is changed... due to WMP9 and 10 's non-adherence to directshows standard... it
+		// requires all streams to be seekable, in contradiction to directshow which specifies that
+		// only 1 or more is required.
+
+
 			
 		//If the page is a BOS we need to start a new stream
 		OggStream* locStream = OggStreamFactory::CreateStream(inOggPage, mOwningFilter, locAllowSeekThrough);



More information about the commits mailing list