00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "stdafx.h"
00033 #include "flacdecodeoutputpin.h"
00034
00035 FLACDecodeOutputPin::FLACDecodeOutputPin(FLACDecodeFilter* inParentFilter, CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes)
00036 : AbstractTransformOutputPin(inParentFilter, inFilterLock, NAME("FLACDecodeOutputPin"), L"PCM Out", 65536, 20, inAcceptableMediaTypes)
00037 {
00038 }
00039
00040 FLACDecodeOutputPin::~FLACDecodeOutputPin(void)
00041 {
00042 }
00043
00044 STDMETHODIMP FLACDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
00045 {
00046 if (riid == IID_IMediaSeeking) {
00047 *ppv = (IMediaSeeking*)this;
00048 ((IUnknown*)*ppv)->AddRef();
00049 return NOERROR;
00050 }
00051
00052 return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
00053 }
00054
00055 HRESULT FLACDecodeOutputPin::CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition)
00056 {
00057 if (inPosition == 0) {
00058 WAVEFORMATEX* locWaveFormat = (WAVEFORMATEX*)outMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
00059 FLACDecodeFilter* locFilter = (FLACDecodeFilter*)mParentFilter;
00060
00061 locWaveFormat->wFormatTag = WAVE_FORMAT_PCM;
00062 locWaveFormat->nChannels = locFilter->getFLACFormatBlock()->numChannels;
00063 locWaveFormat->nSamplesPerSec = locFilter->getFLACFormatBlock()->samplesPerSec;
00064 locWaveFormat->wBitsPerSample = (WORD)locFilter->getFLACFormatBlock()->numBitsPerSample;
00065 locWaveFormat->nBlockAlign = (locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3);
00066 locWaveFormat->nAvgBytesPerSec = ((locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3)) * locWaveFormat->nSamplesPerSec;
00067 locWaveFormat->cbSize = 0;
00068 return S_OK;
00069 } else {
00070 return S_FALSE;
00071 }
00072 }