[xiph-commits] r10782 - in branches/oggdsf_new_demux/src: lib/codecs/flac/filters/dsfFLACDecoder lib/codecs/ogm/filters/dsfOGMDecoder tools/OOOggPageInfo

illiminable at svn.xiph.org illiminable at svn.xiph.org
Thu Feb 2 06:43:45 PST 2006


Author: illiminable
Date: 2006-02-02 06:43:31 -0800 (Thu, 02 Feb 2006)
New Revision: 10782

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.h
   branches/oggdsf_new_demux/src/tools/OOOggPageInfo/OOOggPageInfo.cpp
Log:
* Add most of support for ogm audio and text streams
* Messed around with OOOggPageInfo to collect some stats about ogg files... only half finished

Modified: branches/oggdsf_new_demux/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp	2006-02-02 14:43:31 UTC (rev 10782)
@@ -213,7 +213,10 @@
 
 HRESULT FLACDecodeInputPin::TransformData(BYTE* inBuf, long inNumBytes) 
 {
-
+	//TODO::: There is a thread blocking problem here. sometimes the this code
+	//		inside the checkstream check can be called while the graph is flushing.
+	//
+	//		Probably just needs a lock here on the filter, and/or in the begin/end flush method
 	if (CheckStreaming() == S_OK) {
 		unsigned char* locInBuff = new unsigned char[inNumBytes];
 		memcpy((void*)locInBuff, (const void*)inBuf, inNumBytes);

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.cpp	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions
@@ -105,6 +105,7 @@
 
 
 	if (inPropertyRequest->cbBuffer == 0) {
+		//VIDSPEC::: Smaller for audio and text
 		locReqAlloc.cbBuffer = 65536*16;
 	} else {
 		locReqAlloc.cbBuffer = inPropertyRequest->cbBuffer;
@@ -154,6 +155,8 @@
 	}
 	
 	if ((inPosition == 0) && (mInputPin != NULL) && (mInputPin->IsConnected())) {
+
+		//VIDSPEC:::This needs cases for audio and text
 		
 		VIDEOINFOHEADER* locVideoFormat = (VIDEOINFOHEADER*)outMediaType->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
 		*locVideoFormat = *mInputPin->getVideoFormatBlock();
@@ -161,6 +164,7 @@
 		outMediaType->majortype = MEDIATYPE_Video;
 		outMediaType->subtype = (GUID)(FOURCCMap(locVideoFormat->bmiHeader.biCompression));;
 		outMediaType->formattype = FORMAT_VideoInfo;
+		//TODO:::Handle temproal compression and variable size field
 
 		return S_OK;
 	} else {
@@ -172,6 +176,7 @@
 
 HRESULT OGMDecodeFilter::Receive(IMediaSample* inSample)
 {
+	//VIDSPEC:::
 	BYTE* locInBuff = NULL;
 	HRESULT locHR = inSample->GetPointer(&locInBuff);
 
@@ -328,7 +333,7 @@
         if (m_pInput == NULL) {
             return NULL;
         }
-
+		//VIDSPEC::: Change the name dynamically if audio or text
 		mInputPin = (OGMDecodeInputPin*)m_pInput;
         m_pOutput = new CTransformOutputPin(NAME("OGM Out"), this, &locHR, L"Video Out");	//Deleted in base destructor
 			

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeFilter.h	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
 	:	CTransformInputPin(NAME("OGMDecodeInputPin"), inParentFilter, outHR, L"OGM In")
 	,	mVideoFormatBlock(NULL)
 	,	mSetupState(VSS_SEEN_NOTHING)
+	,	mOGMMediaType(OGM_UNKNOWN_TYPE)
 {
 
 }
@@ -75,15 +76,26 @@
 
 }
 
-HRESULT OGMDecodeInputPin::CheckMediaType(const CMediaType *inMediaType)
+HRESULT OGMDecodeInputPin::CheckMediaType(const CMediaType* inMediaType)
 {
+	//VIDSPEC::: Use the audio and text ident fields
 	if (		(inMediaType->majortype == MEDIATYPE_OggPacketStream)
 			&&	(inMediaType->subtype == MEDIASUBTYPE_None)
 			&&	(inMediaType->formattype == FORMAT_OggIdentHeader)) {
-		if (inMediaType->cbFormat == OGM_IDENT_HEADER_SIZE) {
+				//TODO::: The header size is not fixed. This is just a minimum size.
+				//			need to look in the size field to determine the actual
+				//			size of the header as some codecs can include extra data
+				//			after the ogm headers
+				//PARTIAL RESOLUTION::: Now a minimum size but should still check for
+				//			validity by checking the size field
+		if (inMediaType->cbFormat >= OGM_IDENT_HEADER_SIZE) {
 			if (strncmp((char*)inMediaType->pbFormat, "\001video\000\000\000", 9) == 0) {
 				//TODO::: Possibly verify version
 				return S_OK;
+			} else if (strncmp((char*)inMediaType->pbFormat, "\001audio\000\000\000", 9) == 0) {
+				return S_OK;
+			} else if (strncmp((char*)inMediaType->pbFormat, "\001text\000\000\000\000", 9) == 0) {
+				return S_OK;
 			}
 		}
 	}
@@ -113,10 +125,25 @@
 {
 	switch (mSetupState) {
 		case VSS_SEEN_NOTHING:
+			//VIDSPEC::: Also accept the audio and text headers
 			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\001video\000\000\000", 9) == 0) {
+				mOGMMediaType = OGM_VIDEO_TYPE;
 				handleHeaderPacket(inCodecHeaderPacket);
 				mSetupState = VSS_SEEN_BOS;
 				return IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+			} else if (strncmp((char*)inCodecHeaderPacket->packetData(), "\001audio\000\000\000", 9) == 0) {
+				//TODO::: Verify that there are secondary comment headers for audio and text
+				mOGMMediaType = OGM_AUDIO_TYPE;
+				handleHeaderPacket(inCodecHeaderPacket);
+				mSetupState = VSS_SEEN_BOS;
+				return IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+			} else if (strncmp((char*)inCodecHeaderPacket->packetData(), "\001text\000\000\000\000", 9) == 0) {
+				mOGMMediaType = OGM_TEXT_TYPE;
+				handleHeaderPacket(inCodecHeaderPacket);
+				mSetupState = VSS_SEEN_BOS;
+				return IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+			} else {
+				mOGMMediaType = OGM_UNKNOWN_TYPE;
 			}
 			mSetupState = VSS_ERROR;
 			return IOggDecoder::AHR_INVALID_HEADER;
@@ -136,16 +163,101 @@
 	}
 }
 
+bool OGMDecodeInputPin::handleHeaderPacket(OggPacket* inHeaderPack)
+{
+	switch(mOGMMediaType) {
+		case OGM_VIDEO_TYPE:
+			return handleVideoHeaderPacket(inHeaderPack);
+		case OGM_AUDIO_TYPE:
+			return handleAudioHeaderPacket(inHeaderPack);
 
+		case OGM_TEXT_TYPE:
+			return handleTextHeaderPacket(inHeaderPack);
+		default:
+			return false;
+		
+	};
+}
 
-bool OGMDecodeInputPin::handleHeaderPacket(OggPacket* inHeaderPack)
+bool OGMDecodeInputPin::handleTextHeaderPacket(OggPacket* inHeaderPack)
 {
+	//TODO:::
+	return false;
+}
+bool OGMDecodeInputPin::handleAudioHeaderPacket(OggPacket* inHeaderPack)
+{
+	delete mAudioFormatBlock;
+
+	//TODO::: This will cause a problem with extra header information appended.
+	//			need to change to byte* and cast upon use
+	mAudioFormatBlock = new WAVEFORMATEX;
+
+	//FORMAT OF AUDIO HEADER IN OGM BOS
+	//-----------------------------------------
+
+	//0		-		8		=		STRING		Stream Type (char[8] is NULL) \001audio
+	//9		-		12		=		STRING		Sub Type (format code)
+	//13	-		16		=		INT32		Size of structure ???
+	//17	-		24		=		INT64		Time per "unit" in DSHOW UNITS
+	//25	-		32		=		INT64		Samples per "unit"
+	//33	-		36		=		INT32		Deefault length ????? in media type ?? WTF ?
+	//37	-		40		=		INT32		Buffer Size
+	//41	-		42		=		INT16		Bits per sample
+	//43	-		44		=		-----		HOLE IN DATA
+	//45	-		46		=		INT16		Channel count
+	//47	-		48		=		INT16		Block Align
+	//49	-		52		=		INT32		Avg Bytes per Second
+
+	mAudioFormatBlock->nAvgBytesPerSec = iLE_Math::charArrToULong(inHeaderPack->packetData() + 49);
+	mAudioFormatBlock->nChannels = iLE_Math::charArrToUShort(inHeaderPack->packetData() + 45);
+	mAudioFormatBlock->nBlockAlign = iLE_Math::charArrToUShort(inHeaderPack->packetData() + 47);
+	
+	//TODO::: Check if this needs to be div/mul by the time per unit field
+	mAudioFormatBlock->nSamplesPerSec = iLE_Math::CharArrToInt64(inHeaderPack->packetData() + 25);
+
+	mAudioFormatBlock->wBitsPerSample = iLE_Math::charArrToUShort(inHeaderPack->packetData() + 41);
+	
+	//TODO::: Extra header size
+	mAudioFormatBlock->cbSize = sizeof(WAVEFORMATEX);
+
+	
+	unsigned short locFormatCode = 0;
+	unsigned char locHexDigitValue = 0;
+	for (int i = 0; i < 4; i++) {
+		locFormatCode <<= 4;
+		locHexDigitValue = inHeaderPack->packetData()[9 + i];
+
+		if ((locHexDigitValue >= '0') && (locHexDigitValue <= '9')) {
+			locHexDigitValue -= '0';
+		} else if ((locHexDigitValue >= 'a') && (locHexDigitValue <= 'f')) {
+			locHexDigitValue -= 'a';
+			locHexDigitValue += 10;
+		} else if ((locHexDigitValue >= 'A') && (locHexDigitValue <= 'F')) {
+			locHexDigitValue -= 'A';
+			locHexDigitValue += 10;
+		} else {
+			//This is a fatal error.
+			throw 0;
+		}
+
+		locFormatCode += locHexDigitValue;
+	}
+
+	mAudioFormatBlock->wFormatTag = locFormatCode;
+
+	return true;
+
+}
+bool OGMDecodeInputPin::handleVideoHeaderPacket(OggPacket* inHeaderPack)
+{
+	//VIDSPEC::: This whole thing is specific to video
 	delete mVideoFormatBlock;
 	mVideoFormatBlock = new VIDEOINFOHEADER;
 
-	//FORMAT OF HEADER IN OGG BOS
+	//FORMAT OF VIDEO HEADER IN OGM BOS
 	//-----------------------------------------
-	//0		-		8		=		STRING		Stream Type (char[8] is NULL)
+
+	//0		-		8		=		STRING		Stream Type (char[8] is NULL) \001video
 	//9		-		12		=		STRING		Sub Type (FOURCC)
 	//13	-		16		=		INT32		Size of structure ???
 	//17	-		24		=		INT64		Time per "unit" in DSHOW UNITS
@@ -158,6 +270,7 @@
 	//49	-		52		=		INT32		Video Height
 
 
+
  
 
 	//------------------------------------------
@@ -214,6 +327,7 @@
 }
 string OGMDecodeInputPin::getCodecShortName()
 {
+	//TODO::: These should also include the information about the fourcc or format code
 	return "OGM";
 }
 string OGMDecodeInputPin::getCodecIdentString()

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions
@@ -59,6 +59,12 @@
 	virtual string getCodecShortName();
 	virtual string getCodecIdentString();
 
+	enum eOGMMediaType {
+		OGM_VIDEO_TYPE,
+		OGM_AUDIO_TYPE,
+		OGM_TEXT_TYPE,
+		OGM_UNKNOWN_TYPE
+	};
 	VIDEOINFOHEADER* getVideoFormatBlock()		{		return mVideoFormatBlock;	}
 protected:
 	enum eOGMSetupState {
@@ -69,10 +75,16 @@
 		VSS_ERROR
 	};
 
+	eOGMMediaType mOGMMediaType;
+
 	eOGMSetupState mSetupState;
 	bool handleHeaderPacket(OggPacket* inHeaderPack);
+	bool handleAudioHeaderPacket(OggPacket* inHeaderPack);
+	bool handleVideoHeaderPacket(OggPacket* inHeaderPack);
+	bool handleTextHeaderPacket(OggPacket* inHeaderPack);
 
 	VIDEOINFOHEADER* mVideoFormatBlock;
+	WAVEFORMATEX* mAudioFormatBlock;
 
 	static const unsigned long OGM_IDENT_HEADER_SIZE = 57;
 	static const unsigned long OGM_NUM_BUFFERS = 50;

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.cpp	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.cpp	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.h	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/ogmdecoderdllstuff.h	2006-02-02 14:43:31 UTC (rev 10782)
@@ -1,5 +1,5 @@
 //===========================================================================
-//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
 //
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions

Modified: branches/oggdsf_new_demux/src/tools/OOOggPageInfo/OOOggPageInfo.cpp
===================================================================
--- branches/oggdsf_new_demux/src/tools/OOOggPageInfo/OOOggPageInfo.cpp	2006-02-02 05:23:34 UTC (rev 10781)
+++ branches/oggdsf_new_demux/src/tools/OOOggPageInfo/OOOggPageInfo.cpp	2006-02-02 14:43:31 UTC (rev 10782)
@@ -29,7 +29,7 @@
 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //===========================================================================
 
-// OggDump.cpp : Defines the entry point for the console application.
+// OOOggPageInfo.cpp : Defines the entry point for the console application.
 //
 
 #include "stdafx.h"
@@ -39,17 +39,50 @@
 #include <iostream>
 #include <fstream>
 
+struct sOggStreamInfo {
+	unsigned long mSerialNo;
+	unsigned long mNumPages;
+	unsigned long mMinPageSize;
+	unsigned long mMaxPageSize;
+	unsigned long mMinPacksPerPage;
+	unsigned long mMaxPacksPerPage;
+	unsigned long mTotalPacketCount;
+	unsigned long mTotalStreamSize;
+	unsigned long mTotalDataSize;
+
+};
+
+void dumpStreamInfo(sOggStreamInfo* inInfo)
+{
+
+	cout<<"=== Stream "<<inInfo->mSerialNo<<endl;
+	cout<<"=================="<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+
+	cout<<"Min Page Size  :  "<<inInfo->mMinPageSize<<endl;
+	cout<<"Max Page Size  :  "<<inInfo->mMaxPageSize<<endl;
+	cout<<"Avg Page Size  :  "<<inInfo->mTotalStreamSize / inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl;
+	cout<<"Num Pages      :  "<<inInfo->mNumPages<<endl<<endl;
+
+}
 unsigned long bytePos;
-vector<unsigned long> streamSerials;
-vector<unsigned long*> maxPacks;
+//vector<unsigned long> streamSerials;
+//vector<unsigned long*> maxPacks;
+vector<sOggStreamInfo*> streamInfos;
+
 //This will be called by the callback
 bool pageCB(OggPage* inOggPage, void* inUserData /* ignored */) {
 	bool locFoundStream = false;
 	size_t locFoundPos = 0;
 
 	unsigned long locSerialNo = inOggPage->header()->StreamSerialNo();
-	for (size_t i = 0; i < streamSerials.size(); i++) {
-		if (locSerialNo == streamSerials[i]) {
+	for (size_t i = 0; i < streamInfos.size(); i++) {
+		if (locSerialNo == streamInfos[i]->mSerialNo) {
 			locFoundStream = true;
 			locFoundPos = i;
 			break;
@@ -57,14 +90,54 @@
 	}
 	
 	if (!locFoundStream) {
-		streamSerials.push_back(locSerialNo);
-		maxPacks.push_back(new unsigned long(0));
+		//streamSerials.push_back(locSerialNo);
+		//maxPacks.push_back(new unsigned long(0));
+		sOggStreamInfo* locStreamInfo = new sOggStreamInfo;
+		locStreamInfo->mMaxPacksPerPage = 0;
+		locStreamInfo->mMaxPageSize = 0;
+		locStreamInfo->mMinPacksPerPage = (unsigned long)-1;
+		locStreamInfo->mMinPageSize = (unsigned long)-1;
+		locStreamInfo->mNumPages = 0;
+		locStreamInfo->mSerialNo = locSerialNo;
+		locStreamInfo->mTotalDataSize = 0;
+		locStreamInfo->mTotalPacketCount = 0;
+		locStreamInfo->mTotalStreamSize = 0;
+
+		streamInfos.push_back(locStreamInfo);
 	}
 	unsigned long locNumPacks = 0;
-	for (size_t i = 0; i < streamSerials.size(); i++) {
+	for (size_t i = 0; i < streamInfos.size(); i++) {
 		
-		if (locSerialNo == streamSerials[i]) {
+		if (locSerialNo == streamInfos[i]->mSerialNo) {
 			locFoundPos = i;
+			
+			//Fill in the stats
+
+			if (streamInfos[i]->mMaxPacksPerPage < inOggPage->numPackets()) {
+				streamInfos[i]->mMaxPacksPerPage = inOggPage->numPackets();
+			}
+
+			if (streamInfos[i]->mMaxPageSize < inOggPage->pageSize()) {
+				streamInfos[i]->mMaxPageSize = inOggPage->pageSize();
+			}
+
+			if (streamInfos[i]->mMinPacksPerPage > inOggPage->numPackets()) {
+				streamInfos[i]->mMinPacksPerPage = inOggPage->numPackets();
+			}
+
+			if (streamInfos[i]->mMinPageSize > inOggPage->pageSize()) {
+
+				streamInfos[i]->mMinPageSize = inOggPage->pageSize();
+			}
+
+			streamInfos[i]->mNumPages++;
+			//streamInfos[i]->mSerialNo = locSerialNo;
+			streamInfos[i]->mTotalDataSize += inOggPage->dataSize();
+			streamInfos[i]->mTotalPacketCount += inOggPage->numPackets();
+			streamInfos[i]->mTotalStreamSize += inOggPage->pageSize();
+
+
+
 			cout << "Stream "<<(unsigned long)i<<"  : Granule = "<<inOggPage->header()->GranulePos()<<"   - ";
 			locNumPacks = 0;
 			if (inOggPage->numPackets() == 0) {
@@ -109,9 +182,9 @@
 	}
 
 	
-	if (*maxPacks[locFoundPos] < locNumPacks) {
-		*maxPacks[locFoundPos] = locNumPacks;
-	}
+	//if (*maxPacks[locFoundPos] < locNumPacks) {
+	//	*maxPacks[locFoundPos] = locNumPacks;
+	//}
 
 	return true;
 }
@@ -151,13 +224,14 @@
 		cout<<endl;
 		cout<<endl;
 
-		for (size_t i = 0; i < maxPacks.size(); i++) {
-			cout<<"Stream "<<(unsigned long)i<<" max Packets = "<<*maxPacks[i]<<endl;
+		for (size_t i = 0; i < streamInfos.size(); i++) {
+			dumpStreamInfo(streamInfos[i]);
+			//cout<<"Stream "<<(unsigned long)i<<" max Packets = "<<*maxPacks[i]<<endl;
 		}
 
 
-		for (size_t i = 0; i < maxPacks.size(); i++) {
-			delete maxPacks[i];
+		for (size_t i = 0; i < streamInfos.size(); i++) {
+			delete streamInfos[i];
 		}
 
 		delete[] locBuff;



More information about the commits mailing list