[xiph-commits] r8017 - in trunk/oggdsf/src/lib: codecs/flac/filters/dsfFLACDecoder core/directshow/dsfOggDemux core/directshow/dsfOggMux core/ogg/libOOOgg core/ogg/libOOOggSeek

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Fri Oct 15 23:09:37 PDT 2004


Author: illiminable
Date: 2004-10-15 23:09:36 -0700 (Fri, 15 Oct 2004)
New Revision: 8017

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACdecoderdllstuff.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/FLACStream.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggFLAC_1_0_Stream.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h
   trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp
   trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h
   trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
Log:
* Fixed some inconsistencies with flac format blocks.
* Now can mux flac with theora or any other codec.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -57,7 +57,7 @@
 
 	inFormatBuffer->wFormatTag = WAVE_FORMAT_PCM;
 	inFormatBuffer->nChannels = locFilter->getFLACFormatBlock()->numChannels;
-    inFormatBuffer->nSamplesPerSec =  locFilter->getFLACFormatBlock()->sampleRate;
+    inFormatBuffer->nSamplesPerSec =  locFilter->getFLACFormatBlock()->samplesPerSec;
 	inFormatBuffer->wBitsPerSample = locFilter->getFLACFormatBlock()->numBitsPerSample;
 	inFormatBuffer->nBlockAlign = (inFormatBuffer->nChannels) * (inFormatBuffer->wBitsPerSample >> 3);
 	inFormatBuffer->nAvgBytesPerSec = ((inFormatBuffer->nChannels) * (inFormatBuffer->wBitsPerSample >> 3)) * inFormatBuffer->nSamplesPerSec;

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACdecoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACdecoderdllstuff.h	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACdecoderdllstuff.h	2004-10-16 06:09:36 UTC (rev 8017)
@@ -42,7 +42,7 @@
 struct sFLACFormatBlock {
 	unsigned short numChannels;
 	unsigned long numBitsPerSample;
-	unsigned long sampleRate;
+	unsigned long samplesPerSec;
 
 };
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/FLACStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/FLACStream.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/FLACStream.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -71,7 +71,7 @@
 	//Fix the format block data... use header version and other version.
 	//mFLACFormatBlock->FLACVersion = FLACMath::charArrToULong(mCodecHeaders->getPacket(1)->packetData() + 28);
 	mFLACFormatBlock->numChannels = (((mCodecHeaders->getPacket(1)->packetData()[16]) & FLAC_CHANNEL_MASK) >> 1) + 1;
-	mFLACFormatBlock->sampleRate = (iBE_Math::charArrToULong(mCodecHeaders->getPacket(1)->packetData() + 14)) >> 12;
+	mFLACFormatBlock->samplesPerSec = (iBE_Math::charArrToULong(mCodecHeaders->getPacket(1)->packetData() + 14)) >> 12;
 	
 	mFLACFormatBlock->numBitsPerSample =	(((mCodecHeaders->getPacket(1)->packetData()[16] & FLAC_BPS_START_MASK) << 4)	|
 											((mCodecHeaders->getPacket(1)->packetData()[17] & FLAC_BPS_END_MASK) >> 4)) + 1;	
@@ -114,7 +114,7 @@
 	return true;
 }
 void FLACStream::setLastEndGranPos(__int64 inPos) {
-	mLastEndGranulePos = (inPos * (__int64)mFLACFormatBlock->sampleRate)/ UNITS;
+	mLastEndGranulePos = (inPos * (__int64)mFLACFormatBlock->samplesPerSec)/ UNITS;
 }
 bool FLACStream::deliverCodecHeaders() {
 	StampedOggPacket* locPacket = NULL;
@@ -132,7 +132,7 @@
 }
 
 LONGLONG FLACStream::getCurrentPos() {
-	return (mLastEndGranulePos * UNITS) / mFLACFormatBlock->sampleRate;
+	return (mLastEndGranulePos * UNITS) / mFLACFormatBlock->samplesPerSec;
 }
 
 //unsigned long FLACStream::numCodecHeaders() {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggFLAC_1_0_Stream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggFLAC_1_0_Stream.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggFLAC_1_0_Stream.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -85,7 +85,7 @@
 	//Fix the format block data... use header version and other version.
 	//mFLACFormatBlock->FLACVersion = FLACMath::charArrToULong(mCodecHeaders->getPacket(1)->packetData() + 28);
 	mFLACFormatBlock->numChannels = (((mCodecHeaders->getPacket(0)->packetData()[29]) & FLAC_CHANNEL_MASK) >> 1) + 1;
