deargui-vpl/ref/virtools/Samples/Plugins/Wav Reader/DShowReader.h

101 lines
2.1 KiB
C++

// DShowReader.h: interface for the DShowReader class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DSHOWREADER_H__9E401456_AB4C_48CF_8638_5BC57BF371C3__INCLUDED_)
#define AFX_DSHOWREADER_H__9E401456_AB4C_48CF_8638_5BC57BF371C3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define BUFFER_SIZE 22050
CKERROR ExitDShowReaderInstance(CKContext* context);
class DShowReader : public CKSoundReader
{
public:
DShowReader();
virtual ~DShowReader();
virtual void Release() { delete this; }
virtual CKPluginInfo* GetReaderInfo();
// Get Options Count
virtual int GetOptionsCount() { return 0; }
// Get Options Description
virtual CKSTRING GetOptionDescription(int i) {return NULL; }
//release DeviceEnumerator & FilterEnumerator
static void ReleaseDirectShowFilterList();
// Get Flags
public:
// Opens a file
virtual CKERROR OpenFile(char *file);
// Decodes next chunk of data, use get data buffer to get decoded data
virtual CKERROR Decode();
// Gets the last decoded buffer
virtual CKERROR GetDataBuffer(BYTE **buf, int *size);
// Gets the wave format of decoded datas
virtual CKERROR GetWaveFormat(CKWaveFormat *wfe);
// Gets whole decoded data size
virtual int GetDataSize();
// Gets the play time length
virtual int GetDuration();
// Seek
virtual CKERROR Seek(int pos);
// Play;
virtual CKERROR Play();
// Stop
virtual CKERROR Stop();
virtual CKERROR Pause();
virtual CKERROR Resume();
virtual CKERROR ReadMemory(void* memory, int size);
#ifdef _DEBUG
void DShowEnableGraphEdit(CKBOOL iEnable);
#endif
protected:
WAVEFORMATEX m_Wfe;
int m_LastDataSize;
IMultiMediaStream *m_MMStream;
IAudioStreamSample *m_pSample;
IAudioData *m_pAudioData;
unsigned char m_Buffer[BUFFER_SIZE];
IGraphBuilder *m_GraphBuilder;
DWORD m_GraphID;
private:
static ICreateDevEnum *DeviceEnumerator;
static IEnumMoniker *FilterEnumerator;
};
class Mp3Reader : public DShowReader
{
public:
Mp3Reader();
virtual ~Mp3Reader();
virtual CKPluginInfo* GetReaderInfo();
};
#endif // !defined(AFX_DSHOWREADER_H__9E401456_AB4C_48CF_8638_5BC57BF371C3__INCLUDED_)