AudioDecoder.cpp
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:2k
源码类别:
VC书籍
开发平台:
Visual C++
- /**************************************************************************************
- * *
- * *
- **************************************************************************************/
- #include "AudioDecoder.h"
- MediaAudioDecoder::MediaAudioDecoder()
- {
- this->acmDecoder = new MediaAudioDecoderACM();
- this->mp3Decoder = new MediaAudioDecoderMP3();
- this->decoder = NULL;
- }
- MediaAudioDecoder::~MediaAudioDecoder()
- {
- delete this->acmDecoder;
- delete this->mp3Decoder;
- }
- media_type_t MediaAudioDecoder::GetType()
- {
- return MEDIA_TYPE_AUDIO_DECODER;
- }
- char *MediaAudioDecoder::GetName()
- {
- if(this->decoder)
- return this->decoder->GetName();
- return "Audio Decoder Wrapper";
- }
- MP_RESULT MediaAudioDecoder::Connect(MediaItem *item)
- {
- if(this->acmDecoder->Connect(item) == MP_RESULT_OK) {
- this->decoder = (MediaItemAudioDecoder *) this->acmDecoder;
- return MP_RESULT_OK;
- }
- if(this->mp3Decoder->Connect(item) == MP_RESULT_OK) {
- this->decoder = (MediaItemAudioDecoder *) this->mp3Decoder;
- return MP_RESULT_OK;
- }
- return MP_RESULT_ERROR;
- }
- MP_RESULT MediaAudioDecoder::ReleaseConnections()
- {
- if(this->decoder) {
- this->decoder->ReleaseConnections();
- }
- this->decoder = NULL;
- return MP_RESULT_OK;
- }
- DWORD MediaAudioDecoder::GetCaps()
- {
- return 0;
- }
- MP_RESULT MediaAudioDecoder::Configure(HINSTANCE hInstance, HWND hwnd)
- {
- return MP_RESULT_ERROR;
- }
- WAVEFORMATEX *MediaAudioDecoder::GetAudioFormat()
- {
- if(this->decoder)
- return this->decoder->GetAudioFormat();
- return NULL;
- }
- MP_RESULT MediaAudioDecoder::EmptyAudioBuffer()
- {
- if(this->decoder)
- return this->decoder->EmptyAudioBuffer();
- return MP_RESULT_ERROR;
- }
- unsigned int MediaAudioDecoder::Decompress(void *buffer, unsigned int size)
- {
- if(this->decoder)
- return this->decoder->Decompress(buffer, size);
- return 0;
- }