-	mFLACFormatBlock->sampleRate = (iBE_Math::charArrToULong(mCodecHeaders->getPacket(0)->packetData() + 27)) >> 12;
+	mFLACFormatBlock->samplesPerSec = (iBE_Math::charArrToULong(mCodecHeaders->getPacket(0)->packetData() + 27)) >> 12;
 	
 	mFLACFormatBlock->numBitsPerSample =	(((mCodecHeaders->getPacket(0)->packetData()[29] & FLAC_BPS_START_MASK) << 4)	|
 											((mCodecHeaders->getPacket(0)->packetData()[30] & FLAC_BPS_END_MASK) >> 4)) + 1;	
@@ -132,7 +132,7 @@
 	return true;
 }
 void OggFLAC_1_0_Stream::setLastEndGranPos(__int64 inPos) {
-	mLastEndGranulePos = (inPos * (__int64)mFLACFormatBlock->sampleRate)/ UNITS;
+	mLastEndGranulePos = (inPos * (__int64)mFLACFormatBlock->samplesPerSec)/ UNITS;
 }
 bool OggFLAC_1_0_Stream::deliverCodecHeaders() {
 	debugLog<<"Delivering Codec Headers... "<<mCodecHeaders->numPackets()<<endl;
@@ -163,7 +163,7 @@
 }
 
 LONGLONG OggFLAC_1_0_Stream::getCurrentPos() {
-	return (mLastEndGranulePos * UNITS) / mFLACFormatBlock->sampleRate;
+	return (mLastEndGranulePos * UNITS) / mFLACFormatBlock->samplesPerSec;
 }
 
 //unsigned long OggFLAC_1_0_Stream::numCodecHeaders() {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h	2004-10-16 06:09:36 UTC (rev 8017)
@@ -132,7 +132,7 @@
 struct sFLACFormatBlock {
 	unsigned short numChannels;
 	unsigned long numBitsPerSample;
-	unsigned long sampleRate;
+	unsigned long samplesPerSec;
 
 };
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -53,12 +53,12 @@
 	mPaginator.setParameters(locSettings);
 	mPaginator.setPageCallback(mMuxStream);
 
-	debugLog.open("G:\\logs\\oggmuxinpin.log", ios_base::out);
+	
 }
 
 OggMuxInputPin::~OggMuxInputPin(void)
 {
-	//debugLog.close();
+	debugLog.close();
 }
 
 STDMETHODIMP OggMuxInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
