[xiph-commits] r10809 - in trunk/oggdsf/src/lib/codecs: . RawAudio
RawAudio/dsfOggRawAudioExtractor RawAudio/dsfOggRawAudioInserter
illiminable at svn.xiph.org
illiminable at svn.xiph.org
Sun Feb 12 14:01:59 PST 2006
Author: illiminable
Date: 2006-02-12 14:01:22 -0800 (Sun, 12 Feb 2006)
New Revision: 10809
Added:
trunk/oggdsf/src/lib/codecs/RawAudio/
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/dsfOggRawAudioExtractor.vcproj
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractor.def
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/dsfOggRawAudioInserter.vcproj
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserter.def
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.h
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.cpp
trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.h
Log:
* Merge oggpcm encode and decode filters
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,321 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "StdAfx.h"
+#include "OggRawAudioExtractorFilter.h"
+
+
+
+//COM Factory Template
+CFactoryTemplate g_Templates[] =
+{
+ {
+ L"Ogg Raw Audio Extractor Filter", // Name
+ &CLSID_OggRawAudioExtractorFilter, // CLSID
+ OggRawAudioExtractorFilter::CreateInstance, // Method to create an instance of Speex Decoder
+ NULL, // Initialization function
+ NULL // Set-up information (for filters)
+ }
+
+};
+
+// Generic way of determining the number of items in the template
+int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+
+OggRawAudioExtractorFilter::OggRawAudioExtractorFilter()
+ : CTransformFilter(NAME("Ogg Raw Audio Extractor"), NULL, CLSID_OggRawAudioExtractorFilter)
+ , mInputPin(NULL)
+ , mOutputPin(NULL)
+
+ , mWorkingBuff(NULL)
+ , mBytesBuffered(0)
+
+ , mSegStart(0)
+ , mSegEnd(0)
+ , mSegRate(0)
+
+{
+ mWorkingBuff = new unsigned char[1<<20]; //1 meg
+
+}
+
+
+
+OggRawAudioExtractorFilter::~OggRawAudioExtractorFilter(void)
+{
+ delete[] mWorkingBuff;
+}
+
+CUnknown* WINAPI OggRawAudioExtractorFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
+{
+ //This routine is the COM implementation to create a new Filter
+ OggRawAudioExtractorFilter *pNewObject = new OggRawAudioExtractorFilter();
+ if (pNewObject == NULL) {
+ *pHr = E_OUTOFMEMORY;
+ }
+ return pNewObject;
+}
+
+HRESULT OggRawAudioExtractorFilter::CheckInputType(const CMediaType* inMediaType)
+{
+ return mInputPin->CheckMediaType(inMediaType);
+}
+HRESULT OggRawAudioExtractorFilter::CheckTransform(const CMediaType* inInputMediaType, const CMediaType* inOutputMediaType)
+{
+
+ return S_OK;
+}
+HRESULT OggRawAudioExtractorFilter::DecideBufferSize(IMemAllocator* inAllocator, ALLOCATOR_PROPERTIES* inPropertyRequest)
+{
+ HRESULT locHR = S_OK;
+
+ ALLOCATOR_PROPERTIES locReqAlloc;
+ ALLOCATOR_PROPERTIES locActualAlloc;
+
+ if (inPropertyRequest->cbAlign <= 0) {
+ locReqAlloc.cbAlign = 1;
+ } else {
+ locReqAlloc.cbAlign = inPropertyRequest->cbAlign;
+ }
+
+
+ if (inPropertyRequest->cbBuffer == 0) {
+ locReqAlloc.cbBuffer = 65536*16;
+ } else {
+ locReqAlloc.cbBuffer = inPropertyRequest->cbBuffer;
+ }
+
+
+ if (inPropertyRequest->cbPrefix < 0) {
+ locReqAlloc.cbPrefix = 0;
+ } else {
+ locReqAlloc.cbPrefix = inPropertyRequest->cbPrefix;
+ }
+
+ if (inPropertyRequest->cBuffers == 0) {
+ locReqAlloc.cBuffers = 5;
+ } else {
+ locReqAlloc.cBuffers = inPropertyRequest->cBuffers;
+ }
+
+
+ locHR = inAllocator->SetProperties(&locReqAlloc, &locActualAlloc);
+
+ if (locHR != S_OK) {
+ //TODO::: Handle a fail state here.
+ return locHR;
+ } else {
+ //TODO::: Need to save this pointer to decommit in destructor ???
+ locHR = inAllocator->Commit();
+
+
+ return locHR;
+ }
+
+}
+
+HRESULT OggRawAudioExtractorFilter::NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate)
+{
+ mSegStart = inStartTime;
+ mSegEnd = inStopTime;
+ mSegRate = inRate;
+ return CTransformFilter::NewSegment(inStartTime, inStopTime, inRate);
+}
+HRESULT OggRawAudioExtractorFilter::GetMediaType(int inPosition, CMediaType* outMediaType)
+{
+
+ if (inPosition < 0) {
+ return E_INVALIDARG;
+ }
+
+ if ((inPosition == 0) && (mInputPin != NULL) && (mInputPin->IsConnected())) {
+
+ WAVEFORMATEX* locWaveFormat = (WAVEFORMATEX*)outMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ //*locVideoFormat = *mInputPin->getVideoFormatBlock();
+
+ sOggRawAudioFormatBlock locOggFormat = mInputPin->getFormatBlock();
+ locWaveFormat->wFormatTag = WAVE_FORMAT_PCM;
+ locWaveFormat->nChannels = locOggFormat.numChannels;
+ locWaveFormat->nSamplesPerSec = locOggFormat.samplesPerSec;
+ locWaveFormat->wBitsPerSample = locOggFormat.bitsPerSample;
+ locWaveFormat->nBlockAlign = (locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3);
+ locWaveFormat->nAvgBytesPerSec = ((locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3)) * locWaveFormat->nSamplesPerSec;
+ locWaveFormat->cbSize = 0;
+
+ outMediaType->majortype = MEDIATYPE_Audio;
+ outMediaType->subtype = MEDIASUBTYPE_PCM;
+ outMediaType->formattype = FORMAT_WaveFormatEx;
+
+ return S_OK;
+ } else {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+
+}
+
+HRESULT OggRawAudioExtractorFilter::Receive(IMediaSample* inSample)
+{
+ BYTE* locInBuff = NULL;
+ HRESULT locHR = inSample->GetPointer(&locInBuff);
+
+ if (locHR == S_OK) {
+ REFERENCE_TIME locStart = -1;
+ REFERENCE_TIME locEnd = -1;
+ inSample->GetTime(&locStart, &locEnd);
+ if (locEnd == 0) {
+ return S_OK;
+ }
+
+ memcpy((void*)&mWorkingBuff[mBytesBuffered], (const void*)locInBuff, inSample->GetActualDataLength());
+ mBytesBuffered += inSample->GetActualDataLength();
+
+
+
+ if (locEnd > 0) {
+ //Can dump it all downstream now
+ IMediaSample* locSample;
+ unsigned long locSampleDuration = 0;
+ unsigned long locBytesCopied = 0;
+ unsigned long locBytesToCopy = 0;
+ unsigned long locSampleRate = mInputPin->getFormatBlock().samplesPerSec;
+ unsigned long locFrameSize = (mInputPin->getFormatBlock().bitsPerSample * mInputPin->getFormatBlock().numChannels) >> 3;
+
+ locStart = mInputPin->convertGranuleToTime(locEnd) - (((mBytesBuffered / locFrameSize) * UNITS) / locSampleRate);
+ do {
+ //HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, NULL, NULL, NULL);
+ HRESULT locHR = InitializeOutputSample(inSample, &locSample);
+ if (locHR != S_OK) {
+ return locHR;
+ }
+
+ BYTE* locBuffer = NULL;
+ locHR = locSample->GetPointer(&locBuffer);
+
+ if (locHR != S_OK) {
+ return locHR;
+ }
+
+ locBytesToCopy = ((mBytesBuffered - locBytesCopied) <= locSample->GetSize()) ? (mBytesBuffered - locBytesCopied) : locSample->GetSize();
+ //locBytesCopied += locBytesToCopy;
+
+ locSampleDuration = (((locBytesToCopy/locFrameSize) * UNITS) / locSampleRate);
+ locEnd = locStart + locSampleDuration;
+
+ //Adjust the time stamps for rate and seeking
+ REFERENCE_TIME locAdjustedStart = locStart; //(locStart * RATE_DENOMINATOR) / mRateNumerator;
+ REFERENCE_TIME locAdjustedEnd = locEnd; //(locEnd * RATE_DENOMINATOR) / mRateNumerator;
+ locAdjustedStart -= mSegStart;
+ locAdjustedEnd -= mSegStart;
+
+ __int64 locSeekStripOffset = 0;
+ if (locAdjustedEnd < 0) {
+ locSample->Release();
+ } else {
+ if (locAdjustedStart < 0) {
+ locSeekStripOffset = (-locAdjustedStart) * locSampleRate;
+ locSeekStripOffset *= locFrameSize;
+ locSeekStripOffset /= UNITS;
+ locSeekStripOffset += (locFrameSize - (locSeekStripOffset % locFrameSize));
+ __int64 locStrippedDuration = (((locSeekStripOffset/locFrameSize) * UNITS) / locSampleRate);
+ locAdjustedStart += locStrippedDuration;
+ }
+
+
+
+
+ memcpy((void*)locBuffer, (const void*)&mWorkingBuff[locBytesCopied + locSeekStripOffset], locBytesToCopy - locSeekStripOffset);
+
+ locSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
+ locSample->SetMediaTime(&locStart, &locEnd);
+ locSample->SetSyncPoint(TRUE);
+ locSample->SetActualDataLength(locBytesToCopy - locSeekStripOffset);
+ locHR = mOutputPin->Deliver(locSample); //((SpeexDecodeOutputPin*)(mOutputPin))->mDataQueue->Receive(locSample);
+ locSample->Release();
+ if (locHR != S_OK) {
+ return locHR;
+ }
+ locStart += locSampleDuration;
+
+ }
+ locBytesCopied += locBytesToCopy;
+
+
+ } while(locBytesCopied < mBytesBuffered);
+
+ mBytesBuffered = 0;
+
+ }
+
+ return S_OK;
+
+ }
+
+ return S_FALSE;
+
+}
+
+HRESULT OggRawAudioExtractorFilter::Transform(IMediaSample* inInputSample, IMediaSample* inOutputSample)
+{
+
+ return E_NOTIMPL;
+}
+
+CBasePin* OggRawAudioExtractorFilter::GetPin(int inPinNo)
+{
+
+ HRESULT locHR = S_OK;
+
+ // Create an input pin if necessary
+
+ if (m_pInput == NULL) {
+
+ m_pInput = new OggRawAudioExtractorInputPin(this, &locHR); //Deleted in base destructor
+
+
+ mInputPin = (OggRawAudioExtractorInputPin*)m_pInput;
+ m_pOutput = new CTransformOutputPin(NAME("PCM Out"), this, &locHR, L"PCM Out"); //Deleted in base destructor
+ mOutputPin = m_pOutput;
+
+
+ }
+
+ // Return the pin
+
+ if (inPinNo == 0) {
+ return m_pInput;
+ } else if (inPinNo == 1) {
+ return m_pOutput;
+ } else {
+ return NULL;
+ }
+
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorFilter.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,82 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+//Include Files
+#include "oggrawaudioextractordllstuff.h"
+#include "OggRawAudioExtractorInputPin.h"
+#include <libilliCore/iBE_Math.h>
+
+//Forward Declarations
+struct sOggRawAudioFormatBlock;
+class OggRawAudioExtractorInputPin;
+class OggRawAudioExtractorOutputPin;
+
+//Class Interface
+class OggRawAudioExtractorFilter
+ //Base Classes
+ : public CTransformFilter
+{
+public:
+
+ //Constructors and Destructors
+ OggRawAudioExtractorFilter(void);
+ virtual ~OggRawAudioExtractorFilter(void);
+
+ //COM Creator Function
+ static CUnknown* WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
+
+ virtual HRESULT CheckInputType(const CMediaType* inMediaType);
+ virtual HRESULT CheckTransform(const CMediaType* inInputMediaType, const CMediaType* inOutputMediaType);
+ virtual HRESULT DecideBufferSize(IMemAllocator* inAllocator, ALLOCATOR_PROPERTIES* inPropInputRequest);
+ virtual HRESULT GetMediaType(int iPosition, CMediaType* outMediaType);
+ virtual HRESULT Transform(IMediaSample* inInputSample, IMediaSample* inOutputSample);
+
+ virtual HRESULT Receive(IMediaSample* inSample);
+
+ virtual HRESULT NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
+
+ virtual CBasePin* GetPin(int inPinNo);
+
+
+protected:
+
+ OggRawAudioExtractorInputPin* mInputPin;
+ CTransformOutputPin* mOutputPin;
+
+ unsigned char* mWorkingBuff;
+ unsigned long mBytesBuffered;
+
+ __int64 mSegStart;
+ __int64 mSegEnd;
+ double mSegRate;
+
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,192 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+#include "OggRawAudioExtractorInputPin.h"
+
+OggRawAudioExtractorInputPin::OggRawAudioExtractorInputPin(OggRawAudioExtractorFilter* inParentFilter, HRESULT* outHR)
+ : CTransformInputPin(NAME("OggAudioExtractorInputPin"), inParentFilter, outHR, L"Ogg Raw Audio In")
+
+ , mSetupState(VSS_SEEN_NOTHING)
+{
+
+}
+
+OggRawAudioExtractorInputPin::~OggRawAudioExtractorInputPin(void)
+{
+
+}
+
+STDMETHODIMP OggRawAudioExtractorInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
+{
+ if (riid == IID_IMediaSeeking) {
+ *ppv = (IMediaSeeking*)this;
+ ((IUnknown*)*ppv)->AddRef();
+ return NOERROR;
+ } else if (riid == IID_IOggDecoder) {
+ *ppv = (IOggDecoder*)this;
+ //((IUnknown*)*ppv)->AddRef();
+ return NOERROR;
+
+ }
+
+ return CBaseInputPin::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT OggRawAudioExtractorInputPin::SetMediaType(const CMediaType* inMediaType)
+{
+ //FIX:::Error checking
+ //RESOLVED::: Bit better.
+ if (CheckMediaType(inMediaType) == S_OK) {
+ //((OGMDecodeFilter*)m_pFilter)->setOGMFormat(inMediaType->pbFormat);
+
+ } else {
+ throw 0;
+ }
+ return CBaseInputPin::SetMediaType(inMediaType);
+
+}
+
+HRESULT OggRawAudioExtractorInputPin::CheckMediaType(const CMediaType *inMediaType)
+{
+ if ( (inMediaType->majortype == MEDIATYPE_OggPacketStream)
+ && (inMediaType->subtype == MEDIASUBTYPE_None)
+ && (inMediaType->formattype == FORMAT_OggIdentHeader)) {
+ if (inMediaType->cbFormat == OGG_RAW_AUDIO_IDENT_HEADER_SIZE) {
+ if (strncmp((char*)inMediaType->pbFormat, "PCM ", 8) == 0) {
+ //TODO::: Possibly verify version
+ return S_OK;
+ }
+ }
+ }
+ return S_FALSE;
+
+}
+HRESULT OggRawAudioExtractorInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps)
+{
+ outRequestedProps->cbBuffer = 65536;
+ outRequestedProps->cBuffers = OGG_RAW_AUDIO_NUM_BUFFERS;
+ outRequestedProps->cbAlign = 1;
+ outRequestedProps->cbPrefix = 0;
+
+ return S_OK;
+}
+LOOG_INT64 OggRawAudioExtractorInputPin::convertGranuleToTime(LOOG_INT64 inGranule)
+{
+ return (inGranule * UNITS) / mFormatBlock.samplesPerSec;
+}
+
+LOOG_INT64 OggRawAudioExtractorInputPin::mustSeekBefore(LOOG_INT64 inGranule)
+{
+ //TODO::: Get adjustment from block size info... for now, it doesn't matter if no preroll
+ return inGranule;
+}
+IOggDecoder::eAcceptHeaderResult OggRawAudioExtractorInputPin::showHeaderPacket(OggPacket* inCodecHeaderPacket)
+{
+ switch (mSetupState) {
+ case VSS_SEEN_NOTHING:
+ if (strncmp((char*)inCodecHeaderPacket->packetData(), "PCM ", 8) == 0) {
+ handleHeaderPacket(inCodecHeaderPacket);
+ mSetupState = VSS_SEEN_BOS;
+ return IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+ }
+ mSetupState = VSS_ERROR;
+ return IOggDecoder::AHR_INVALID_HEADER;
+
+ case VSS_SEEN_BOS:
+ //TODO::: Handle extra headers
+ mSetupState = VSS_ALL_HEADERS_SEEN;
+ return IOggDecoder::AHR_ALL_HEADERS_RECEIVED;
+
+ //return IOggDecoder::AHR_INVALID_HEADER;
+
+
+ case VSS_ALL_HEADERS_SEEN:
+ case VSS_ERROR:
+ default:
+ return IOggDecoder::AHR_UNEXPECTED;
+ }
+}
+
+
+
+bool OggRawAudioExtractorInputPin::handleHeaderPacket(OggPacket* inHeaderPack)
+{
+
+ //mVideoFormatBlock = new VIDEOINFOHEADER;
+
+ mFormatBlock.samplesPerSec = iBE_Math::charArrToULong(inHeaderPack->packetData() + 16);
+ mFormatBlock.maxFramesPerPacket = iBE_Math::charArrToULong(inHeaderPack->packetData() + 22) >> 16;
+ mFormatBlock.numChannels = inHeaderPack->packetData()[21];
+ mFormatBlock.numHeaders = iBE_Math::charArrToULong(inHeaderPack->packetData() + 24);
+
+ switch(iBE_Math::charArrToULong(inHeaderPack->packetData() + 12)) {
+ case FMT_S8:
+ case FMT_U8:
+ mFormatBlock.bitsPerSample = 8;
+ break;
+ case FMT_S16_LE:
+ case FMT_S16_BE:
+ mFormatBlock.bitsPerSample = 16;
+ break;
+
+ default:
+ throw 0;
+
+ //case FMT_S24_LE,
+ //case FMT_S24_BE,
+ //case FMT_S32_LE,
+ //case FMT_S32_BE,
+
+ //case FMT_ULAW = 0x10,
+ //case FMT_ALAW,
+
+ //case FMT_FLT32_LE = 0x20,
+ //case FMT_FLT32_BE,
+ //case FMT_FLT64_LE,
+ //case FMT_FLT64_BE,
+
+ }
+
+
+
+ return true;
+}
+string OggRawAudioExtractorInputPin::getCodecShortName()
+{
+ return "Ogg Raw Audio";
+}
+string OggRawAudioExtractorInputPin::getCodecIdentString()
+{
+ //TODO:::
+ return "Ogg Raw Audio";
+}
+
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorInputPin.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,75 @@
+#pragma once
+
+#include "oggrawaudioextractordllstuff.h"
+#include "IOggDecoder.h"
+
+class OggRawAudioExtractorFilter;
+
+class OggRawAudioExtractorInputPin
+ : public CTransformInputPin
+ , public IOggDecoder
+{
+public:
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
+
+ OggRawAudioExtractorInputPin(OggRawAudioExtractorFilter* inParent, HRESULT* outHR);
+ virtual ~OggRawAudioExtractorInputPin(void);
+
+ virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
+ virtual HRESULT SetMediaType(const CMediaType* inMediaType);
+ virtual HRESULT CheckMediaType(const CMediaType *inMediaType);
+
+
+
+ //IOggDecoder Interface
+ virtual LOOG_INT64 convertGranuleToTime(LOOG_INT64 inGranule);
+ virtual LOOG_INT64 mustSeekBefore(LOOG_INT64 inGranule);
+ virtual IOggDecoder::eAcceptHeaderResult showHeaderPacket(OggPacket* inCodecHeaderPacket);
+ virtual string getCodecShortName();
+ virtual string getCodecIdentString();
+
+
+ sOggRawAudioFormatBlock getFormatBlock() {return mFormatBlock; }
+protected:
+ enum eOggRawAudioSetupState {
+ VSS_SEEN_NOTHING,
+ VSS_SEEN_BOS,
+ VSS_SEEN_COMMENT,
+ VSS_ALL_HEADERS_SEEN,
+ VSS_ERROR
+ };
+
+ eOggRawAudioSetupState mSetupState;
+ bool handleHeaderPacket(OggPacket* inHeaderPack);
+
+ sOggRawAudioFormatBlock mFormatBlock;
+
+
+ static const unsigned long OGG_RAW_AUDIO_IDENT_HEADER_SIZE = 28;
+ static const unsigned long OGG_RAW_AUDIO_NUM_BUFFERS = 50;
+
+
+ enum eRawAudioFormat {
+ FMT_S8,
+ FMT_U8,
+ FMT_S16_LE,
+ FMT_S16_BE,
+ FMT_S24_LE,
+ FMT_S24_BE,
+ FMT_S32_LE,
+ FMT_S32_BE,
+
+ FMT_ULAW = 0x10,
+ FMT_ALAW,
+
+ FMT_FLT32_LE = 0x20,
+ FMT_FLT32_BE,
+ FMT_FLT64_LE,
+ FMT_FLT64_BE,
+
+
+ };
+
+
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,41 @@
+#include ".\oggrawaudioextractoroutputpin.h"
+
+OggRawAudioExtractorOutputPin::OggRawAudioExtractorOutputPin(OggRawAudioExtractorFilter* inParentFilter)
+ : CTransformOutputPin(NAME("PCMOut"), inParentFilter, &mHR, L"PCM Out Pin")
+ , mDataQueue(NULL)
+ , mHR(S_OK)
+{
+}
+
+OggRawAudioExtractorOutputPin::~OggRawAudioExtractorOutputPin(void)
+{
+ delete mDataQueue;
+}
+HRESULT OggRawAudioExtractorOutputPin::CompleteConnect(IPin *inReceivePin)
+{
+ CAutoLock locLock(m_pLock);
+
+
+ HRESULT locHR = S_OK;
+ mDataQueue = new COutputQueue (inReceivePin, &locHR, FALSE, FALSE, 1, TRUE, 50); //Deleted in destructor
+
+ if (FAILED(locHR)) {
+ //Handle data Q failure
+
+ }
+
+ return CTransformOutputPin::CompleteConnect(inReceivePin);
+}
+
+HRESULT OggRawAudioExtractorOutputPin::BreakConnect(void)
+{
+ CAutoLock locLock(m_pLock);
+
+ delete mDataQueue;
+ mDataQueue = NULL;
+
+ HRESULT locHR = CBaseOutputPin::BreakConnect();
+
+
+ return locHR;
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/OggRawAudioExtractorOutputPin.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,17 @@
+#pragma once
+#include "oggrawaudioextractordllstuff.h"
+class OggRawAudioExtractorOutputPin
+ : public CTransformOutputPin
+{
+public:
+ friend class OggRawAudioExtractorFilter;
+ OggRawAudioExtractorOutputPin(OggRawAudioExtractorFilter* inParentFilter);
+ virtual ~OggRawAudioExtractorOutputPin(void);
+
+ HRESULT CompleteConnect(IPin *inReceivePin);
+ HRESULT BreakConnect(void);
+
+protected:
+ COutputQueue* mDataQueue;
+ HRESULT mHR;
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/dsfOggRawAudioExtractor.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/dsfOggRawAudioExtractor.vcproj 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/dsfOggRawAudioExtractor.vcproj 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="dsfOggRawAudioExtractor"
+ ProjectGUID="{20DC77C5-8396-4C6D-A805-959CF8DFABB3}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\core\directshow\dsfOggDemux2; ..\..\..\core\ogg;..\..\..\helper"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFOGGRAWAUDIOEXTRACTOR_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"
+ CallingConvention="2"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Strmbasd.lib Msvcrtd.lib Winmm.lib Strmiids.lib Quartz.lib"
+ OutputFile="$(OutDir)/dsfOggRawAudioExtractor.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Debug""
+ ModuleDefinitionFile="oggrawaudioextractor.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/dsfOggRawAudioExtractor.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/dsfOggRawAudioExtractor.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\core\directshow\dsfOggDemux2; ..\..\..\core\ogg;..\..\..\helper"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFOGGRAWAUDIOEXTRACTOR_EXPORTS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"
+ CallingConvention="2"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Strmbase.lib Winmm.lib Strmiids.lib Quartz.lib"
+ OutputFile="$(OutDir)/dsfOggRawAudioExtractor.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Release""
+ ModuleDefinitionFile="oggrawaudioextractor.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/dsfOggRawAudioExtractor.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\oggrawaudioextractor.def">
+ </File>
+ <File
+ RelativePath=".\oggrawaudioextractordllstuff.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorInputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorOutputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\oggrawaudioextractordllstuff.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorFilter.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorInputPin.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioExtractorOutputPin.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractor.def
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractor.def 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractor.def 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,8 @@
+LIBRARY dsfOggRawAudioExtractor
+EXPORTS
+ DllMain PRIVATE
+ DllGetClassObject PRIVATE
+ DllCanUnloadNow PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
+
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,99 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+#include "oggrawaudioextractordllstuff.h"
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
+{
+ return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
+}
+
+
+//The folowing two functions do the registration and deregistration of the dll and it's contained com objects.
+STDAPI DllRegisterServer()
+{
+
+ HRESULT hr;
+ IFilterMapper2* locFilterMapper = NULL;
+
+ hr = AMovieDllRegisterServer2(TRUE);
+
+
+
+
+ hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&locFilterMapper);
+
+
+ hr = locFilterMapper->RegisterFilter(
+ CLSID_OggRawAudioExtractorFilter, // Filter CLSID.
+ L"Ogg Raw Audio Extractor Filter", // Filter name.
+ NULL, // Device moniker.
+ &CLSID_LegacyAmFilterCategory, // Direct Show general category
+ L"Ogg Raw Audio Extractor Filter", // Instance data. ???????
+ &OggRawAudioExtractorFilterReg // Pointer to filter information.
+ );
+
+ locFilterMapper->Release();
+
+ return hr;
+
+}
+
+STDAPI DllUnregisterServer()
+{
+ HRESULT hr;
+ IFilterMapper2* locFilterMapper = NULL;
+
+ hr = AMovieDllRegisterServer2(FALSE);
+ if (FAILED(hr)) {
+
+ return hr;
+ }
+
+ hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
+ IID_IFilterMapper2, (void **)&locFilterMapper);
+
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+
+ hr = locFilterMapper->UnregisterFilter(&CLSID_LegacyAmFilterCategory, L"Ogg Raw Audio Extractor Filter", CLSID_OggRawAudioExtractorFilter);
+
+
+ //
+ locFilterMapper->Release();
+ return hr;
+
+}
+
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/oggrawaudioextractordllstuff.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,110 @@
+#pragma once
+
+
+#include <streams.h>
+#include <pullpin.h>
+#include <initguid.h>
+
+struct sOggRawAudioFormatBlock {
+ unsigned long samplesPerSec;
+ unsigned long numHeaders;
+ unsigned long numChannels;
+ unsigned long bitsPerSample;
+ unsigned long maxFramesPerPacket;
+
+
+};
+
+
+
+
+
+#ifdef LIBOOOGG_EXPORTS
+#define LIBOOOGG_API __declspec(dllexport)
+#else
+#define LIBOOOGG_API __declspec(dllimport)
+#endif
+
+#include "libOOOgg/OggPacket.h"
+
+#include "OggRawAudioExtractorInputPin.h"
+#include "OggRawAudioExtractorOutputPin.h"
+
+#include "OggRawAudioExtractorFilter.h"
+
+// {B9D15720-7AB4-4f0e-A215-D3C0EA8C0709}
+DEFINE_GUID(CLSID_OggRawAudioExtractorFilter,
+0xb9d15720, 0x7ab4, 0x4f0e, 0xa2, 0x15, 0xd3, 0xc0, 0xea, 0x8c, 0x7, 0x9);
+
+
+// {37535B3C-F068-4f93-9763-E7208277D71F}
+DEFINE_GUID(MEDIASUBTYPE_RawOggAudio,
+0x37535b3c, 0xf068, 0x4f93, 0x97, 0x63, 0xe7, 0x20, 0x82, 0x77, 0xd7, 0x1f);
+
+// {232D3C8F-16BF-404b-99AE-296F3DBB77EE}
+DEFINE_GUID(FORMAT_RawOggAudio,
+0x232d3c8f, 0x16bf, 0x404b, 0x99, 0xae, 0x29, 0x6f, 0x3d, 0xbb, 0x77, 0xee);
+
+
+// {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 OggRawAudioExtractorOutputTypes = {
+ &MEDIATYPE_Audio,
+ &MEDIASUBTYPE_PCM
+};
+
+const REGPINTYPES OggRawAudioExtractorInputTypes = {
+ &MEDIATYPE_OggPacketStream,
+ &MEDIASUBTYPE_None
+};
+
+const REGFILTERPINS OggRawAudioExtractorPinReg[] = {
+ {
+ L"Ogg Raw Audio Input", //Name (obsoleted)
+ FALSE, //Renders from this pin ?? Not sure about this.
+ FALSE, //Not an output pin
+ FALSE, //Cannot have zero instances of this pin
+ FALSE, //Cannot have more than one instance of this pin
+ NULL, //Connects to filter (obsoleted)
+ NULL, //Connects to pin (obsoleted)
+ 1, //upport two media type
+ &OggRawAudioExtractorInputTypes //Pointer to media type (Audio/Speex or Audio/Speex)
+ } ,
+
+ {
+ L"PCM Output", //Name (obsoleted)
+ FALSE, //Renders from this pin ?? Not sure about this.
+ TRUE, //Is an output pin
+ FALSE, //Cannot have zero instances of this pin
+ FALSE, //Cannot have more than one instance of this pin
+ NULL, //Connects to filter (obsoleted)
+ NULL, //Connects to pin (obsoleted)
+ 1, //Only support one media type
+ &OggRawAudioExtractorOutputTypes //Pointer to media type (Audio/PCM)
+
+ }
+};
+
+
+
+const REGFILTER2 OggRawAudioExtractorFilterReg = {
+ 1,
+ MERIT_NORMAL,
+ 2,
+ OggRawAudioExtractorPinReg
+
+};
+
+
+
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,40 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+// stdafx.cpp : source file that includes just the standard includes
+
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
+
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioExtractor/stdafx.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,12 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,105 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+
+
+#include "OggRawAudioInserterFilter.h"
+
+
+//COM Factory Template
+CFactoryTemplate g_Templates[] =
+{
+ {
+ L"Ogg Raw Audio Inserter Filter", // Name
+ &CLSID_OggRawAudioInserterFilter, // CLSID
+ OggRawAudioInserterFilter::CreateInstance, // Method to create an instance of MyComponent
+ NULL, // Initialization function
+ NULL // Set-up information (for filters)
+ }
+
+};
+
+// Generic way of determining the number of items in the template
+int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+
+CUnknown* WINAPI OggRawAudioInserterFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
+{
+ //This routine is the COM implementation to create a new Filter
+ OggRawAudioInserterFilter *pNewObject = new OggRawAudioInserterFilter();
+ if (pNewObject == NULL) {
+ *pHr = E_OUTOFMEMORY;
+ }
+ return pNewObject;
+}
+
+OggRawAudioInserterFilter::OggRawAudioInserterFilter(void)
+ : AbstractTransformFilter(NAME("Ogg Raw Audio Inserter"), CLSID_OggRawAudioInserterFilter)
+{
+ bool locWasConstructed = ConstructPins();
+}
+
+OggRawAudioInserterFilter::~OggRawAudioInserterFilter(void)
+{
+}
+
+bool OggRawAudioInserterFilter::ConstructPins()
+{
+
+
+ //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_RawOggAudio;
+ locAcceptMediaType->formattype = FORMAT_RawOggAudio;
+
+ locAcceptableTypes.push_back(locAcceptMediaType);
+
+ //Output pin must be done first because it's passed to the input pin.
+ mOutputPin = new OggRawAudioInserterOutputPin(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 OggRawAudioInserterInputPin(this, m_pLock, mOutputPin, locAcceptableTypes); //Deleted in base class filter destructor.
+ return true;
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterFilter.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,69 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+
+//Local Includes
+#include "oggrawaudioinserterdllstuff.h"
+
+//External Includes
+#include "AbstractTransformFilter.h"
+
+//Forward Declarations
+struct sOggRawAudioFormatBlock;
+class OggRawAudioInserterInputPin;
+class OggRawAudioInserterOutputPin;
+
+class OggRawAudioInserterFilter
+ //Base Classes
+ : public AbstractTransformFilter
+{
+public:
+ //Friend Classes
+ friend class OggRawAudioInserterOutputPin;
+ friend class OggRawAudioInserterInputPin;
+
+ //Constructors
+ OggRawAudioInserterFilter(void);
+ virtual ~OggRawAudioInserterFilter(void);
+
+ //COM Creator function
+ static CUnknown* WINAPI OggRawAudioInserterFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
+
+
+protected:
+ //Implementation of pure virtual from AbstractTransformFilter.
+ virtual bool ConstructPins();
+
+ //Member data
+ sOggRawAudioFormatBlock mOggRawAudioFormatBlock;
+
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,294 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+#include "OggRawAudioInserterInputPin.h"
+
+OggRawAudioInserterInputPin::OggRawAudioInserterInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes)
+ : AbstractTransformInputPin(inParentFilter, inFilterLock, inOutputPin, NAME("OggRawAudioInserterInputPin"), L"PCM In", inAcceptableMediaTypes)
+ //, mWaveFormat(NULL)
+ , mUptoFrame(0)
+ , mNumBufferedBytes(0)
+ , mWorkingBuffer(NULL)
+ , mFrameByteWidth(0)
+ , mFramesPerPacket(0)
+ , mBytesPerPacket(0)
+ , mSentHeaders(false)
+{
+ //debugLog.open("C:\\temp\\speexenc.log", ios_base::out);
+ mWorkingBuffer = new unsigned char[WORKING_BUFFER_SIZE];
+}
+
+OggRawAudioInserterInputPin::~OggRawAudioInserterInputPin(void)
+{
+ //debugLog.close();
+ DestroyCodec();
+
+ delete[] mWorkingBuffer;
+}
+
+
+unsigned long OggRawAudioInserterInputPin::identifyFormat()
+{
+ switch(((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.bitsPerSample) {
+ case 8:
+ return FMT_U8;
+ case 16:
+ return FMT_S16_LE;
+ default:
+ return 0xffffffff;
+ }
+}
+bool OggRawAudioInserterInputPin::makeMainHeader(unsigned char** outBuff, unsigned long* outHeaderSize)
+{
+ const unsigned long MAIN_HEADER_SIZE = 28;
+ unsigned char* retBuff = new unsigned char[MAIN_HEADER_SIZE];
+
+ //ID
+ memcpy((void*)retBuff, "PCM ", 8);
+ //Versions
+ retBuff[8] = 0;
+ retBuff[9] = 0;
+ retBuff[10] = 0;
+ retBuff[11] = 0;
+
+ //Format
+ unsigned long locFormat = identifyFormat();
+ iBE_Math::ULongToCharArr(locFormat, &retBuff[12]);
+
+ //Sample Rate
+ iBE_Math::ULongToCharArr(((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.samplesPerSec, &retBuff[16]);
+
+ //Sig bits
+ retBuff[20] = ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.bitsPerSample;
+
+ //Num Channels
+ retBuff[21] = ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.numChannels;
+
+ //Frames per packet (fixed to 1024 = 0x0400)
+ retBuff[22] = (mFramesPerPacket & 0xff00) >> 8;
+ retBuff[23] = (mFramesPerPacket & 0xff);
+
+ //Extra Headers
+ retBuff[24] = 0;
+ retBuff[25] = 0;
+ retBuff[26] = 0;
+ retBuff[27] = 0;
+
+ *outBuff = retBuff;
+ *outHeaderSize = MAIN_HEADER_SIZE;
+
+ return true;
+
+}
+bool OggRawAudioInserterInputPin::makeCommentHeader(unsigned char** outBuff, unsigned long* outHeaderSize)
+{
+ char* locVendor = "oggcodecs testbuild";
+ unsigned long locVendorLength = strlen(locVendor);
+ unsigned long locPacketLength = locVendorLength + 4 + 4 + 1;
+
+ unsigned char* retBuff = new unsigned char[locPacketLength];
+ iLE_Math::ULongToCharArr(locVendorLength, retBuff);
+
+ memcpy((void*)(&retBuff[4]), (const void*)locVendor, locVendorLength);
+
+ //No user comments
+ iLE_Math::ULongToCharArr(0, &retBuff[locVendorLength + 4]);
+
+ //Framing bit
+ retBuff[locVendorLength+8] = 1;
+
+ *outBuff = retBuff;
+ *outHeaderSize = locPacketLength;
+
+ return true;
+
+
+}
+//PURE VIRTUALS
+HRESULT OggRawAudioInserterInputPin::TransformData(unsigned char* inBuf, long inNumBytes)
+{
+
+ if (!mSentHeaders) {
+
+
+ unsigned char* locHeader = NULL;
+ unsigned long locHeaderLength = 0;
+ mFrameByteWidth = (((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.numChannels * ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.bitsPerSample) >> 3;
+ mBytesPerPacket = mFramesPerPacket * mFrameByteWidth;
+
+ makeMainHeader(&locHeader, &locHeaderLength);
+
+ sendPacket(locHeader, locHeaderLength, true);
+
+ delete[] locHeader;
+ locHeader = NULL;
+ locHeaderLength = 0;
+
+ makeCommentHeader(&locHeader, &locHeaderLength);
+
+ sendPacket(locHeader, locHeaderLength, true);
+ delete[] locHeader;
+
+ mSentHeaders = true;
+ }
+
+ //assert(inNumBytes < (WORKING_BUFFER_SIZE - mNumBufferedBytes));
+ memcpy((void*)&mWorkingBuffer[mNumBufferedBytes], (const void*)inBuf, inNumBytes);
+ mNumBufferedBytes+=inNumBytes;
+
+ //How many full buffers full
+ unsigned long locBuffersWorth = mNumBufferedBytes / mBytesPerPacket;
+
+ for (int i = 0; i < locBuffersWorth; i++) {
+ sendPacket(&mWorkingBuffer[i*mBytesPerPacket], mBytesPerPacket, false);
+ }
+
+ unsigned long locLeftovers = mNumBufferedBytes % mBytesPerPacket;
+
+ //assert((locLeftovers % mFrameByteWidth) == 0);
+
+ //TODO::: This can be improved. For now it's easier to always clear out the buffer.
+ // Though overall it would be better to wait for the next lot of input, though then
+ // we have to worry about ending of stream and the data getting left here, etc.
+ sendPacket(&mWorkingBuffer[locBuffersWorth*mBytesPerPacket], locLeftovers, false);
+
+
+ mNumBufferedBytes = 0;
+
+ return S_OK;
+}
+
+HRESULT OggRawAudioInserterInputPin::sendPacket(unsigned char* inPacketData, unsigned long inNumBytes, bool inIsHeader)
+{
+ if (inIsHeader) {
+ mUptoFrame = 0;
+
+ }
+ IMediaSample* locSample;
+ REFERENCE_TIME locFrameStart = 0;
+ REFERENCE_TIME locFrameEnd = 0;
+ HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, NULL);
+
+ if (FAILED(locHR)) {
+ return locHR;
+ }
+
+ BYTE* locBuffer = NULL;
+
+ //Make our pointers set to point to the samples buffer
+ locSample->GetPointer(&locBuffer);
+
+
+ if (locSample->GetSize() >= inNumBytes) {
+
+ memcpy((void*)locBuffer, (const void*)inPacketData, inNumBytes);
+ locSample->SetActualDataLength(inNumBytes);
+
+ if (!inIsHeader) {
+ //locFrameStart = (mUptoFrame * UNITS) / ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.samplesPerSec;
+ locFrameStart = mUptoFrame;
+ mUptoFrame += (inNumBytes / mFrameByteWidth);
+
+ locFrameEnd = mUptoFrame;
+ //locFrameEnd = (mUptoFrame * UNITS) / ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.samplesPerSec;
+ } else {
+ locFrameStart = 0;
+ locFrameEnd = 0;
+
+ }
+ locSample->SetMediaTime(&locFrameStart, &locFrameEnd);
+ locSample->SetTime(&locFrameStart, &locFrameEnd);
+
+ locSample->SetSyncPoint(TRUE);
+
+
+ {
+ CAutoLock locLock(m_pLock);
+
+ //TODO::: Need to propagate error states.
+ HRESULT locHR = ((OggRawAudioInserterOutputPin*)(mOutputPin))->mDataQueue->Receive(locSample); //->DownstreamFilter()->Receive(locSample);
+ if (locHR != S_OK) {
+ return locHR;
+ } else {
+ //locThis->debugLog<<"Sample Delivered"<<endl;
+ return S_OK;
+ }
+ }
+ } else {
+ throw 0;
+ }
+
+}
+bool OggRawAudioInserterInputPin::ConstructCodec() {
+
+ return true;
+
+}
+void OggRawAudioInserterInputPin::DestroyCodec() {
+
+}
+
+
+
+
+HRESULT OggRawAudioInserterInputPin::SetMediaType(const CMediaType* inMediaType)
+{
+
+ if ( (inMediaType->subtype == MEDIASUBTYPE_PCM) &&
+ (inMediaType->formattype == FORMAT_WaveFormatEx)) {
+
+ WAVEFORMATEX* locWaveFormat = (WAVEFORMATEX*)inMediaType->pbFormat;
+
+ mFramesPerPacket = 1024;
+
+ //TODO::: This needs to change with channel conversion/mapping headers
+ ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.numHeaders = 2;
+ ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.samplesPerSec = locWaveFormat->nSamplesPerSec;
+ ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.numChannels = locWaveFormat->nChannels;
+ ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.bitsPerSample = locWaveFormat->wBitsPerSample;
+ ((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock.maxFramesPerPacket = 1024;
+
+
+ } 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 CBaseInputPin::SetMediaType(inMediaType);
+
+
+
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterInputPin.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,107 @@
+//===========================================================================
+//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+
+
+#include "AbstractTransformInputPin.h"
+#include "OggRawAudioInserterInputPin.h"
+
+#include "OggRawAudioInserterFilter.h"
+
+#include <libilliCore/iBE_Math.h>
+#include <libilliCore/iLE_Math.h>
+
+
+
+//#include <fstream>
+//using namespace std;
+class OggRawAudioInserterInputPin
+ : public AbstractTransformInputPin
+{
+public:
+ OggRawAudioInserterInputPin(AbstractTransformFilter* inFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes);
+ virtual ~OggRawAudioInserterInputPin(void);
+
+
+ virtual HRESULT SetMediaType(const CMediaType* inMediaType);
+
+protected:
+
+ static const unsigned long WORKING_BUFFER_SIZE = 1 <<20; //1meg buffer
+ unsigned long identifyFormat();
+ bool makeMainHeader(unsigned char** outBuff, unsigned long* outHeaderSize);
+ bool makeCommentHeader(unsigned char** outBuff, unsigned long* outHeaderSize);
+ HRESULT sendPacket(unsigned char* inPacketData, unsigned long inNumBytes, bool inIsHeader);
+
+
+ HRESULT mHR;
+//PURE VIRTUALS
+ virtual HRESULT TransformData(unsigned char* inBuf, long inNumBytes);
+ virtual bool ConstructCodec();
+ virtual void DestroyCodec();
+
+
+
+ __int64 mUptoFrame;
+
+ enum eRawAudioFormat {
+ FMT_S8,
+ FMT_U8,
+ FMT_S16_LE,
+ FMT_S16_BE,
+ FMT_S24_LE,
+ FMT_S24_BE,
+ FMT_S32_LE,
+ FMT_S32_BE,
+
+ FMT_ULAW = 0x10,
+ FMT_ALAW,
+
+ FMT_FLT32_LE = 0x20,
+ FMT_FLT32_BE,
+ FMT_FLT64_LE,
+ FMT_FLT64_BE,
+
+
+ };
+
+ unsigned long mNumBufferedBytes;
+ unsigned long mFrameByteWidth;
+ unsigned char* mWorkingBuffer;
+
+ unsigned long mFramesPerPacket;
+ unsigned long mBytesPerPacket;
+
+ bool mSentHeaders;
+
+
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,55 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+#include "OggRawAudioInserterOutputPin.h"
+
+OggRawAudioInserterOutputPin::OggRawAudioInserterOutputPin(OggRawAudioInserterFilter* inParentFilter,CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes)
+ : AbstractTransformOutputPin(inParentFilter, inFilterLock,NAME("OggRawAudioInserterOutputPin"), L"Ogg Raw Audio Out", 65536, 5, inAcceptableMediaTypes)
+{
+}
+
+OggRawAudioInserterOutputPin::~OggRawAudioInserterOutputPin(void)
+{
+}
+
+HRESULT OggRawAudioInserterOutputPin::CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition)
+{
+ if (inPosition == 0) {
+ sOggRawAudioFormatBlock* locOggRawAudioFormat = (sOggRawAudioFormatBlock*)outMediaType->AllocFormatBuffer(sizeof(sOggRawAudioFormatBlock));
+ //TODO::: Check for null ?
+
+ memcpy((void*)locOggRawAudioFormat, (const void*) &(((OggRawAudioInserterFilter*)mParentFilter)->mOggRawAudioFormatBlock), sizeof(sOggRawAudioFormatBlock));
+ return S_OK;
+ } else {
+ return S_FALSE;
+ }
+}
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/OggRawAudioInserterOutputPin.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,58 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+
+//Local Includes
+#include "oggrawaudioinserterdllstuff.h"
+
+//External Includes
+#include "AbstractTransformOutputPin.h"
+
+//Forward Declarations
+class OggRawAudioInserterFilter;
+struct sOggRawAudioFormatBlock;
+
+class OggRawAudioInserterOutputPin
+ //Base Classes
+ : public AbstractTransformOutputPin
+{
+public:
+ //Friend Classes
+ friend class OggRawAudioInserterInputPin;
+
+ //Constructors
+ OggRawAudioInserterOutputPin(OggRawAudioInserterFilter* inParentFilter, CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes);
+ virtual ~OggRawAudioInserterOutputPin(void);
+
+protected:
+ virtual HRESULT CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition);
+};
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/dsfOggRawAudioInserter.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/dsfOggRawAudioInserter.vcproj 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/dsfOggRawAudioInserter.vcproj 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="dsfOggRawAudioInserter"
+ ProjectGUID="{EEEBA51F-0499-4AD0-A25C-36C3AF2956C9}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\core\ogg;..\..\..\helper"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFOGGRAWAUDIOINSERTER_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"
+ CallingConvention="2"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Strmbasd.lib Msvcrtd.lib Winmm.lib Strmiids.lib Quartz.lib"
+ OutputFile="$(OutDir)/dsfOggRawAudioInserter.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Debug""
+ ModuleDefinitionFile="oggrawaudioinserter.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/dsfOggRawAudioInserter.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/dsfOggRawAudioInserter.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";C:\DXSDK\Include;..\..\..\core\directshow\libDirectshowAbstracts;..\..\..\core\ogg;..\..\..\helper"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFOGGRAWAUDIOINSERTER_EXPORTS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"
+ CallingConvention="2"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Strmbase.lib Winmm.lib Strmiids.lib Quartz.lib"
+ OutputFile="$(OutDir)/dsfOggRawAudioInserter.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Release""
+ ModuleDefinitionFile="oggrawaudioinserter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/dsfOggRawAudioInserter.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\oggrawaudioinserter.def">
+ </File>
+ <File
+ RelativePath=".\oggrawaudioinserterdllstuff.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterInputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterOutputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\oggrawaudioinserterdllstuff.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterFilter.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterInputPin.h">
+ </File>
+ <File
+ RelativePath=".\OggRawAudioInserterOutputPin.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserter.def
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserter.def 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserter.def 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,7 @@
+LIBRARY dsfOggRawAudioInserter
+EXPORTS
+ DllMain PRIVATE
+ DllGetClassObject PRIVATE
+ DllCanUnloadNow PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,98 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+#include "oggrawaudioinserterdllstuff.h"
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
+{
+ return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
+}
+
+
+//The folowing two functions do the registration and deregistration of the dll and it's contained com objects.
+STDAPI DllRegisterServer()
+{
+
+ HRESULT hr;
+ IFilterMapper2* locFilterMapper = NULL;
+
+ hr = AMovieDllRegisterServer2(TRUE);
+
+
+
+
+ hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&locFilterMapper);
+
+
+ hr = locFilterMapper->RegisterFilter(
+ CLSID_OggRawAudioInserterFilter, // Filter CLSID.
+ L"Ogg Raw Audio Inserter Filter", // Filter name.
+ NULL, // Device moniker.
+ &CLSID_LegacyAmFilterCategory, // Direct Show general category
+ L"Ogg Raw Audio Inserter Filter", // Instance data. ???????
+ &OggRawAudioInserterFilterReg // Pointer to filter information.
+ );
+
+ locFilterMapper->Release();
+
+ return hr;
+
+}
+
+STDAPI DllUnregisterServer()
+{
+ HRESULT hr;
+ IFilterMapper2* locFilterMapper = NULL;
+
+ hr = AMovieDllRegisterServer2(FALSE);
+ if (FAILED(hr)) {
+
+ return hr;
+ }
+
+ hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
+ IID_IFilterMapper2, (void **)&locFilterMapper);
+
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+
+ hr = locFilterMapper->UnregisterFilter(&CLSID_LegacyAmFilterCategory, L"Ogg Raw Audio Inserter Filter", CLSID_OggRawAudioInserterFilter);
+
+
+ //
+ locFilterMapper->Release();
+ return hr;
+
+}
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/oggrawaudioinserterdllstuff.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,129 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+
+struct sOggRawAudioFormatBlock {
+ unsigned long samplesPerSec;
+ unsigned long numHeaders;
+ unsigned long numChannels;
+ unsigned long bitsPerSample;
+ unsigned long maxFramesPerPacket;
+
+
+};
+#include "AbstractTransformFilter.h"
+#include "AbstractTransformInputPin.h"
+#include "AbstractTransformOutputPin.h"
+#include "OggRawAudioInserterInputPin.h"
+#include "OggRawAudioInserterOutputPin.h"
+#include "OggRawAudioInserterFilter.h"
+
+#ifdef LIBOOOGG_EXPORTS
+#define LIBOOOGG_API __declspec(dllexport)
+#else
+#define LIBOOOGG_API __declspec(dllimport)
+#endif
+
+
+// {4002BC5C-C36D-4a00-B4FD-C4E506F983C0}
+DEFINE_GUID(CLSID_OggRawAudioInserterFilter,
+0x4002bc5c, 0xc36d, 0x4a00, 0xb4, 0xfd, 0xc4, 0xe5, 0x6, 0xf9, 0x83, 0xc0);
+
+// {37535B3C-F068-4f93-9763-E7208277D71F}
+DEFINE_GUID(MEDIASUBTYPE_RawOggAudio,
+0x37535b3c, 0xf068, 0x4f93, 0x97, 0x63, 0xe7, 0x20, 0x82, 0x77, 0xd7, 0x1f);
+
+// {232D3C8F-16BF-404b-99AE-296F3DBB77EE}
+DEFINE_GUID(FORMAT_RawOggAudio,
+0x232d3c8f, 0x16bf, 0x404b, 0x99, 0xae, 0x29, 0x6f, 0x3d, 0xbb, 0x77, 0xee);
+
+//// {7036C2FE-A209-464c-97AB-95B9260EDBF7}
+//DEFINE_GUID(CLSID_SpeexEncodeFilter,
+//0x7036c2fe, 0xa209, 0x464c, 0x97, 0xab, 0x95, 0xb9, 0x26, 0xe, 0xdb, 0xf7);
+//
+//// {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
+
+const REGPINTYPES OggRawAudioInserterInputTypes = {
+ &MEDIATYPE_Audio,
+ &MEDIASUBTYPE_PCM
+};
+
+const REGPINTYPES OggRawAudioInserterOutputTypes = {
+ &MEDIATYPE_Audio,
+ &MEDIASUBTYPE_RawOggAudio
+};
+
+const REGFILTERPINS OggRawAudioInserterPinReg[] = {
+ {
+ L"PCM Input", //Name (obsoleted)
+ FALSE, //Renders from this pin ?? Not sure about this.
+ FALSE, //Not an output pin
+ FALSE, //Cannot have zero instances of this pin
+ FALSE, //Cannot have more than one instance of this pin
+ NULL, //Connects to filter (obsoleted)
+ NULL, //Connects to pin (obsoleted)
+ 1, //upport two media type
+ &OggRawAudioInserterInputTypes //Pointer to media type (Audio/Speex or Audio/Speex)
+ } ,
+
+ {
+ L"Ogg Raw Audio Output", //Name (obsoleted)
+ FALSE, //Renders from this pin ?? Not sure about this.
+ TRUE, //Is an output pin
+ FALSE, //Cannot have zero instances of this pin
+ FALSE, //Cannot have more than one instance of this pin
+ NULL, //Connects to filter (obsoleted)
+ NULL, //Connects to pin (obsoleted)
+ 1, //Only support one media type
+ &OggRawAudioInserterOutputTypes //Pointer to media type (Audio/PCM)
+
+ }
+};
+
+
+
+const REGFILTER2 OggRawAudioInserterFilterReg = {
+ 1,
+ MERIT_DO_NOT_USE,
+ 2,
+ OggRawAudioInserterPinReg
+
+};
+
+
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.cpp 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.cpp 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,39 @@
+//===========================================================================
+//Copyright (C) 2003, 2004, 2005 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+// stdafx.cpp : source file that includes just the standard includes
+
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.h 2006-02-12 21:52:56 UTC (rev 10808)
+++ trunk/oggdsf/src/lib/codecs/RawAudio/dsfOggRawAudioInserter/stdafx.h 2006-02-12 22:01:22 UTC (rev 10809)
@@ -0,0 +1,12 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
More information about the commits
mailing list