[xiph-commits] r8278 - in trunk/oggdsf: docs sln/oggdsf_all
src/lib/codecs/speex/filters/dsfSpeexDecoder
src/lib/codecs/speex/filters/dsfSpeexEncoder
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Wed Nov 24 22:25:56 PST 2004
Author: illiminable
Date: 2004-11-24 22:25:55 -0800 (Wed, 24 Nov 2004)
New Revision: 8278
Added:
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/fish_cdecl.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/fish_cdecl.h
Modified:
trunk/oggdsf/docs/refactor.txt
trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.cpp
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.cpp
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.cpp
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/dsfSpeexEncoder.vcproj
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/speexencoderdllstuff.h
Log:
* Speex encoder moved to new abstracts.
Modified: trunk/oggdsf/docs/refactor.txt
===================================================================
--- trunk/oggdsf/docs/refactor.txt 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/docs/refactor.txt 2004-11-25 06:25:55 UTC (rev 8278)
@@ -29,10 +29,17 @@
Sort all the GUIDs and format blocks to a common place.
+Review media type naming convention... should the major type for the outputs of the mux be MEDIATYPE_OggPacket instead ?
+
+Change type of mUptoFrame everywhere to __int64
+
+Check use of mHR which is scattered about the enc/dec filters.
+
+Review the exposure of IMediaSeeking on encoders
+
+Find COM resource leak in encoders. (Probably to do with delegation of seeking)
+
DONE::::
Fix the leaks caused by the accept media types.
-Change type of mUptoFrame everywhere to __int64
-
-Check use of mHR which is scattered about the enc/dec filters.
\ No newline at end of file
Modified: trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln 2004-11-25 06:25:55 UTC (rev 8278)
@@ -125,10 +125,9 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsfSpeexEncoder", "..\..\src\lib\codecs\speex\filters\dsfSpeexEncoder\dsfSpeexEncoder.vcproj", "{419E0701-9C9A-4671-B3B6-79FA206DEE25}"
ProjectSection(ProjectDependencies) = postProject
{223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
- {4906E533-2864-4840-ABC1-00CD844623EB} = {4906E533-2864-4840-ABC1-00CD844623EB}
- {A882A968-3013-4A27-B653-E18CF5C791FE} = {A882A968-3013-4A27-B653-E18CF5C791FE}
{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}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtheora", "..\..\src\lib\codecs\theora\libs\libtheora\win32\libtheora\libtheora.vcproj", "{2394BCBD-BAE8-443F-A65C-6BFDDD42D7CA}"
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -37,7 +37,8 @@
#include "SpeexDecodeFilter.h"
extern "C" {
-#include <fishsound/fishsound.h>
+//#include <fishsound/fishsound.h>
+#include "fish_cdecl.h"
}
class SpeexDecodeOutputPin;
@@ -50,7 +51,8 @@
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
SpeexDecodeInputPin(AbstractTransformFilter* inFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes);
virtual ~SpeexDecodeInputPin(void);
- static int SpeexDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer);
+
+ static int __cdecl SpeexDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer);
virtual HRESULT SetMediaType(const CMediaType* inMediaType);
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/dsfSpeexDecoder.vcproj 2004-11-25 06:25:55 UTC (rev 8278)
@@ -28,7 +28,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
- CallingConvention="0"
+ CallingConvention="2"
DisableSpecificWarnings="4275"/>
<Tool
Name="VCCustomBuildTool"/>
@@ -90,7 +90,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -154,7 +154,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -218,7 +218,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -310,6 +310,9 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
+ RelativePath=".\fish_cdecl.h">
+ </File>
+ <File
RelativePath="SpeexDecodeFilter.h">
</File>
<File
Added: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/fish_cdecl.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/fish_cdecl.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexDecoder/fish_cdecl.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -0,0 +1,47 @@
+#include <fishsound/constants.h>
+typedef struct {
+ int samplerate;
+ int channels;
+ int format;
+} FishSoundInfo;
+typedef struct {
+ int format;
+ const char * name;
+ const char * extension;
+} FishSoundFormat;
+
+typedef void * FishSound;
+typedef int (__cdecl *FishSoundDecoded) (FishSound * fsound, float ** pcm,
+ long frames, void * user_data);
+typedef int (__cdecl *FishSoundEncoded) (FishSound * fsound, unsigned char * buf,
+ long bytes, void * user_data);
+int __cdecl fish_sound_identify (unsigned char * buf, long bytes);
+
+FishSound * __cdecl fish_sound_new (int mode, FishSoundInfo * fsinfo);
+
+int __cdecl fish_sound_set_decoded_callback (FishSound * fsound,
+ FishSoundDecoded decoded,
+ void * user_data);
+
+int __cdecl fish_sound_set_encoded_callback (FishSound * fsound,
+ FishSoundEncoded encoded,
+ void * user_data);
+
+long __cdecl fish_sound_decode (FishSound * fsound, unsigned char * buf, long bytes);
+
+long __cdecl fish_sound_encode (FishSound * fsound, float ** pcm, long frames);
+
+long __cdecl fish_sound_flush (FishSound * fsound);
+
+int __cdecl fish_sound_reset (FishSound * fsound);
+
+int __cdecl fish_sound_delete (FishSound * fsound);
+
+int __cdecl fish_sound_command (FishSound * fsound, int command, void * data,
+ int datasize);
+
+int __cdecl fish_sound_get_interleave (FishSound * fsound);
+
+int __cdecl fish_sound_set_interleave (FishSound * fsound, int interleave);
+
+long __cdecl fish_sound_get_frameno (FishSound * fsound);
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.cpp 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.cpp 2004-11-25 06:25:55 UTC (rev 8278)
@@ -32,7 +32,7 @@
#include "StdAfx.h"
-#include "Speexencodefilter.h"
+#include "SpeexEncodeFilter.h"
//COM Factory Template
@@ -40,10 +40,10 @@
{
{
L"Speex Encode Filter", // Name
- &CLSID_SpeexEncodeFilter, // CLSID
- SpeexEncodeFilter::CreateInstance, // Method to create an instance of MyComponent
- NULL, // Initialization function
- NULL // Set-up information (for filters)
+ &CLSID_SpeexEncodeFilter, // CLSID
+ SpeexEncodeFilter::CreateInstance, // Method to create an instance of MyComponent
+ NULL, // Initialization function
+ NULL // Set-up information (for filters)
}
};
@@ -62,7 +62,7 @@
}
SpeexEncodeFilter::SpeexEncodeFilter(void)
- : AbstractAudioEncodeFilter(NAME("Speex Encoder"), CLSID_SpeexEncodeFilter, AbstractAudioEncodeFilter::SPEEX)
+ : AbstractTransformFilter(NAME("Speex Encoder"), CLSID_SpeexEncodeFilter)
{
bool locWasConstructed = ConstructPins();
}
@@ -73,14 +73,34 @@
bool SpeexEncodeFilter::ConstructPins()
{
+ //Inputs Audio / PCM / WaveFormatEx
+ //Outputs Audio / Speex / Speex
- CMediaType* locOutputMediaType = new CMediaType(&MEDIATYPE_Audio);
- locOutputMediaType->subtype = MEDIASUBTYPE_Speex;
- locOutputMediaType->formattype = FORMAT_Speex;
+ //Vector to hold our set of media types we want to accept.
+ vector<CMediaType*> locAcceptableTypes;
+
+ //Setup the media types for the output pin.
+ CMediaType* locAcceptMediaType = new CMediaType(&MEDIATYPE_Audio); //Deleted in pin destructor
+ locAcceptMediaType->subtype = MEDIASUBTYPE_Speex;
+ locAcceptMediaType->formattype = FORMAT_Speex;
+
+ locAcceptableTypes.push_back(locAcceptMediaType);
+
//Output pin must be done first because it's passed to the input pin.
- mOutputPin = new SpeexEncodeOutputPin(this, m_pLock, locOutputMediaType);
+ mOutputPin = new SpeexEncodeOutputPin(this, m_pLock, locAcceptableTypes); //Deleted in base class destructor
+ //Clear out the vector, now we've already passed it to the output pin.
+ locAcceptableTypes.clear();
+
+ //Setup the media Types for the input pin.
+ locAcceptMediaType = NULL;
+ locAcceptMediaType = new CMediaType(&MEDIATYPE_Audio); //Deleted by pin
+
+ locAcceptMediaType->subtype = MEDIASUBTYPE_PCM;
+ locAcceptMediaType->formattype = FORMAT_WaveFormatEx;
+
+ locAcceptableTypes.push_back(locAcceptMediaType);
- mInputPin = new SpeexEncodeInputPin(this, m_pLock, mOutputPin);
+ mInputPin = new SpeexEncodeInputPin(this, m_pLock, mOutputPin, locAcceptableTypes); //Deleted in base class filter destructor.
return true;
}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeFilter.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -31,30 +31,39 @@
#pragma once
-#include "Speexencoderdllstuff.h"
-#include "AbstractAudioEncodeFilter.h"
+//Local Includes
+#include "speexencoderdllstuff.h"
+//External Includes
+#include "AbstractTransformFilter.h"
+
//Forward Declarations
struct sSpeexFormatBlock;
class SpeexEncodeInputPin;
class SpeexEncodeOutputPin;
class SpeexEncodeFilter
- : public AbstractAudioEncodeFilter
+ //Base Classes
+ : public AbstractTransformFilter
{
public:
-
+ //Friend Classes
friend class SpeexEncodeOutputPin;
friend class SpeexEncodeInputPin;
+
+ //Constructors
SpeexEncodeFilter(void);
virtual ~SpeexEncodeFilter(void);
+ //COM Creator function
static CUnknown* WINAPI SpeexEncodeFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
- //PURE VIRTUAL IMPLEMENTATION
+
+protected:
+ //Implementation of pure virtual from AbstractTransformFilter.
virtual bool ConstructPins();
-protected:
+ //Member data
sSpeexFormatBlock mSpeexFormatBlock;
};
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.cpp 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.cpp 2004-11-25 06:25:55 UTC (rev 8278)
@@ -30,11 +30,14 @@
//===========================================================================
#include "StdAfx.h"
-#include "Speexencodeinputpin.h"
+#include "SpeexEncodeInputPin.h"
-SpeexEncodeInputPin::SpeexEncodeInputPin(AbstractAudioEncodeFilter* inParentFilter, CCritSec* inFilterLock, AbstractAudioEncodeOutputPin* inOutputPin)
- : AbstractAudioEncodeInputPin(inParentFilter, inFilterLock, inOutputPin, NAME("SpeexEncodeInputPin"), L"PCM In")
+SpeexEncodeInputPin::SpeexEncodeInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes)
+ : AbstractTransformInputPin(inParentFilter, inFilterLock, inOutputPin, NAME("SpeexEncodeInputPin"), L"PCM In", inAcceptableMediaTypes)
, mFishSound(NULL)
+ , mWaveFormat(NULL)
+
+ , mUptoFrame(0)
{
//debugLog.open("C:\\temp\\speexenc.log", ios_base::out);
}
@@ -47,7 +50,7 @@
//PURE VIRTUALS
-long SpeexEncodeInputPin::encodeData(unsigned char* inBuf, long inNumBytes) {
+HRESULT SpeexEncodeInputPin::TransformData(unsigned char* inBuf, long inNumBytes) {
//TODO::: There is a problem when we get 8 bit samples.
//=====================================================
@@ -61,13 +64,7 @@
short locTempShort = 0;
float locTempFloat = 0;
- //__int64 locGranPos = 0;
- //Removed hack for gran pos
- //fish_sound_command(mFishSound, 8, &locGranPos, sizeof(__int64));
- //
- //locGranPos = fish_sound_get_frameno(mFishSound);
- //mUptoFrame = locGranPos;
- //__int64 locTemp = ((FishSoundSpeexInfo*)mFishSound->codec_data)->vd.pcm_returned;
+
for (int i = 0; i < inNumBytes; i += 2) {
locTempShort = *((short*)(inBuf + i));
locTempFloat = (float)locTempShort;
@@ -84,7 +81,7 @@
} else {
}
- return locErr;
+ return S_OK;
}
bool SpeexEncodeInputPin::ConstructCodec() {
mFishInfo.channels = mWaveFormat->nChannels;
@@ -118,7 +115,7 @@
int SpeexEncodeInputPin::SpeexEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer)
{
- //For convenience we do all these cast once and for all here.
+
SpeexEncodeInputPin* locThis = reinterpret_cast<SpeexEncodeInputPin*> (inThisPointer);
SpeexEncodeFilter* locFilter = reinterpret_cast<SpeexEncodeFilter*>(locThis->m_pFilter);
//locThis->debugLog << "SpeexEncoded called with "<<inNumBytes<< " byte of data"<<endl;
@@ -163,7 +160,7 @@
//NO - It alrady has a ref on it.
//TODO::: Need to propagate error states.
- HRESULT locHR = locThis->mOutputPin->mDataQueue->Receive(locSample); //->DownstreamFilter()->Receive(locSample);
+ HRESULT locHR = ((SpeexEncodeOutputPin*)(locThis->mOutputPin))->mDataQueue->Receive(locSample); //->DownstreamFilter()->Receive(locSample);
if (locHR != S_OK) {
//locThis->debugLog<<"Sample rejected"<<endl;
} else {
@@ -178,11 +175,25 @@
}
-HRESULT SpeexEncodeInputPin::SetMediaType(const CMediaType* inMediaType) {
- AbstractAudioEncodeInputPin::SetMediaType(inMediaType);
+HRESULT SpeexEncodeInputPin::SetMediaType(const CMediaType* inMediaType)
+{
+
+ if ( (inMediaType->subtype == MEDIASUBTYPE_PCM) &&
+ (inMediaType->formattype == FORMAT_WaveFormatEx)) {
+ mWaveFormat = (WAVEFORMATEX*)inMediaType->pbFormat;
+
+ } else {
+ //Failed... should never be here !
+ throw 0;
+ }
+ //This is here and not the constructor because we need audio params from the
+ // input pin to construct properly.
+
ConstructCodec();
- return S_OK;
+ return CBaseInputPin::SetMediaType(inMediaType);
+
+
}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -32,38 +32,40 @@
#pragma once
-#include "AbstractAudioEncodeInputPin.h"
+#include "AbstractTransformInputPin.h"
#include "SpeexEncodeInputPin.h"
#include "SpeexEncodeFilter.h"
extern "C" {
-#include <fishsound/fishsound.h>
-//#include <../src/libfishsound/private.h>
+//#include <fishsound/fishsound.h>
+#include "fish_cdecl.h"
}
//#include <fstream>
//using namespace std;
class SpeexEncodeInputPin
- : public AbstractAudioEncodeInputPin
+ : public AbstractTransformInputPin
{
public:
- SpeexEncodeInputPin(AbstractAudioEncodeFilter* inFilter, CCritSec* inFilterLock, AbstractAudioEncodeOutputPin* inOutputPin);
+ SpeexEncodeInputPin(AbstractTransformFilter* inFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes);
virtual ~SpeexEncodeInputPin(void);
- static int SpeexEncodeInputPin::SpeexEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
- //PURE VIRTUALS
- virtual long encodeData(unsigned char* inBuf, long inNumBytes);
- virtual bool ConstructCodec();
- virtual void DestroyCodec();
+ static int __cdecl SpeexEncodeInputPin::SpeexEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
+
virtual HRESULT SetMediaType(const CMediaType* inMediaType);
protected:
HRESULT mHR;
- //bool mBegun; //Already in base class stupid !
- //SpeexDecodeOutputPin* mOutputPin;
- //__int64 mUptoFrame;
+//PURE VIRTUALS
+ virtual HRESULT TransformData(unsigned char* inBuf, long inNumBytes);
+ virtual bool ConstructCodec();
+ virtual void DestroyCodec();
+
+ WAVEFORMATEX* mWaveFormat;
+ __int64 mUptoFrame;
+
//fstream debugLog;
FishSound* mFishSound;
FishSoundInfo mFishInfo;
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.cpp 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.cpp 2004-11-25 06:25:55 UTC (rev 8278)
@@ -32,8 +32,8 @@
#include "StdAfx.h"
#include "Speexencodeoutputpin.h"
-SpeexEncodeOutputPin::SpeexEncodeOutputPin(SpeexEncodeFilter* inParentFilter,CCritSec* inFilterLock, CMediaType* inOutputMediaType)
- : AbstractAudioEncodeOutputPin(inParentFilter, inFilterLock,NAME("SpeexDecodeOutputPin"), L"Speex Out", inOutputMediaType)
+SpeexEncodeOutputPin::SpeexEncodeOutputPin(SpeexEncodeFilter* inParentFilter,CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes)
+ : AbstractTransformOutputPin(inParentFilter, inFilterLock,NAME("SpeexDecodeOutputPin"), L"Speex Out", 65536, 5, inAcceptableMediaTypes)
{
}
@@ -41,11 +41,23 @@
{
}
-bool SpeexEncodeOutputPin::FillFormatBuffer(BYTE* inFormatBuffer) {
- SpeexEncodeFilter* locParentFilter = (SpeexEncodeFilter*)mParentFilter;
- memcpy((void*)inFormatBuffer, (const void*) &(locParentFilter->mSpeexFormatBlock), sizeof(sSpeexFormatBlock));
- return true;
+HRESULT SpeexEncodeOutputPin::CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition)
+{
+ if (inPosition == 0) {
+ sSpeexFormatBlock* locSpeexFormat = (sSpeexFormatBlock*)outMediaType->AllocFormatBuffer(sizeof(sSpeexFormatBlock));
+ //TODO::: Check for null ?
+
+ memcpy((void*)locSpeexFormat, (const void*) &(((SpeexEncodeFilter*)mParentFilter)->mSpeexFormatBlock), sizeof(sSpeexFormatBlock));
+ return S_OK;
+ } else {
+ return S_FALSE;
+ }
}
-unsigned long SpeexEncodeOutputPin::FormatBufferSize() {
- return sizeof(sSpeexFormatBlock);
-}
+//bool SpeexEncodeOutputPin::FillFormatBuffer(BYTE* inFormatBuffer) {
+// SpeexEncodeFilter* locParentFilter = (SpeexEncodeFilter*)mParentFilter;
+// memcpy((void*)inFormatBuffer, (const void*) &(locParentFilter->mSpeexFormatBlock), sizeof(sSpeexFormatBlock));
+// return true;
+//}
+//unsigned long SpeexEncodeOutputPin::FormatBufferSize() {
+// return sizeof(sSpeexFormatBlock);
+//}
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeOutputPin.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -31,24 +31,28 @@
#pragma once
+//Local Includes
#include "Speexencoderdllstuff.h"
-#include "AbstractAudioEncodeOutputPin.h"
+//External Includes
+#include "AbstractTransformOutputPin.h"
+
+//Forward Declarations
class SpeexEncodeFilter;
struct sSpeexFormatBlock;
class SpeexEncodeOutputPin
- : public AbstractAudioEncodeOutputPin
+ //Base Classes
+ : public AbstractTransformOutputPin
{
public:
- SpeexEncodeOutputPin(SpeexEncodeFilter* inParentFilter, CCritSec* inFilterLock, CMediaType* inOutputMediaType);
+ //Friend Classes
+ friend class SpeexEncodeInputPin;
+
+ //Constructors
+ SpeexEncodeOutputPin(SpeexEncodeFilter* inParentFilter, CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes);
virtual ~SpeexEncodeOutputPin(void);
- //PURE VIRTUAL IMPLEMENTATION
- virtual bool FillFormatBuffer(BYTE* inFormatBuffer);
- virtual unsigned long FormatBufferSize();
-
-
protected:
-
+ virtual HRESULT CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition);
};
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/dsfSpeexEncoder.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/dsfSpeexEncoder.vcproj 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/dsfSpeexEncoder.vcproj 2004-11-25 06:25:55 UTC (rev 8278)
@@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\dsfAbstractAudioEncoder;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32;..\..\..\..\core\directshow\dsfSeeking"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFSPEEXENCODER_EXPORTS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@@ -28,7 +28,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -80,7 +80,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
- AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\dsfAbstractAudioEncoder;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32;..\..\..\..\core\directshow\dsfSeeking"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXENCODER_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -89,7 +89,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -143,7 +143,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
- AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\dsfAbstractAudioEncoder;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32;..\..\..\..\core\directshow\dsfSeeking"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXENCODER_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -153,7 +153,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -207,7 +207,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
- AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\dsfAbstractAudioEncoder;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32;..\..\..\..\core\directshow\dsfSeeking"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\..\core\ogg\libOOOgg;..\..\..\helper\libfishsound\include;..\..\..\helper\libfishsound\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFSPEEXENCODER_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -217,7 +217,7 @@
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
- CallingConvention="0"/>
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -309,6 +309,9 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
+ RelativePath=".\fish_cdecl.h">
+ </File>
+ <File
RelativePath="SpeexEncodeFilter.h">
</File>
<File
Added: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/fish_cdecl.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/fish_cdecl.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/fish_cdecl.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -0,0 +1,47 @@
+#include <fishsound/constants.h>
+typedef struct {
+ int samplerate;
+ int channels;
+ int format;
+} FishSoundInfo;
+typedef struct {
+ int format;
+ const char * name;
+ const char * extension;
+} FishSoundFormat;
+
+typedef void * FishSound;
+typedef int (__cdecl *FishSoundDecoded) (FishSound * fsound, float ** pcm,
+ long frames, void * user_data);
+typedef int (__cdecl *FishSoundEncoded) (FishSound * fsound, unsigned char * buf,
+ long bytes, void * user_data);
+int __cdecl fish_sound_identify (unsigned char * buf, long bytes);
+
+FishSound * __cdecl fish_sound_new (int mode, FishSoundInfo * fsinfo);
+
+int __cdecl fish_sound_set_decoded_callback (FishSound * fsound,
+ FishSoundDecoded decoded,
+ void * user_data);
+
+int __cdecl fish_sound_set_encoded_callback (FishSound * fsound,
+ FishSoundEncoded encoded,
+ void * user_data);
+
+long __cdecl fish_sound_decode (FishSound * fsound, unsigned char * buf, long bytes);
+
+long __cdecl fish_sound_encode (FishSound * fsound, float ** pcm, long frames);
+
+long __cdecl fish_sound_flush (FishSound * fsound);
+
+int __cdecl fish_sound_reset (FishSound * fsound);
+
+int __cdecl fish_sound_delete (FishSound * fsound);
+
+int __cdecl fish_sound_command (FishSound * fsound, int command, void * data,
+ int datasize);
+
+int __cdecl fish_sound_get_interleave (FishSound * fsound);
+
+int __cdecl fish_sound_set_interleave (FishSound * fsound, int interleave);
+
+long __cdecl fish_sound_get_frameno (FishSound * fsound);
Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/speexencoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/speexencoderdllstuff.h 2004-11-25 05:17:42 UTC (rev 8277)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/speexencoderdllstuff.h 2004-11-25 06:25:55 UTC (rev 8278)
@@ -31,15 +31,6 @@
#pragma once
-
-#ifdef DSFABSTRACOGGAUDIODECODER_EXPORTS
-#pragma message("----> Exporting from Abstract Library...")
-#define ABS_AUDIO_DEC_API __declspec(dllexport)
-#else
-#pragma message("<---- Importing from Abstract Library...")
-#define ABS_AUDIO_DEC_API __declspec(dllimport)
-#endif
-
struct sSpeexFormatBlock {
unsigned long speexVersion;
unsigned long samplesPerSec;
@@ -49,9 +40,9 @@
unsigned long numChannels;
};
-#include "AbstractAudioEncodeFilter.h"
-#include "AbstractAudioEncodeInputPin.h"
-#include "AbstractAudioEncodeOutputPin.h"
+#include "AbstractTransformFilter.h"
+#include "AbstractTransformInputPin.h"
+#include "AbstractTransformOutputPin.h"
#include "SpeexEncodeInputPin.h"
#include "SpeexEncodeOutputPin.h"
#include "SpeexEncodeFilter.h"
More information about the commits
mailing list