@@ -74,6 +74,8 @@
 
 
 HRESULT OggMuxInputPin::SetMediaType(const CMediaType* inMediaType) {
+	debugLog.open("G:\\logs\\oggmuxinpin.log", ios_base::out);
+	debugLog<<"Set media type..."<<endl;
 	if ((inMediaType->majortype == MEDIATYPE_Video) && (inMediaType->subtype == MEDIASUBTYPE_Theora)) {
 		//Theora
 		
@@ -98,6 +100,7 @@
 			//We are connected to the encoder nd getting individual metadata packets.
 			sFLACFormatBlock* locFLAC = (sFLACFormatBlock*)inMediaType->pbFormat;
 			mMuxStream->setConversionParams(locFLAC->samplesPerSec, 1, 10000000);
+			debugLog<<"FLAC sample rate = "<<locFLAC->samplesPerSec<<endl;
 			//mNeedsFLACHeaderTweak = true;
 			mNeedsFLACHeaderCount = true;
 		} else if (inMediaType->subtype == MEDIASUBTYPE_FLAC) {
@@ -105,6 +108,7 @@
 			// Need to use the header splitter class.
 			sFLACFormatBlock* locFLAC = (sFLACFormatBlock*)inMediaType->pbFormat;
 			mMuxStream->setConversionParams(locFLAC->samplesPerSec, 1, 10000000);
+			debugLog<<"FLAC sample rate = "<<locFLAC->samplesPerSec<<endl;
 			mNeedsFLACHeaderTweak = true;
 		} 
 
@@ -185,7 +189,7 @@
 	if (mNeedsFLACHeaderCount) {
 		mNeedsFLACHeaderCount = false;
 		//This is to set the number of headers on the paginator for OggFLAC_1_0
-		mPaginator.setNumHeaders( locPacket->packetData()[8] );
+		mPaginator.setNumHeaders( (locPacket->packetData()[8]) + 1 );
 	}
 	if ((mNeedsFLACHeaderTweak)) {
 		//The first packet in FLAC has all the metadata in one block...
@@ -224,7 +228,7 @@
 			if (i==0) {
 				//Set the number of headers in the paginator for FLAC classic.
 				StampedOggPacket* locHeadPack = locFLACSplitter->getHeader(i);
-				mPaginator.setNumHeaders(locHeadPack->packetData()[8]);
+				mPaginator.setNumHeaders((locHeadPack->packetData()[8]) + 1);
 				delete locHeadPack;
 			}
 			mPaginator.acceptStampedOggPacket(locFLACSplitter->getHeader(i));

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h	2004-10-16 06:09:36 UTC (rev 8017)
@@ -166,8 +166,10 @@
 };
 
 struct sFLACFormatBlock {
-	unsigned char numChannels;
+	unsigned short numChannels;
+	unsigned long numBitsPerSample;
 	unsigned long samplesPerSec;
+
 };
 
 struct sTheoraFormatBlock {

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -40,8 +40,8 @@
 	,	mConvDenominator(1)
 	,	mConvScaleFactor(1)
 	,	mConvTheoraLogKeyFrameInterval(0)
-
 {
+	debugLog.open("G:\\logs\\oggmuxstream.log", ios_base::out);
 }
 
 OggMuxStream::~OggMuxStream(void)
@@ -100,7 +100,7 @@
 	
 			retTime = (locAbsFramePos * mConvScaleFactor * mConvDenominator) / mConvNumerator;
 			
-	
+			
 		}
 	} 
 	return retTime;

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h	2004-10-16 06:09:36 UTC (rev 8017)
@@ -35,6 +35,7 @@
 #include "INotifyArrival.h"
 #include <math.h>
 #include <deque>
+#include <fstream>
 using namespace std;
 class LIBOOOGG_API OggMuxStream
 	:	public IOggCallback
@@ -80,5 +81,6 @@
 	__int64 mConvScaleFactor;
 	__int64 mConvTheoraLogKeyFrameInterval;
 
+	fstream debugLog;
 	deque<OggPage*> mPageQueue;
 };

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp	2004-10-15 16:46:02 UTC (rev 8016)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp	2004-10-16 06:09:36 UTC (rev 8017)
@@ -89,6 +89,7 @@
 			mSampleRate = iBE_Math::charArrToULong(inOggPage->getPacket(0)->packetData() + 22) / iBE_Math::charArrToULong(inOggPage->getPacket(0)->packetData() + 26);
 			mNumHeaders = 3;
 			mFoundStreamInfo = true;
+			
 			//Need denominators
 			//mTheoraFormatBlock->frameRateDenominator = FLACMath::charArrToULong(locIdentHeader + 26);
 		} else if ((strncmp((char*)inOggPage->getPacket(0)->packetData(),  "fLaC", 4) == 0)) {



More information about the commits mailing list