[xiph-commits] r10250 - branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Oct 22 09:13:56 PDT 2005


Author: illiminable
Date: 2005-10-22 09:13:49 -0700 (Sat, 22 Oct 2005)
New Revision: 10250

Modified:
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h
Log:
* Implement the data flow path

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp	2005-10-22 15:50:41 UTC (rev 10249)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp	2005-10-22 16:13:49 UTC (rev 10250)
@@ -41,6 +41,7 @@
 							,	&mFilterHR
 							,	L"Ogg Stream" )
 	,	mBOSPage(inBOSPage)
+	,	mIsStreamReady(false)
 {
 
 	mBOSAsFormatBlock = (BYTE*)inBOSPage->createRawPageData();
@@ -53,6 +54,11 @@
 	delete mBOSPage;
 }
 
+bool OggDemuxPageSourcePin::acceptOggPage(OggPage* inOggPage)
+{
+	//TODO:::
+	return true;
+}
 BYTE* OggDemuxPageSourcePin::getBOSAsFormatBlock()
 {
 	return mBOSAsFormatBlock;

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h	2005-10-22 15:50:41 UTC (rev 10249)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h	2005-10-22 16:13:49 UTC (rev 10250)
@@ -31,9 +31,11 @@
 #pragma once
 
 #include <libOOOgg/OggPage.h>
+#include <libOOOgg/IOggCallback.h>
 #include "IOggDecoder.h"
 class OggDemuxPageSourcePin
 	:	public CBaseOutputPin
+	,	public IOggCallback
 {
 public:
 	//OggDemuxPageSourcePin(void);
@@ -53,6 +55,12 @@
 
 	unsigned long getSerialNo();
 	IOggDecoder* getDecoderInterface();
+	bool isStreamReady()							{		return mIsStreamReady;				}
+	void setIsStreamReady(bool inIsStreamReady)		{		mIsStreamReady = inIsStreamReady;	}
+
+	//IOggCallback Interface
+	virtual bool acceptOggPage(OggPage* inOggPage);
+
 	//CBasePin virtuals
 	virtual HRESULT GetMediaType(int inPosition, CMediaType* outMediaType);
 	virtual HRESULT CheckMediaType(const CMediaType* inMediaType);
@@ -65,4 +73,6 @@
 	BYTE* mBOSAsFormatBlock;
 	OggPage* mBOSPage;
 	IOggDecoder* mDecoderInterface;
+
+	bool mIsStreamReady;
 };

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-22 15:50:41 UTC (rev 10249)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp	2005-10-22 16:13:49 UTC (rev 10250)
@@ -14,7 +14,7 @@
 
 bool OggStreamMapper::acceptOggPage(OggPage* inOggPage)
 {
-
+	
 	switch (mStreamState) {
 		case STRMAP_READY:
 			//WARNING::: Partial fall through
@@ -35,18 +35,81 @@
 			}
 			//Partial fall through
 		case STRMAP_PARSING_HEADERS:
+			if (!allStreamsReady()) {
+				OggDemuxPageSourcePin* 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:
+			{
+				OggDemuxPageSourcePin* locPin = getMatchingPin(inOggPage->header()->StreamSerialNo());
+				return locPin->acceptOggPage(inOggPage);
+			}
 		case STRMAP_FINISHED:
+			return false;
 		case STRMAP_ERROR:
-			break;
+			return false;
+			
 	}
 	
 
 }
 
+bool OggStreamMapper::allStreamsReady()
+{
+	bool locAllReady = true;
+	//OggDemuxPageSourcePin* locPin = NULL;
+	for (size_t i = 0; i < mPins.size(); i++) {
+		locAllReady = locAllReady && (mPins[i]->isStreamReady());
+	}	
+
+	return locAllReady && (mPins.size() > 0);
+}
+
 bool OggStreamMapper::addNewPin(OggPage* inOggPage)
 {
 	OggDemuxPageSourcePin* locNewPin = new OggDemuxPageSourcePin(NAME("OggPageSourcePin"), mParentFilter, mParentFilterLock, inOggPage);
 	mPins.push_back(locNewPin);
 	return true;
+}
+
+OggDemuxPageSourcePin* OggStreamMapper::getMatchingPin(unsigned long inSerialNo)
+{
+	OggDemuxPageSourcePin* locPin = NULL;
+	for (size_t i = 0; i < mPins.size(); i++) {
+		locPin = mPins[i];
+		if (locPin->getSerialNo() == inSerialNo) {
+			return locPin;
+		}
+	}
+	return NULL;
 }
\ No newline at end of file

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h	2005-10-22 15:50:41 UTC (rev 10249)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h	2005-10-22 16:13:49 UTC (rev 10250)
@@ -30,6 +30,8 @@
 
 	eStreamState streamState();
 
+	bool allStreamsReady();
+
 protected:
 	eStreamState mStreamState;
 	vector<OggDemuxPageSourcePin*> mPins;
@@ -37,4 +39,5 @@
 	CCritSec* mParentFilterLock;
 
 	bool addNewPin(OggPage* inOggPage);
+	OggDemuxPageSourcePin* getMatchingPin(unsigned long inSerialNo);
 };



More information about the commits mailing list