[xiph-commits] r10337 - in branches/oggdsf_new_demux: sln/oggdsf_all src/lib/codecs/speex/filters/dsfSpeexDecoder src/lib/codecs/vorbis/filters/dsfVorbisDecoder src/lib/core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Nov 5 03:34:55 PST 2005


Author: illiminable
Date: 2005-11-05 03:34:34 -0800 (Sat, 05 Nov 2005)
New Revision: 10337

Modified:
   branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.cpp
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.h
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/speexdecoderdllstuff.h
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h
Log:
* Convert the media type negotiation in speex decoder to new style

Modified: branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln	2005-11-05 11:34:34 UTC (rev 10337)
@@ -99,6 +99,7 @@
 		{4CBC0173-27E6-4218-AE06-5EFDCA7B2547} = {4CBC0173-27E6-4218-AE06-5EFDCA7B2547}
 		{AE0ABDB0-AE3B-4C38-843B-3408A6B87BA4} = {AE0ABDB0-AE3B-4C38-843B-3408A6B87BA4}
 		{EA7091BB-9906-41DF-9738-F4858A136086} = {EA7091BB-9906-41DF-9738-F4858A136086}
+		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsfSpeexEncoder", "..\..\src\lib\codecs\speex\filters\dsfSpeexEncoder\dsfSpeexEncoder.vcproj", "{419E0701-9C9A-4671-B3B6-79FA206DEE25}"

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.cpp	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.cpp	2005-11-05 11:34:34 UTC (rev 10337)
@@ -79,11 +79,14 @@
 
 	//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_Speex;
-	locAcceptMediaType->formattype = FORMAT_Speex;
+	//locAcceptMediaType->subtype = MEDIASUBTYPE_Speex;
+	//locAcceptMediaType->formattype = FORMAT_Speex;
 
+	locAcceptMediaType->subtype = MEDIASUBTYPE_None;
+	locAcceptMediaType->formattype = FORMAT_OggIdentHeader;
+
 	locAcceptableTypes.push_back(locAcceptMediaType);
 	
 	mInputPin = new SpeexDecodeInputPin(this, m_pLock, mOutputPin, locAcceptableTypes);	//Deleted in base class filter destructor.
@@ -112,9 +115,16 @@
 {
 	return mSpeexFormatInfo;
 }
-void SpeexDecodeFilter::setSpeexFormat(sSpeexFormatBlock* inFormatBlock) 
+void SpeexDecodeFilter::setSpeexFormat(BYTE* inFormatBlock) 
 {
 	delete mSpeexFormatInfo;
 	mSpeexFormatInfo = new sSpeexFormatBlock;
-	*mSpeexFormatInfo = *inFormatBlock;
+
+	mSpeexFormatInfo->speexVersion = iLE_Math::charArrToULong(inFormatBlock + 28);
+	mSpeexFormatInfo->numChannels = iLE_Math::charArrToULong(inFormatBlock + 48);
+	mSpeexFormatInfo->samplesPerSec = iLE_Math::charArrToULong(inFormatBlock + 36);
+	mSpeexFormatInfo->avgBitsPerSec = 0;
+	mSpeexFormatInfo->maxBitsPerSec = 0;
+	mSpeexFormatInfo->minBitsPerSec = 0;
+
 }
\ No newline at end of file

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.h	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeFilter.h	2005-11-05 11:34:34 UTC (rev 10337)
@@ -33,6 +33,7 @@
 //Include Files
 #include "speexdecoderdllstuff.h"
 #include "AbstractTransformFilter.h"
+#include <libilliCore/iLE_Math.h>
 
 //Forward Declarations
 struct sSpeexFormatBlock;
@@ -59,7 +60,7 @@
 	
 	//FIX::: Do we need these ? Aren't they all friends ??
 	virtual sSpeexFormatBlock* getSpeexFormatBlock();
-	virtual void setSpeexFormat(sSpeexFormatBlock* inFormatBlock);
+	virtual void setSpeexFormat(BYTE* inFormatBlock);
 
 protected:
 	//Pure Virtuals from AbstracttransformFilter

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp	2005-11-05 11:34:34 UTC (rev 10337)
@@ -194,16 +194,38 @@
 
 
 
