[xiph-commits] r10263 - 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 03:15:00 PDT 2005


Author: illiminable
Date: 2005-10-23 03:14:46 -0700 (Sun, 23 Oct 2005)
New Revision: 10263

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/IOggDecoder.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/OggStreamMapper.cpp
Log:
* Get the IOggDecoder interface during pin conenction, and force through headers until the codec says stop.
* Change IOggDecoder to present packets, not pages.
* IOggDecoder only shows the packet to the codec, the codec does not own the pointer.
* Take the header negotiation out of streammapper and put it in the output pins completeconenct

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 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-23 10:14:46 UTC (rev 10263)
@@ -262,4 +262,5 @@
 	outRequestedProps->cbPrefix = 0;
 
 	return S_OK;
-}
\ 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-10-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-10-23 10:14:46 UTC (rev 10263)
@@ -64,6 +64,7 @@
 
 	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
 
+
 protected:
 	//fstream debugLog;
 

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggDecoder.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggDecoder.h	2005-10-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/IOggDecoder.h	2005-10-23 10:14:46 UTC (rev 10263)
@@ -11,7 +11,7 @@
 
 	};
 	virtual LOOG_INT64 convertGranuleToTime(LOOG_INT64 inGranule) = 0;
-	virtual eAcceptHeaderResult acceptHeaderPage(OggPage* inOggHeaderPage) = 0;
+	virtual eAcceptHeaderResult showHeaderPacket(OggPacket* inCodecHeaderPacket) = 0;
 	virtual string getCodecShortName() = 0;
 	virtual string getCodecIdentString() = 0;
 	

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-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-10-23 10:14:46 UTC (rev 10263)
@@ -246,24 +246,31 @@
 	return S_OK;
 
 
+}
 
+vector<OggPage*> OggDemuxPacketSourceFilter::getMatchingBufferedPages(unsigned long inSerialNo)
+{
+	vector<OggPage*> locList;
+	for (size_t i = 0; i < mBufferedPages.size(); i++) {
+		if (mBufferedPages[i]->header()->StreamSerialNo() == inSerialNo) {
+			locList.push_back(mBufferedPages[i]);
+		}
+	}
+	return locList;
+}
+void OggDemuxPacketSourceFilter::removeMatchingBufferedPages(unsigned long inSerialNo)
+{
+	int locSize = mBufferedPages.size();
+	for (vector<OggPage*>::iterator i = mBufferedPages.end(); i != mBufferedPages.begin(); i--) {
+		if ((*i)->header()->StreamSerialNo() == inSerialNo) {
+			mBufferedPages.erase(i); //.erase(i);
+		}
+	}
 
+}
 
 
 
-
-
-
-
-
-
-
-
-
-
-	//TODO:::
-	return S_OK;
-}
 int OggDemuxPacketSourceFilter::GetPinCount() 
 {
 	//TODO::: Implement

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-10-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-10-23 10:14:46 UTC (rev 10263)
@@ -100,6 +100,9 @@
 	virtual STDMETHODIMP GetPreroll(LONGLONG *pllPreroll);
 	virtual STDMETHODIMP IsUsingTimeFormat(const GUID *pFormat);
 
+	vector<OggPage*> getMatchingBufferedPages(unsigned long inSerialNo);
+	void removeMatchingBufferedPages(unsigned long inSerialNo);
+
 protected:
 	static const unsigned long SETUP_BUFFER_SIZE = 24;
 	virtual HRESULT SetUpPins();

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 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-10-23 10:14:46 UTC (rev 10263)
@@ -150,3 +150,56 @@
 	return locHR;
 
 }
