[xiph-commits] r10262 - 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 01:53:57 PDT 2005


Author: illiminable
Date: 2005-10-23 01:53:45 -0700 (Sun, 23 Oct 2005)
New Revision: 10262

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.h
   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/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
Log:
* Implement GetAllocator requirements on the vorbis filter.
* Now the codec decides the buffer requirements, since the demux no long has any idea about the data it is transporting
* Change vorbis filter to accept new generic OggPacketStream Mediatype
* Implement CheckMediaType on the input pin, since it now has to verify the ident header

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp	2005-10-23 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp	2005-10-23 08:53:45 UTC (rev 10262)
@@ -84,10 +84,10 @@
 
 	//Setup the media Types for the input pin.
 	locAcceptMediaType = NULL;
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Audio);			//Deleted by pin
+	locAcceptMediaType = new CMediaType(&MEDIATYPE_OggPacketStream);			//Deleted by pin
 
-	locAcceptMediaType->subtype = MEDIASUBTYPE_Vorbis;
-	locAcceptMediaType->formattype = FORMAT_Vorbis;
+	locAcceptMediaType->subtype = MEDIASUBTYPE_None;
+	locAcceptMediaType->formattype = FORMAT_OggIdentHeader;
 
 	locAcceptableTypes.push_back(locAcceptMediaType);
 	
@@ -118,9 +118,17 @@
 {
 	return mVorbisFormatInfo;
 }
-void VorbisDecodeFilter::setVorbisFormat(sVorbisFormatBlock* inFormatBlock) 
+void VorbisDecodeFilter::setVorbisFormat(BYTE* inFormatBlock) 
 {
 	delete mVorbisFormatInfo;
 	mVorbisFormatInfo = new sVorbisFormatBlock;				//Deleted in destructor.
-	*mVorbisFormatInfo = *inFormatBlock;
+	//*mVorbisFormatInfo = *inFormatBlock;
+
+	mVorbisFormatInfo->vorbisVersion = iLE_Math::charArrToULong(inFormatBlock + 7);
+	mVorbisFormatInfo->numChannels = inFormatBlock[11];
+	mVorbisFormatInfo->samplesPerSec = iLE_Math::charArrToULong(inFormatBlock + 12);
+	mVorbisFormatInfo->maxBitsPerSec = iLE_Math::charArrToULong(inFormatBlock + 16);
+	mVorbisFormatInfo->avgBitsPerSec = iLE_Math::charArrToULong(inFormatBlock + 20);
+	mVorbisFormatInfo->minBitsPerSec = iLE_Math::charArrToULong(inFormatBlock + 24);
+
 }

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.h	2005-10-23 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.h	2005-10-23 08:53:45 UTC (rev 10262)
@@ -59,7 +59,7 @@
 
 	//FIX::: Do we need these ? Aren't they all friends ??
 	virtual sVorbisFormatBlock* getVorbisFormatBlock();
-	virtual void setVorbisFormat(sVorbisFormatBlock* inFormatBlock);
+	virtual void setVorbisFormat(BYTE* inFormatBlock);
 
 protected:
 	//VIRTUAL FUNCTIONS - AbstractTransformFilter

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 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-23 08:53:45 UTC (rev 10262)
@@ -232,12 +232,34 @@
 	//FIX:::Error checking
 	//RESOLVED::: Bit better.
 
-	if (inMediaType->subtype == MEDIASUBTYPE_Vorbis) {
-		((VorbisDecodeFilter*)mParentFilter)->setVorbisFormat((sVorbisFormatBlock*)inMediaType->pbFormat);
+	if (CheckMediaType(inMediaType) == S_OK) {
+		((VorbisDecodeFilter*)mParentFilter)->setVorbisFormat(inMediaType->pbFormat);
 		
 	} else {
 		throw 0;
 	}
 	return CBaseInputPin::SetMediaType(inMediaType);
 }
+HRESULT VorbisDecodeInputPin::CheckMediaType(const CMediaType *inMediaType)
+{
+	if (AbstractTransformInputPin::CheckMediaType(inMediaType) == S_OK) {
+		if (inMediaType->cbFormat == VORBIS_IDENT_HEADER_SIZE) {
+			if (strncmp((char*)inMediaType->pbFormat, "\001vorbis", 7) == 0) {
+				//TODO::: Possibly verify version
+				return S_OK;
+			}
+		}
+	}
+	return S_FALSE;
+	
+}
 
+HRESULT VorbisDecodeInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps)
+{
+	outRequestedProps->cbBuffer = VORBIS_BUFFER_SIZE;
+	outRequestedProps->cBuffers = VORBIS_NUM_BUFFERS;
+	outRequestedProps->cbAlign = 1;
+	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 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-10-23 08:53:45 UTC (rev 10262)
@@ -58,15 +58,19 @@
 	static int __cdecl VorbisDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer);
 
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
-
+	virtual HRESULT CheckMediaType(const CMediaType *inMediaType);
 	virtual STDMETHODIMP NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
 
 
