原来是这样的!
unsigned int pYUVBuf[2];
// FrameExtractor Initialization
pCTX = FrameExtractorInit(FRAMEX_IN_TYPE_MEM, delimiter_h264, sizeof(delimiter_h264), 1);
file_strm.p_start = file_strm.p_cur = (unsigned char *)imgbuf;
file_strm.p_end = (unsigned char *)(imgbuf + imglen);
FrameExtractorFirst(pCTX, &file_strm);
if (opt_debug)
printf("image leng=%ld ",(long)imglen);
// Next H.264 VIDEO stream
nFrameLeng = NextFrameH264(pCTX, &file_strm, pStrmBuf, INPUT_BUFFER_SIZE, NULL);
printf("nFrameLeng=%d \n",nFrameLeng);
// 5. DECODE (SsbSipH264DecodeExe)
if (SsbSipH264DecodeExe(handle, nFrameLeng) != SSBSIP_H264_DEC_RET_OK)
return -1;
// 6. Obtaining the Output Buffer (SsbSipH264DecodeGetOutBuf)
SsbSipH264DecodeGetConfig(handle, H264_DEC_GETCONF_PHYADDR_FRAM_BUF, pYUVBuf);
/* 7. Set specific ioctl - MFC output physical address */
ctrl.id = V4L2_CID_MPEG_STREAM_PID_VIDEO;
ctrl.value = pYUVBuf[0]; // COMPOSITE
ret = ioctl(tvout_fp, VIDIOC_S_CTRL, &ctrl);
if(ret < 0) {
printf("V4L2 APPL : ioctl(VIDIOC_S_CTRL) failed\n");
return -1;
}
//usleep(15000); // 15ms delay for natural video display
/* Start TV_OUT */
if (!tvout_status) { // peter added
ret = ioctl(tvout_fp, VIDIOC_S_TVOUT_ON, NULL); // Just once executed because of the free-run mode
if(ret < 0) {
printf("V4L2 APPL : ioctl(VIDIOC_S_TVOUT_ON) failed\n");
return -1;
}
tvout_status = 1;
}
return 0;