+
+
+//Pin Conenction Methods
+HRESULT OggDemuxPacketSourcePin::BreakConnect()
+{
+	return CBaseOutputPin::BreakConnect();
+}
+HRESULT OggDemuxPacketSourcePin::CompleteConnect(IPin *inReceivePin)
+{
+	IOggDecoder* locDecoder = NULL;
+	inReceivePin->QueryInterface(IID_IOggDecoder, (void**)&locDecoder);
+	if (locDecoder != NULL) {
+		mDecoderInterface = locDecoder;
+
+		IOggDecoder::eAcceptHeaderResult locResult = mDecoderInterface->showHeaderPacket(mIdentHeader->clone());
+		if (locResult == IOggDecoder::AHR_ALL_HEADERS_RECEIVED) {
+			mIsStreamReady = true;
+		} else {
+			OggPacketiser locPacketiser;
+			locPacketiser.setPacketSink(this);
+			OggDemuxPacketSourceFilter* locParent = (OggDemuxPacketSourceFilter*)m_pFilter;
+			vector<OggPage*> locList = locParent->getMatchingBufferedPages(mSerialNo);
+			
+			for (size_t i = 0; i < locList.size(); i++) {
+				locPacketiser.acceptOggPage(locList[i]);
+			}
+
+			locParent->removeMatchingBufferedPages(mSerialNo);
+
+			if (mIsStreamReady) {
+				return CBaseOutputPin::CompleteConnect(inReceivePin);
+			}	
+		}
+
+		
+	}
+	return E_FAIL;
+	
+}
+
+bool OggDemuxPacketSourcePin::acceptStampedOggPacket(StampedOggPacket* inPacket)
+{
+	//This handles callbacks with header packets
+	IOggDecoder::eAcceptHeaderResult locResult;
+	if ((mDecoderInterface != NULL) && (!mIsStreamReady)) {
+		locResult = mDecoderInterface->showHeaderPacket(inPacket);
+		if (locResult == IOggDecoder::AHR_ALL_HEADERS_RECEIVED) {
+			mIsStreamReady = true;
+		}
+	}
+	delete inPacket;
+	return true;
+}
\ No newline at end of file

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h	2005-10-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h	2005-10-23 10:14:46 UTC (rev 10263)
@@ -32,10 +32,12 @@
 
 #include <libOOOgg/OggPacket.h>
 #include <libOOOgg/IOggCallback.h>
+#include <libOOOgg/OggPacketiser.h>
 #include "IOggDecoder.h"
 class OggDemuxPacketSourcePin
 	:	public CBaseOutputPin
 	,	public IOggCallback
+	,	protected IStampedOggPacketSink
 {
 public:
 	//OggDemuxPacketSourcePin(void);
@@ -50,7 +52,7 @@
 							//bool inAllowSeek,
 							//unsigned long inNumBuffers,
 							//unsigned long inBufferSize);
-	~OggDemuxPacketSourcePin(void);
+	virtual ~OggDemuxPacketSourcePin(void);
 
 	static const unsigned long NUM_PAGE_BUFFERS = 100;
 
@@ -62,11 +64,19 @@
 	//IOggCallback Interface
 	virtual bool acceptOggPage(OggPage* inOggPage);
 
+
 	//CBasePin virtuals
 	virtual HRESULT GetMediaType(int inPosition, CMediaType* outMediaType);
 	virtual HRESULT CheckMediaType(const CMediaType* inMediaType);
 	virtual HRESULT DecideBufferSize(IMemAllocator* inoutAllocator, ALLOCATOR_PROPERTIES* inoutInputRequest);
+
+	//Pin Conenction Methods
+	virtual HRESULT BreakConnect();
+	virtual HRESULT CompleteConnect(IPin *inReceivePin);
 protected:
+	//IStampedOggPacketSink
+	virtual bool acceptStampedOggPacket(StampedOggPacket* inPacket);
+
 	//What is this actually for ?
 	HRESULT mFilterHR;
 

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp	2005-10-23 08:53:45 UTC (rev 10262)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp	2005-10-23 10:14:46 UTC (rev 10263)
@@ -38,42 +38,7 @@
 			if (inOggPage->header()->isBOS()) {
 				return addNewPin(inOggPage);
 			} else {
-				mStreamState = STRMAP_PARSING_HEADERS;
-			}
-			//Partial fall through
-		case STRMAP_PARSING_HEADERS:
-			if (!allStreamsReady()) {
-				OggDemuxPacketSourcePin* locPin = getMatchingPin(inOggPage->header()->StreamSerialNo());
-				//TODO::: NULL pointer check
-				IOggDecoder* locDecoder = locPin->getDecoderInterface();
-				if (locDecoder == NULL) {
-					mStreamState = STRMAP_ERROR;
-					delete inOggPage;
-				} else {
-					IOggDecoder::eAcceptHeaderResult locResult = locDecoder->acceptHeaderPage(inOggPage);
-					switch (locResult) {
-						case IOggDecoder::eAcceptHeaderResult::AHR_ALL_HEADERS_RECEIVED:
-							locPin->setIsStreamReady(true);
-							return true;
-						case IOggDecoder::eAcceptHeaderResult::AHR_INVALID_HEADER:
-							mStreamState = STRMAP_ERROR;
-							return false;
-						case IOggDecoder::eAcceptHeaderResult::AHR_MORE_HEADERS_TO_COME:
-							return true;
-						case IOggDecoder::eAcceptHeaderResult::AHR_NULL_POINTER:
-							mStreamState = STRMAP_ERROR;
-							return false;
-						case IOggDecoder::eAcceptHeaderResult::AHR_UNEXPECTED:
-							mStreamState = STRMAP_ERROR;
-							return false;
-						default:
-							return false;
-						
-					}
-				}
-			} else {
 				mStreamState = STRMAP_DATA;
-
 			}
 			//Partial fall through
 		case STRMAP_DATA:



More information about the commits mailing list