00001 //=========================================================================== 00002 //Copyright (C) 2003, 2004 Zentaro Kavanagh 00003 // 00004 //Redistribution and use in source and binary forms, with or without 00005 //modification, are permitted provided that the following conditions 00006 //are met: 00007 // 00008 //- Redistributions of source code must retain the above copyright 00009 // notice, this list of conditions and the following disclaimer. 00010 // 00011 //- Redistributions in binary form must reproduce the above copyright 00012 // notice, this list of conditions and the following disclaimer in the 00013 // documentation and/or other materials provided with the distribution. 00014 // 00015 //- Neither the name of Zentaro Kavanagh nor the names of contributors 00016 // may be used to endorse or promote products derived from this software 00017 // without specific prior written permission. 00018 // 00019 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00022 //PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR 00023 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00024 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00025 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 //=========================================================================== 00031 00032 #pragma once 00033 #include <vector> 00034 #include <fstream> 00035 using namespace std; 00036 #include "vorbisdecoderdllstuff.h" 00037 #include "AbstractTransformInputPin.h" 00038 #include "VorbisDecodeInputPin.h" 00039 00040 #include "VorbisDecodeFilter.h" 00041 00042 extern "C" { 00043 //#include <fishsound/fishsound.h> 00044 #include "fish_cdecl.h" 00045 } 00046 00047 class VorbisDecodeOutputPin; 00048 00049 class VorbisDecodeInputPin 00050 : public AbstractTransformInputPin 00051 { 00052 public: 00053 00054 DECLARE_IUNKNOWN 00055 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); 00056 VorbisDecodeInputPin(AbstractTransformFilter* inFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes); 00057 virtual ~VorbisDecodeInputPin(void); 00058 static int __cdecl VorbisDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer); 00059 00060 virtual HRESULT SetMediaType(const CMediaType* inMediaType); 00061 00062 virtual STDMETHODIMP NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate); 00063 00064 00065 protected: 00066 //fstream debugLog; 00067 00068 00069 00070 //Implementation of virtuals from AbstractTransform Filter 00071 virtual bool ConstructCodec(); 00072 virtual void DestroyCodec(); 00073 virtual HRESULT TransformData(unsigned char* inBuf, long inNumBytes); 00074 00075 HRESULT mHR; 00076 bool mBegun; 00077 00078 FishSound* mFishSound; 00079 FishSoundInfo mFishInfo; 00080 00081 int mNumChannels; 00082 int mFrameSize; 00083 int mSampleRate; 00084 unsigned int mUptoFrame; 00085 00086 }; 00087 00088 00089 //Old imp 00090 //************************************************************ 00091 //#pragma once 00092 //#include <fstream> 00093 //using namespace std; 00094 //#include "vorbisdecoderdllstuff.h" 00095 //#include "AbstractAudioDecodeInputPin.h" 00096 //#include "VorbisDecodeInputPin.h" 00097 // 00098 //#include "VorbisDecodeFilter.h" 00099 // 00100 //extern "C" { 00102 //#include "fish_cdecl.h" 00103 //} 00104 // 00105 //class VorbisDecodeOutputPin; 00106 // 00107 //class VorbisDecodeInputPin 00108 // : public AbstractAudioDecodeInputPin 00109 //{ 00110 //public: 00111 // 00112 // DECLARE_IUNKNOWN 00113 // STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); 00114 // VorbisDecodeInputPin(AbstractAudioDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractAudioDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType); 00115 // virtual ~VorbisDecodeInputPin(void); 00116 // static int __cdecl VorbisDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer); 00117 // 00118 // virtual HRESULT SetMediaType(const CMediaType* inMediaType); 00119 // 00120 // //VIRTUAL FUNCTIONS - AbstractAudioDecodeInputPin 00121 // //FIX:::These should be protected. 00122 // virtual bool ConstructCodec(); 00123 // virtual void DestroyCodec(); 00124 // 00125 // long decodeData(unsigned char* inBuf, long inNumBytes); 00126 // 00127 //protected: 00128 // 00129 // HRESULT mHR; 00130 // bool mBegun; 00131 // 00132 // FishSound* mFishSound; 00133 // FishSoundInfo mFishInfo; 00134 // 00135 //};