[xiph-commits] r8177 - in trunk/oggdsf/src/lib: core/directshow/dsfAnxDemux core/directshow/dsfOggDemux helper/libilliCore

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Sat Nov 6 01:20:31 PST 2004


Author: illiminable
Date: 2004-11-06 01:20:30 -0800 (Sat, 06 Nov 2004)
New Revision: 8177

Modified:
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.h
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/CMMLStream.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.h
   trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp
   trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
Log:
* Rearranged the annodex demuxer so it can handle multiple versions. Still only implements annodex 2.0

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -89,5 +89,6 @@
 	//anxDebug<<"After seek table instantiation"<<endl;
 	mSeekTable->buildTable();
 	//anxDebug<<"After build table..."<<endl;
+	debugLog<<"After build table"<<endl;
 	return SetUpPins();
 }
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -41,11 +41,17 @@
 	,	mSeenAnnodexBOS(false)
 	,	mReadyForCodecs(false)
 	,	mSeenCMML(false)
+	,	mDemuxState(eAnxDemuxState::SEEN_NOTHING)
+	,	mAnxVersion(0)
+	,	mAnnodexHeader(NULL)
 {
+
+	debugLog.open("G:\\logs\\anxmapper.log", ios_base::out);
 }
 
 AnxStreamMapper::~AnxStreamMapper(void)
 {
+	debugLog.close();
 }
 
 bool AnxStreamMapper::isReady() {
@@ -56,97 +62,327 @@
 	for (unsigned long i = 1; i < mStreamList.size(); i++) {
 		locWasAny = true;
 		retVal = retVal && mStreamList[i]->streamReady();
+		debugLog<<"Stream "<<i<<" ";
+		if (retVal) {
+			debugLog<<"READY !!!!!!"<<endl;
+		} else {
+			debugLog<<"NOT READY !!!!"<<endl;
+		}
 	}
+	if (locWasAny && retVal) {
+		debugLog<<"Streams READY"<<endl;
+	} else {
+		debugLog<<"Streams NOT READY"<<endl;
+	}
 	return locWasAny && retVal;
 }
