admin 管理员组

文章数量: 1184232

读取本地文件,并逐帧读取:

onReadThread():

void RtspVideo::onReadThread()
{
	// 解码参数
	char *virInBuf = new char[MAX_DECODER_INPUT_BUFFER_SIZE];
	//初始化文件读入buf
	if (init_frame_parser() < 0) {
		fprintf(stderr, "Error: init frame parser\n");
	}
	// find the first SPS,PPS,SEI header -> 读取h264文件头到frmbuf中
	int frmlen;
	uint8_t * frmbuf;
	if ((frmlen = read_one_frame(fpi, &frmbuf, 1)) <= 0) {
		fprintf(stderr, "Error: cannot find header\n");
		deinit_frame_parser();
	}
	do {
		// read one frame
		if ((frmlen = read_one_frame(fpi, &frmbuf, 0)) <= 0) {
			break;
		}
		memcpy(virInBuf, frmbuf + 4, frmlen-4);
		{
			Poco::Mutex::ScopedLock s(m_bufLock);
			MyStruct *stu = new MyStruct();
			stu->pData = new char[frmlen-4];
			memcpy(stu->pData,

本文标签: 解码之读 文件 取本地