h263decoder.cpp

来自「一个优化的H.263解码器,性能达到商用级」· C++ 代码 · 共 55 行

CPP
55
字号
// H263decoder.cpp: implementation of the CH263Decoder class.
//
//////////////////////////////////////////////////////////////////////

#include "H263decoder.h"
#include "bitstream.h"
#include "byteordr.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CH263Decoder::CH263Decoder()
{
	pDecoder = NULL;
	pDecoder = new CBitStream();
	if(pDecoder)
		pDecoder->ATInitH263Decode();
}

CH263Decoder::~CH263Decoder()
{
	if(pDecoder)
		pDecoder->ATDestroyH263Decode();

	if(NULL !=pDecoder)
		delete pDecoder;
	pDecoder = NULL;
}

int CH263Decoder::ATDecodeH263Frame(unsigned char *buffer, int length, unsigned char **rgb, int *width, int *height)
{
	if (pDecoder == NULL) {
		return -1;}
	return pDecoder->ATDecodeH263Frame(buffer+4,length-4,rgb,width,height);
}

//void CH263Decoder::SetDecoderUsing(bool bUse)
//{
//	m_bIsUsing = bUse;
//}

//bool CH263Decoder::GetDecoderUsing()
//{
//	return m_bIsUsing;
//}

bool CH263Decoder::IsKeyFrame(unsigned char *buffer)
{
	return pDecoder->IsKeyFrame(buffer + 4);
}

unsigned long CH263Decoder::GetTimeStamp(unsigned char *buffer)
{
	return Net2HostLong(*(unsigned long*)buffer);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?