-bool AnxStreamMapper::acceptOggPage(OggPage* inOggPage)			//Deletes or gives away page.
-{
-	//ANXTOFIX::: This was changed in the ogg demux.
-	//DONE:::
 
-	//if(!isReady()) {
-	//	mDataStartsAt += inOggPage->pageSize();
-	//}
+bool AnxStreamMapper::isAnnodexEOS(OggPage* inOggPage) {
+	if ((inOggPage->header()->StreamSerialNo() == mAnnodexSerial) &&
+				(inOggPage->header()->isEOS())) {
+		return true;
+	} else {
+		return false;
+	}
 
-	if (!mReadyForCodecs) {
-		if (inOggPage->header()->isBOS()) {
-			if (!mSeenAnnodexBOS) {
-				//This is an annodex BOS page
-				//Need to verify it's an annodex page too
-				mAnnodexSerial = inOggPage->header()->StreamSerialNo();
-				mSeenAnnodexBOS = true;
+}
+bool AnxStreamMapper::isAnnodexBOS(OggPage* inOggPage) {
+	if  ((inOggPage->numPackets() != 1) ||
+				(inOggPage->getPacket(0)->packetSize() < 12) ||
+				(strncmp((const char*)inOggPage->getPacket(0)->packetData(), "Annodex\0", 8) != 0) || 
+				(!inOggPage->header()->isBOS())) {
+		return false;
+	} else {
+		return true;
+	}
+}
+
+bool AnxStreamMapper::isAnxDataPage(OggPage* inOggPage, bool inAnxDataAreBOS) {
+
+	//isBOS			inAnxDataAreBOS		isValid
+	//
+	//true			true				true
+	//true			false				false
+	//false			true				false
+	//false			false				true
+	if  ((inOggPage->numPackets() != 1) ||
+				(inOggPage->getPacket(0)->packetSize() < 12) ||
+				(strncmp((const char*)inOggPage->getPacket(0)->packetData(), "AnxData\0", 8) != 0) || 
 				
-				//Need to save the data from the header here.
-			} else {
-				//This is anxdata
-				
+				( (inOggPage->header()->isBOS()) != inAnxDataAreBOS )) {
+		return false;
+	} else {
+		return true;
+	}
+}
+/**
+ *	Returns a 32 number indicating the version... major<<16 + minor
+ */
+unsigned long AnxStreamMapper::getAnxVersion(OggPage* inOggPage) {
+	if (isAnnodexBOS(inOggPage)) {
+			//8 and 10 are the offsets into the header for version number.
+			return ((iLE_Math::charArrToUShort(inOggPage->getPacket(0)->packetData() + 8)) << 16) + iLE_Math::charArrToUShort(inOggPage->getPacket(0)->packetData() + 10);
+	} else {
+		return 0;
+	}
 
-				if ( (mSeenCMML == false) ) {
-					//This is a really nasty way to do it ! Fix this up properly later.
-					char* locStr = (char*)(inOggPage->getPacket(0)->packetData() + 28);
-					if (strstr(locStr, "text/x-cmml") != NULL) {
-						mSeenCMML = true;
-						OggStream* locStream = new CMMLStream(inOggPage, mOwningFilter, true);	//The page is only given for viewing
-						if (locStream != NULL) {
-							mStreamList.push_back(locStream);
-						}
-					}
-				} else {
-				//Need to save header data here.
-					mSeenStreams.push_back(inOggPage->header()->StreamSerialNo());
-				}
-			}
-		}
+	
 
+}
 
-		if (inOggPage->header()->isEOS()) {
-			if (mSeenAnnodexBOS) {
-				//This is the annodex EOS page
-				mReadyForCodecs = true;
-			} else {
-				//ERROR... got an EOS before we've seen the annodex BOS
+bool AnxStreamMapper::handleAnxVersion_2_0(OggPage* inOggPage) {
+	// LEAK::: Check memory deleting.
+	const bool ANXDATA_ARE_BOS = true;
+
+	bool locTemp = false;
+
+	vector<unsigned long>::iterator it;
+	int i = 0;
+	switch (mDemuxState) {
+		case SEEN_NOTHING:
+			debugLog<<"SEEN_NOTHING"<<endl;
+			//We must find an annodex BOS page.
+			if (!isAnnodexBOS(inOggPage)) {
+				mDemuxState = INVALID_STATE;
 				delete inOggPage;
 				return false;
+			} else {
+				delete mAnnodexHeader;
+				mAnnodexHeader = inOggPage->getPacket(0)->clone();
+				mAnnodexSerial = inOggPage->header()->StreamSerialNo();
+				mDemuxState = SEEN_ANNODEX_BOS;
+				return true;
 			}
-		}
-		delete inOggPage;
-		return true;
-	} else {
-		vector<unsigned long>::iterator it;
-		int i;
-		for(i = 0, it = mSeenStreams.begin(); it != mSeenStreams.end(); i++, ++it) {
-		//for (int i = 0; i < mSeenStreams.size(); i++) {
-			if (mSeenStreams[i] == inOggPage->header()->StreamSerialNo()) {
-				//If the page is a BOS we need to start a new stream
-				const bool ALLOW_OTHERS_TO_SEEK = true;
-				OggStream* locStream = OggStreamFactory::CreateStream(inOggPage, mOwningFilter, ALLOW_OTHERS_TO_SEEK);
-				//FIX::: Need to check for NULL
+			break;		//Can never be here.
+
+		case SEEN_ANNODEX_BOS:
+			debugLog<<"SEEN_ANNODEX_BOS"<<endl;
+			//We should be getting Anxdata headers here.
+			if (!isAnxDataPage(inOggPage, ANXDATA_ARE_BOS)) {
+				mDemuxState = INVALID_STATE;
+				return false;
+			} else {
+				//This should be the CMML AnxData header.
+				mSeenStreams.clear();
+				mAnxDataHeaders.clear();
+				//mSeenStreams.push_back(inOggPage->header()->StreamSerialNo());
+				mAnxDataHeaders.push_back(inOggPage->getPacket(0)->clone());
+				mDemuxState = SEEN_AN_ANXDATA;
+
+				
+				//Add the CMML Stream
+				OggStream* locStream = new CMMLStream(inOggPage, mOwningFilter, true);	//The page is only given for viewing
 				if (locStream != NULL) {
+					debugLog<<"Adding CMML Stream"<<endl;
 					mStreamList.push_back(locStream);
 				}
-				mSeenStreams.erase(it);
-				delete inOggPage;
+
 				return true;
 			}
-		}
+				
 
-		//If we are here, the stream is not in the list.
-		//At the moment we assume it's because it's been seen, and removed... this is a bad assumption !
+			break;		//Can never be here.
 
-		return dispatchPage(inOggPage);
+		case SEEN_AN_ANXDATA:
+			debugLog<<"SEEN_AN_ANXDATA"<<endl;
+			if (isAnnodexEOS(inOggPage)) {
+				//This is the end of the stream headers.
+				mDemuxState = OGG_STATE;
+				debugLog<<"Found an Annodex EOS... transitioning."<<endl;
+				return true;
+			} else if (isAnxDataPage(inOggPage, ANXDATA_ARE_BOS)) {
+				//handle another anxdata page.
+				debugLog<<"Found another anxdata..."<<endl;
+				mSeenStreams.push_back(inOggPage->header()->StreamSerialNo());
+				mAnxDataHeaders.push_back(inOggPage->getPacket(0)->clone());
+				mDemuxState = SEEN_AN_ANXDATA;
+				return true;
+			} else {
+				mDemuxState = INVALID_STATE;
+				return false;
+				//Invalid.
+			}
+			break;
+		case OGG_STATE:
+			debugLog<<"OGG_STATE"<<endl;
+			//We've seen the annodex EOS... so we can proceed as if it's a normal ogg file.
+			// The CMML stream is already made.
+
+			for(i = 0, it = mSeenStreams.begin(); it != mSeenStreams.end(); i++, ++it) {
+			
+				if (mSeenStreams[i] == inOggPage->header()->StreamSerialNo()) {
+					//If the page is a BOS we need to start a new stream
+					const bool ALLOW_OTHERS_TO_SEEK = true;
+					debugLog<<"Creating strem.... ***"<<endl;
+					OggStream* locStream = OggStreamFactory::CreateStream(inOggPage, mOwningFilter, ALLOW_OTHERS_TO_SEEK);
+					//FIX::: Need to check for NULL
+					if (locStream != NULL) {
+						debugLog<<"Creating strem.... ***"<<endl;
+						mStreamList.push_back(locStream);
+					} else {
+						debugLog<<"Lost a packet..."<<endl;
+					}
+					mSeenStreams.erase(it);
+					delete inOggPage;
+					return true;
+				}
+			}
+
+			//If we are here, the stream is not in the list.
+			//At the moment we assume it's because it's been seen, and removed... this is a bad assumption !
+			debugLog<<"Dispatchinig.........."<<endl;
+
+			locTemp = dispatchPage(inOggPage);
+			if (locTemp) {
+				debugLog<<"Dispatch ok"<<endl;
+			} else {
+				debugLog<<"Dispatch failed"<<endl;
+			}
+			return locTemp;
+			break;
+		case INVALID_STATE:
+		default:
+			debugLog<<"INVALID"<<endl;
+			return false;
+			break;
+
+
+
 	}
 }
 
+bool AnxStreamMapper::handleAnxVersion_3_0(OggPage* inOggPage) {
+	switch (mDemuxState) {
+		case SEEN_NOTHING:
+			//We must find an annodex BOS page.
+			break;
+		case SEEN_ANNODEX_BOS:
+			break;
+		case SEEN_AN_ANXDATA:
+			break;
+		case OGG_STATE:
+			break;
+		case INVALID_STATE:
+		default:
+			break;
+
+
+
+	}
+	return false;
+}
+
+bool AnxStreamMapper::acceptOggPage(OggPage* inOggPage)			//Deletes or gives away page.
+{
+
+	if (mDemuxState == SEEN_NOTHING) {
+		mAnxVersion = getAnxVersion(inOggPage);
+		debugLog<<"Version is "<<mAnxVersion<<endl;
+	}
+	debugLog<<"Accepting Page..."<<endl;
+	switch (mAnxVersion) {
+		case ANX_VERSION_2_0:
+			//Potential memory leaks here !
+			
+			return handleAnxVersion_2_0(inOggPage);
+			break;
+		case ANX_VERSION_3_0:
+			return handleAnxVersion_3_0(inOggPage);
+		default:
+			mDemuxState = INVALID_STATE;
+			return false;
+
+	}
+
+
+
+	//debugLog<<endl<<"-------- accepting page ------"<<endl;
+	//if (!mReadyForCodecs) {
+	//	if (inOggPage->header()->isBOS()) {
+	//		if (!mSeenAnnodexBOS) {
+	//			//This is an annodex BOS page
+	//			//Need to verify it's an annodex page too
+	//			mAnnodexSerial = inOggPage->header()->StreamSerialNo();
+	//			mSeenAnnodexBOS = true;
+	//			
+	//			//Need to save the data from the header here.
+	//		} else {
+	//			//This is anxdata
+	//			
+
+	//			if ( (mSeenCMML == false) ) {
+	//				//This is a really nasty way to do it ! Fix this up properly later.
+	//				char* locStr = (char*)(inOggPage->getPacket(0)->packetData() + 28);
+	//				if (strstr(locStr, "text/x-cmml") != NULL) {
+	//					mSeenCMML = true;
+	//					OggStream* locStream = new CMMLStream(inOggPage, mOwningFilter, true);	//The page is only given for viewing
+	//					if (locStream != NULL) {
+	//						mStreamList.push_back(locStream);
+	//					}
+	//				}
+	//			} else {
+	//			//Need to save header data here.
+	//				mSeenStreams.push_back(inOggPage->header()->StreamSerialNo());
+	//			}
+	//		}
+	//	}
+
+
+	//	if (inOggPage->header()->isEOS()) {
+	//		if (mSeenAnnodexBOS) {
+	//			//This is the annodex EOS page
+	//			mReadyForCodecs = true;
+	//		} else {
+	//			//ERROR... got an EOS before we've seen the annodex BOS
+	//			delete inOggPage;
+	//			return false;
+	//		}
+	//	}
+	//	delete inOggPage;
+	//	return true;
+	//} else {
+	//	vector<unsigned long>::iterator it;
+	//	int i;
+	//	for(i = 0, it = mSeenStreams.begin(); it != mSeenStreams.end(); i++, ++it) {
+	//	//for (int i = 0; i < mSeenStreams.size(); i++) {
+	//		if (mSeenStreams[i] == inOggPage->header()->StreamSerialNo()) {
+	//			//If the page is a BOS we need to start a new stream
+	//			const bool ALLOW_OTHERS_TO_SEEK = true;
+	//			OggStream* locStream = OggStreamFactory::CreateStream(inOggPage, mOwningFilter, ALLOW_OTHERS_TO_SEEK);
+	//			//FIX::: Need to check for NULL
+	//			if (locStream != NULL) {
+	//				mStreamList.push_back(locStream);
+	//			}
+	//			mSeenStreams.erase(it);
+	//			delete inOggPage;
+	//			return true;
+	//		}
+	//	}
+
+	//	//If we are here, the stream is not in the list.
+	//	//At the moment we assume it's because it's been seen, and removed... this is a bad assumption !
+
+	//	return dispatchPage(inOggPage);
+	//}
+}
+
 bool AnxStreamMapper::toStartOfData() {
-	//Specialise for anx... adds one extra ignore packet to the flush to account for the anxdata pages.
-
+	//Specialise for anx... adds one extra ignore packet to the flush to account for the anxdata pages only
+	// if it's 2.0 version.
+	debugLog<<"ANX::: To start of data size = "<<mStreamList.size()<<endl;
 	if (isReady()) {  //CHECK::: Should check for allow dsipatch ???
 		for (unsigned long i = 0; i < mStreamList.size(); i++) {
 			//Flush each stream, then ignore the codec headers.
-			mStreamList[i]->flush(mStreamList[i]->numCodecHeaders() + 1);  //+1 = AnxData Header...
+			if (mAnxVersion == ANX_VERSION_2_0) {
+				debugLog<<"Flushing stream "<<i<<" for "<<mStreamList[i]->numCodecHeaders() + 1<<endl;
+				mStreamList[i]->flush(mStreamList[i]->numCodecHeaders() + 1);  //+1 = AnxData Header...
+			} else {
+				mStreamList[i]->flush(mStreamList[i]->numCodecHeaders());
+			}
 		}	
 		return true;
 	} else {
+		debugLog<<"Something bad happened !!!!&&&&"<<endl;
 		return false;
 	}
 }
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.h	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxStreamMapper.h	2004-11-06 09:20:30 UTC (rev 8177)
@@ -36,22 +36,55 @@
 
 #include "OggStreamMapper.h"
 #include "CMMLStream.h"
+#include "iLE_Math.h"
+
+#include <fstream>
+using namespace std;
 class AnxStreamMapper
 	:	public OggStreamMapper
 {
 public:
+	//Constructors
 	AnxStreamMapper(void);
 	AnxStreamMapper(OggDemuxSourceFilter* inOwningFilter);
 	virtual ~AnxStreamMapper(void);
 
+	//Constants and Enumerations
+	enum eAnxDemuxState {
+		SEEN_NOTHING,
+		SEEN_ANNODEX_BOS,
+		SEEN_AN_ANXDATA,
+		OGG_STATE,
+		INVALID_STATE = 1000
+	};
+
+	enum eAnxVersions {
+		ANX_VERSION_2_0 = 2 << 16,
+		ANX_VERSION_3_0 = 3 << 16
+	};
+
+	//Public Methods.
 	virtual bool acceptOggPage(OggPage* inOggPage);
 
 	virtual bool isReady();
 	virtual bool toStartOfData();
 protected:
+	//Helper Methods
+	bool isAnnodexEOS(OggPage* inOggPage);
+	bool isAnnodexBOS(OggPage* inOggPage);
+	bool isAnxDataPage(OggPage* inOggPage, bool inAnxDataAreBOS);
+	unsigned long getAnxVersion(OggPage* inOggPage);
+	bool handleAnxVersion_2_0(OggPage* inOggPage);
+	bool handleAnxVersion_3_0(OggPage* inOggPage);
+	//Member Data
 	vector<unsigned long> mSeenStreams;
 	bool mSeenAnnodexBOS;
 	bool mReadyForCodecs;
 	bool mSeenCMML;
-	unsigned long mAnnodexSerial;
+	unsigned long mAnnodexSerial;		//TODO::: May not need this anymore
+	OggPacket* mAnnodexHeader;
+	vector<OggPacket*> mAnxDataHeaders;
+	unsigned long mAnxVersion;
+	eAnxDemuxState mDemuxState;
+	
 };

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/CMMLStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/CMMLStream.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/CMMLStream.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -74,7 +74,7 @@
 	mCodecHeaders->mCodecType = StreamHeaders::CMML;
 	mAnxDataPacket = inOggPacket->clone();
 	//mCodecHeaders->addPacket((StampedOggPacket*)inOggPacket->clone());
-	mNumHeadersNeeded = 0;
+	mNumHeadersNeeded = 0;		//TODO::: This should be 1 ???
 	return true;
 }
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -114,7 +114,7 @@
 	mDemuxLock = new CCritSec;
 	mStreamLock = new CCritSec;
 	mStreamMapper = new OggStreamMapper(this);
-	//debugLog.open("g:\\logs\\sourcelog.log", ios_base::out | ios_base::ate | ios_base::app);
+	debugLog.open("g:\\logs\\sourcelog.log", ios_base::out | ios_base::ate | ios_base::app);
 	//debugLog<<"Test..."<<endl;
 	//debugLog.seekp(0, ios_base::end);
 	//debugLog<<"Test2..."<<endl;
@@ -136,7 +136,7 @@
 	mDemuxLock = new CCritSec;
 	mStreamLock = new CCritSec;
 
-	//debugLog.open("g:\\logs\\sourcelog.log", ios_base::out);
+	debugLog.open("g:\\logs\\sourcelog.log", ios_base::out);
 	//When it is derived, it's up to the superclass to set this.
 	//mStreamMapper = new OggStreamMapper(this);
 
@@ -299,7 +299,7 @@
 
 
 	CAutoLock locLock(m_pLock);
-	//debugLog<<"Set Positions"<<endl;
+	debugLog<<"Set Positions"<<endl;
 	if (mSeekTable->enabled())  {
 		//debugLog<<"SetPos : Current = "<<*pCurrent<<" Flags = "<<dwCurrentFlags<<" Stop = "<<*pStop<<" dwStopFlags = "<<dwStopFlags<<endl;
 		//debugLog<<"       : Delivering begin flush..."<<endl;
@@ -578,7 +578,7 @@
 	}
 }
 HRESULT OggDemuxSourceFilter::DataProcessLoop() {
-	//debugLog<<"Starting DataProcessLoop :"<<endl;
+	debugLog<<"Starting DataProcessLoop :"<<endl;
 	DWORD locCommand = 0;
 	char* locBuff = new  char[4096];			//Deleted before function returns...
 	//TODO::: Make this a member variable ^^^^^
@@ -595,11 +595,11 @@
 	}
 	while (!locIsEOF && locKeepGoing) {
 		if(CheckRequest(&locCommand) == TRUE) {
-			//debugLog<<"DataProcessLoop : Thread Command issued... leaving loop."<<endl;
+			debugLog<<"DataProcessLoop : Thread Command issued... leaving loop."<<endl;
 			delete[] locBuff;
 			return S_OK;
 		}
-
+		debugLog<<"Looping..."<<endl;
 		{
 			CAutoLock locSourceLock(mSourceFileLock);
 			//CAutoLock locDemuxLock(mDemuxLock);
@@ -623,7 +623,7 @@
 			locKeepGoing = ((mOggBuffer.feed((const unsigned char*)locBuff, locBytesRead)) == (OggDataBuffer::FEED_OK));;
 		}
 		if (!locKeepGoing) {
-			//debugLog << "DataProcessLoop : Feed in data buffer said stop"<<endl;
+			debugLog << "DataProcessLoop : Feed in data buffer said stop"<<endl;
 		}
 		{
 			CAutoLock locSourceLock(mSourceFileLock);
@@ -690,6 +690,7 @@
 	mDataSource->seek(0);			//TODO::: This is bad for streams.
 	//Memory leak
 	//FIXED
+	debugLog<<"COMPLETED SETUP"<<endl;
 	delete[] locBuff;
 	return S_OK;
 }
@@ -703,7 +704,7 @@
 STDMETHODIMP OggDemuxSourceFilter::Run(REFERENCE_TIME tStart) {
 	const REFERENCE_TIME A_LONG_TIME = UNITS * 1000;
 	CAutoLock locLock(m_pLock);
-	//debugLog<<"Run  :  time = "<<tStart<<endl;
+	debugLog<<"Run  :  time = "<<tStart<<endl;
 	//DeliverNewSegment(tStart, tStart + A_LONG_TIME, 1.0);
 	return CBaseFilter::Run(tStart);
 	
@@ -711,15 +712,15 @@
 }
 STDMETHODIMP OggDemuxSourceFilter::Pause(void) {
 	CAutoLock locLock(m_pLock);
-	//debugLog << "** Pause called **"<<endl;
+	debugLog << "** Pause called **"<<endl;
 	if (m_State == State_Stopped) {
-		//debugLog << "Was in stopped state... starting thread"<<endl;
+		debugLog << "Was in stopped state... starting thread"<<endl;
 		if (ThreadExists() == FALSE) {
 			Create();
 		}
 		CallWorker(THREAD_RUN);
 	}
-	//debugLog<<"Was NOT is stopped state, not doing much at all..."<<endl;
+	debugLog<<"Was NOT is stopped state, not doing much at all..."<<endl;
 	
 	HRESULT locHR = CBaseFilter::Pause();
 	

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.h	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.h	2004-11-06 09:20:30 UTC (rev 8177)
@@ -41,7 +41,7 @@
 #include "IFilterDataSource.h"
 #include "DataSourceFactory.h"
 #include "PropsAbout.h"
-//#include <fstream>
+#include <fstream>
 using namespace std;
 
 
@@ -196,7 +196,7 @@
 	OggStreamMapper* mStreamMapper;
 
 	//DEBUG
-	//fstream debugLog;
+	fstream debugLog;
 
 	
 };

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -60,15 +60,17 @@
 //Sends the page to *only one* stream if it matches the serial number.
 bool OggStreamMapper::dispatchPage(OggPage* inOggPage)				//Gives away or deletes page.
 {
+	debugLog<<"Dispatch page..."<<endl;
 	for (unsigned long i = 0; i < mStreamList.size(); i++) {
 		if (mStreamList[i]->serialNo() == inOggPage->header()->StreamSerialNo()) {
 			//This is the correct stream
 			//DbgLog((LOG_TRACE, 2, TEXT("Mapper : Dispatching page to serial %u",inOggPage->header()->StreamSerialNo())));
+			debugLog<<"Dispatch to stream "<<i<<endl;
 			return mStreamList[i]->acceptOggPage(inOggPage);		//Give away page.
 			
 		}
 	}
-
+	debugLog<<"Shouldn't be here $$$$$$"<<endl;
 	//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.
@@ -134,6 +136,7 @@
 }
 
 void OggStreamMapper::setAllowDispatch(bool inAllowDispatch) {
+	debugLog<<"Setting allow dispatch..."<<endl;
 	for (unsigned long i = 0; i < mStreamList.size(); i++) {
 		mStreamList[i]->setAllowDispatch(inAllowDispatch);;
 	}

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.h	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggStreamMapper.h	2004-11-06 09:20:30 UTC (rev 8177)
@@ -36,6 +36,7 @@
 #include "OggDemuxSourceFilter.h"
 
 #include <vector>
+#include <fstream>
 using namespace std;
 
 class OGG_DEMUX_API OggStreamMapper
@@ -65,4 +66,5 @@
 	vector<OggStream*> mStreamList;
 
 	OggDemuxSourceFilter* mOwningFilter;
+	fstream debugLog;
 };

Modified: trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp	2004-11-06 09:20:30 UTC (rev 8177)
@@ -60,7 +60,9 @@
 	outCharArray[0] = (unsigned char) ((inLong << 24) >> 24);
 
 }
-
+unsigned short iLE_Math::charArrToUShort(const unsigned char* inCharArray) {
+	return (inCharArray[1] << 8) + inCharArray[0];
+}
 __int64 iLE_Math::CharArrToInt64(const unsigned char* inCharArray) {
 	__int64 locData = 0;
 

Modified: trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h	2004-11-06 03:05:00 UTC (rev 8176)
+++ trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h	2004-11-06 09:20:30 UTC (rev 8177)
@@ -41,7 +41,7 @@
 	static void ULongToCharArr(unsigned long inLong, unsigned char* outCharArray);
 	static __int64 CharArrToInt64(const unsigned char* inCharArray);
 	static void Int64ToCharArr(__int64 inInt64, unsigned char* outCharArray);
-	
+	static unsigned short charArrToUShort(const unsigned char* inCharArray);	
 
 
 };



More information about the commits mailing list