-HRESULT SpeexDecodeInputPin::SetMediaType(const CMediaType* inMediaType) {
+HRESULT SpeexDecodeInputPin::SetMediaType(const CMediaType* inMediaType) 
+{
 	//FIX:::Error checking
 	//RESOLVED::: Bit better.
-
-	if (inMediaType->subtype == MEDIASUBTYPE_Speex) {
-		((SpeexDecodeFilter*)mParentFilter)->setSpeexFormat((sSpeexFormatBlock*)inMediaType->pbFormat);
-
+	if (CheckMediaType(inMediaType) == S_OK) {
+		((SpeexDecodeFilter*)mParentFilter)->setSpeexFormat(inMediaType->pbFormat);
+		
 	} else {
 		throw 0;
 	}
 	return CBaseInputPin::SetMediaType(inMediaType);
+
+	//if (inMediaType->subtype == MEDIASUBTYPE_Speex) {
+	//	((SpeexDecodeFilter*)mParentFilter)->setSpeexFormat((sSpeexFormatBlock*)inMediaType->pbFormat);
+
+	//} else {
+	//	throw 0;
+	//}
+	//return CBaseInputPin::SetMediaType(inMediaType);
 }
 
+HRESULT SpeexDecodeInputPin::CheckMediaType(const CMediaType *inMediaType)
+{
+	if (AbstractTransformInputPin::CheckMediaType(inMediaType) == S_OK) {
+		if (inMediaType->cbFormat == SPEEX_IDENT_HEADER_SIZE) {
+			if (strncmp((char*)inMediaType->pbFormat, "Speex   ", 8) == 0) {
+				//TODO::: Possibly verify version
+				return S_OK;
+			}
+		}
+	}
+	return S_FALSE;
+	
+}
+

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h	2005-11-05 11:34:34 UTC (rev 10337)
@@ -56,9 +56,12 @@
 
 
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
+	virtual HRESULT CheckMediaType(const CMediaType *inMediaType);
 	virtual STDMETHODIMP NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
 
 protected:
+	static const unsigned long SPEEX_IDENT_HEADER_SIZE = 80;
+
 	//Implementation of pure virtuals from AbstractTransformInputPin
 	virtual bool ConstructCodec();
 	virtual void DestroyCodec();

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj	2005-11-05 11:34:34 UTC (rev 10337)
@@ -19,7 +19,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking"
+				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking;..\..\..\..\helper"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFSPEEXDECODER_EXPORTS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -81,7 +81,7 @@
 				FavorSizeOrSpeed="1"
 				OmitFramePointers="TRUE"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking"
+				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking;..\..\..\..\helper"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXDECODER_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -144,7 +144,7 @@
 				FavorSizeOrSpeed="1"
 				OmitFramePointers="TRUE"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking"
+				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking;..\..\..\..\helper"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXDECODER_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
@@ -208,7 +208,7 @@
 				FavorSizeOrSpeed="1"
 				OmitFramePointers="TRUE"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking"
+				AdditionalIncludeDirectories="&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg;..\..\..\helper\libfishsound\include;..\..\..\..\core\directshow\dsfSeeking;..\..\..\..\helper"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXDECODER_EXPORTS"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/speexdecoderdllstuff.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/speexdecoderdllstuff.h	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/speexdecoderdllstuff.h	2005-11-05 11:34:34 UTC (rev 10337)
@@ -51,24 +51,36 @@
 // {7605E26C-DE38-4b82-ADD8-FE2568CC0B25}
 DEFINE_GUID(CLSID_SpeexDecodeFilter, 
 0x7605e26c, 0xde38, 0x4b82, 0xad, 0xd8, 0xfe, 0x25, 0x68, 0xcc, 0xb, 0x25);
+//
+//// {25A9729D-12F6-420e-BD53-1D631DC217DF}
+//DEFINE_GUID(MEDIASUBTYPE_Speex, 
+//0x25a9729d, 0x12f6, 0x420e, 0xbd, 0x53, 0x1d, 0x63, 0x1d, 0xc2, 0x17, 0xdf);
+//
+//// {78701A27-EFB5-4157-9553-38A7854E3E81}
+//DEFINE_GUID(FORMAT_Speex, 
+//0x78701a27, 0xefb5, 0x4157, 0x95, 0x53, 0x38, 0xa7, 0x85, 0x4e, 0x3e, 0x81);
 
-// {25A9729D-12F6-420e-BD53-1D631DC217DF}
-DEFINE_GUID(MEDIASUBTYPE_Speex, 
-0x25a9729d, 0x12f6, 0x420e, 0xbd, 0x53, 0x1d, 0x63, 0x1d, 0xc2, 0x17, 0xdf);
 
-// {78701A27-EFB5-4157-9553-38A7854E3E81}
-DEFINE_GUID(FORMAT_Speex, 
-0x78701a27, 0xefb5, 0x4157, 0x95, 0x53, 0x38, 0xa7, 0x85, 0x4e, 0x3e, 0x81);
-//This structure defines the type of input we accept on the input pin... Stream/Annodex
+// {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);
+
+// {43F0F818-10B0-4c86-B9F1-F6B6E2D33462}
+DEFINE_GUID(IID_IOggDecoder, 
+0x43f0f818, 0x10b0, 0x4c86, 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62);
+
 const REGPINTYPES SpeexDecodeOutputTypes = {
     &MEDIATYPE_Audio,
 	&MEDIASUBTYPE_PCM
 };
 
 const REGPINTYPES SpeexDecodeInputTypes = {
-	&MEDIATYPE_Audio,
-	&MEDIASUBTYPE_Speex
+	&MEDIATYPE_OggPacketStream,
+	&MEDIASUBTYPE_None
 };
 const REGFILTERPINS SpeexDecodePinReg[] = {
 	{

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-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-11-05 11:34:34 UTC (rev 10337)
@@ -457,9 +457,9 @@
 }
 
 
-HRESULT VorbisDecodeInputPin::SetMediaType(const CMediaType* inMediaType) {
+HRESULT VorbisDecodeInputPin::SetMediaType(const CMediaType* inMediaType) 
+{
 	//FIX:::Error checking
-	//RESOLVED::: Bit better.
 
 	if (CheckMediaType(inMediaType) == S_OK) {
 		((VorbisDecodeFilter*)mParentFilter)->setVorbisFormat(inMediaType->pbFormat);

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-11-05 11:34:34 UTC (rev 10337)
@@ -679,6 +679,7 @@
 STDMETHODIMP OggDemuxPacketSourceFilter::SetRate(double dRate)
 {
 	//debugLog<<"Set RATE : NOT IMPL"<<endl;
+
 	return E_NOTIMPL;
 }
 STDMETHODIMP OggDemuxPacketSourceFilter::GetRate(double *dRate)

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-11-05 11:16:25 UTC (rev 10336)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.h	2005-11-05 11:34:34 UTC (rev 10337)
@@ -143,4 +143,6 @@
 
 
 	bool mJustReset;
+
+	//double mPlaybackRate;
 };



More information about the commits mailing list