+	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
+
 protected:
 	//fstream debugLog;
 
+	static const unsigned long VORBIS_IDENT_HEADER_SIZE = 30;
+	static const unsigned long VORBIS_NUM_BUFFERS = 75;
+	static const unsigned long VORBIS_BUFFER_SIZE = 65536;
 
-
 	//Implementation of virtuals from AbstractTransform Filter
 	virtual bool ConstructCodec();
 	virtual void DestroyCodec();

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h	2005-10-23 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/vorbisdecoderdllstuff.h	2005-10-23 08:53:45 UTC (rev 10262)
@@ -40,6 +40,8 @@
 #include "VorbisDecodeOutputPin.h"
 #include "VorbisDecodeFilter.h"
 
+#include "libilliCore/iLE_Math.h"
+
 #ifdef LIBOOOGG_EXPORTS
 #define LIBOOOGG_API __declspec(dllexport)
 #else
@@ -50,23 +52,31 @@
 DEFINE_GUID(CLSID_VorbisDecodeFilter, 
 0x5a1d945, 0xa794, 0x44ef, 0xb4, 0x1a, 0x2f, 0x85, 0x1a, 0x11, 0x71, 0x55);
 
-// {8A0566AC-42B3-4ad9-ACA3-93B906DDF98A}
-DEFINE_GUID(MEDIASUBTYPE_Vorbis, 
-0x8a0566ac, 0x42b3, 0x4ad9, 0xac, 0xa3, 0x93, 0xb9, 0x6, 0xdd, 0xf9, 0x8a);
+//// {8A0566AC-42B3-4ad9-ACA3-93B906DDF98A}
+//DEFINE_GUID(MEDIASUBTYPE_Vorbis, 
+//0x8a0566ac, 0x42b3, 0x4ad9, 0xac, 0xa3, 0x93, 0xb9, 0x6, 0xdd, 0xf9, 0x8a);
+//
+//// {44E04F43-58B3-4de1-9BAA-8901F852DAE4}
+//DEFINE_GUID(FORMAT_Vorbis, 
+//0x44e04f43, 0x58b3, 0x4de1, 0x9b, 0xaa, 0x89, 0x1, 0xf8, 0x52, 0xda, 0xe4);
 
-// {44E04F43-58B3-4de1-9BAA-8901F852DAE4}
-DEFINE_GUID(FORMAT_Vorbis, 
-0x44e04f43, 0x58b3, 0x4de1, 0x9b, 0xaa, 0x89, 0x1, 0xf8, 0x52, 0xda, 0xe4);
 
+// {60891713-C24F-4767-B6C9-6CA05B3338FC}
+DEFINE_GUID(MEDIATYPE_OggPacketStream, 
+0x60891713, 0xc24f, 0x4767, 0xb6, 0xc9, 0x6c, 0xa0, 0x5b, 0x33, 0x38, 0xfc);
 
+// {95388704-162C-42a9-8149-C3577C12AAF9}
+DEFINE_GUID(FORMAT_OggIdentHeader, 
+0x95388704, 0x162c, 0x42a9, 0x81, 0x49, 0xc3, 0x57, 0x7c, 0x12, 0xaa, 0xf9);
+
 const REGPINTYPES VorbisDecodeOutputTypes = {
     &MEDIATYPE_Audio,
 	&MEDIASUBTYPE_PCM
 };
 
 const REGPINTYPES VorbisDecodeInputTypes = {
-	&MEDIATYPE_Audio,
-	&MEDIASUBTYPE_Vorbis
+	&MEDIATYPE_OggPacketStream,
+	&MEDIASUBTYPE_None
 };
 
 const REGFILTERPINS VorbisDecodePinReg[] = {

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 07:59:04 UTC (rev 10261)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp	2005-10-23 08:53:45 UTC (rev 10262)
@@ -131,13 +131,13 @@
 {
 	HRESULT locHR = S_OK;
 
-	ALLOCATOR_PROPERTIES locReqAlloc;
+	ALLOCATOR_PROPERTIES locReqAlloc = *inoutInputRequest;
 	ALLOCATOR_PROPERTIES locActualAlloc;
 
-	locReqAlloc.cbAlign = 1;
-	locReqAlloc.cbBuffer = 65536; //BUFFER_SIZE;
-	locReqAlloc.cbPrefix = 0;
-	locReqAlloc.cBuffers = NUM_PAGE_BUFFERS; //NUM_BUFFERS;
+	//locReqAlloc.cbAlign = 1;
+	//locReqAlloc.cbBuffer = 65536; //BUFFER_SIZE;
+	//locReqAlloc.cbPrefix = 0;
+	//locReqAlloc.cBuffers = NUM_PAGE_BUFFERS; //NUM_BUFFERS;
 
 	locHR = inoutAllocator->SetProperties(&locReqAlloc, &locActualAlloc);
 



More information about the commits mailing list