- /**************************************************************************************
- * *
- * *
- **************************************************************************************/
- #include "VideoDecoder.h"
- /*
- * 视频解码器加封装器
- *
- */
- MediaVideoDecoder::MediaVideoDecoder()
- {
- this->decoder = NULL;
- this->decoreDecoder = new MediaVideoDecoderDecore();
- this->vfwDecoder = new MediaVideoDecoderVFW();
- }
- MediaVideoDecoder::~MediaVideoDecoder()
- {
- delete this->decoreDecoder;
- delete this->vfwDecoder;
- }
- /*
- * 媒体项方法
- */
- media_type_t MediaVideoDecoder::GetType()
- {
- return MEDIA_TYPE_VIDEO_DECODER;
- }
- char *MediaVideoDecoder::GetName()
- {
- if(this->decoder)
- return this->decoder->GetName();
- return "Video Decoder Wrapper";
- }
- MP_RESULT MediaVideoDecoder::Connect(MediaItem *item)
- {
- /*
- * 解码器
- */
- if(this->decoreDecoder->Connect(item) == MP_RESULT_OK) {
- this->decoder = this->decoreDecoder;
- return MP_RESULT_OK;
- }
- /*
- * VFW(Video for Windows)解码器
- */
- if(this->vfwDecoder->Connect(item) == MP_RESULT_OK) {
- this->decoder = this->vfwDecoder;
- return MP_RESULT_OK;
- }
- return MP_RESULT_ERROR;
- }
- MP_RESULT MediaVideoDecoder::ReleaseConnections()
- {
- /*
- * 清除
- */
- if(this->decoder) {
- this->decoder->ReleaseConnections();
- this->decoder = NULL;
- }
- return MP_RESULT_OK;
- }
- DWORD MediaVideoDecoder::GetCaps()
- {
- if(this->decoder)
- return this->decoder->GetCaps();
- return 0;
- }
- MP_RESULT MediaVideoDecoder::Configure(HINSTANCE hInstance, HWND hwnd)
- {
- if(this->decoder)
- return this->decoder->Configure(hInstance, hwnd);
- return MP_RESULT_ERROR;
- }
- /*
- * 视频解码器方法
- *
- */
- unsigned int MediaVideoDecoder::GetFrameSize()
- {
- if(this->decoder)
- return this->decoder->GetFrameSize();
- return 0;
- }
- media_video_mode_t MediaVideoDecoder::GetVideoMode()
- {
- if(this->decoder)
- return this->decoder->GetVideoMode();
- return VIDEO_MODE_NONE;
- }
- BOOL MediaVideoDecoder::GetInvertFlag()
- {
- if(this->decoder)
- return this->decoder->GetInvertFlag();
- return FALSE;
- }
- MP_RESULT MediaVideoDecoder::SetVideoMode(media_video_mode_t mode)
- {
- if(this->decoder)
- return this->decoder->SetVideoMode(mode);
- return MP_RESULT_ERROR;
- }
- MP_RESULT MediaVideoDecoder::SetQuality(DWORD quality)
- {
- if(this->decoder)
- return this->decoder->SetQuality(quality);
- return MP_RESULT_ERROR;
- }
- DWORD MediaVideoDecoder::GetQuality()
- {
- if(this->decoder)
- return this->decoder->GetQuality();
- return 0;
- }
- MP_RESULT MediaVideoDecoder::Decompress(MediaBuffer *mb_out, unsigned int stride)
- {
- if(this->decoder)
- return this->decoder->Decompress(mb_out, stride);
- return MP_RESULT_ERROR;
- }
- MP_RESULT MediaVideoDecoder::Drop(MediaBuffer *mb_out, unsigned int stride)
- {
- if(this->decoder)
- return this->decoder->Drop(mb_out, stride);
- return MP_RESULT_ERROR;
- }