代码基本仿照C:dvsdk_1_11_00_00_DM648examplesvideo_previewevmDM648下面的video_preview.c来写,代码如下:VOID DM648_VideoCapAndDisplay(VOID)
{
Int32 status = DRV_SUCCESS;
FVID_Frame *frameBuffPtr = NULL;
FVID_Handle disChan, capChan;
int i = 0; /* Allocate both capture and display frame buffers
in external heap memory */
vCapParamsChan.segId = DDR_HEAP;
vDisParamsChan.segId = DDR_HEAP; /* Assign EDMA3 driver handle to channel params */
vCapParamsChan.hEdma = hEdma;
vDisParamsChan.hEdma = hEdma;
/* Setting num frame buffers to zero signals the video drivers to allow
* the application to own the buffers.
*/
vCapParamsChan.numFrmBufs = 0;
vDisParamsChan.numFrmBufs = 0; /* create video input channel */
if (DRV_SUCCESS == status) {
capChan = FVID_create("/VP1CAPTURE/A/2", /* VP1, Channel A, External Decoder 0 "/VP1CAPTURE/A/2 ??"*/
IOM_INPUT, &status, (Ptr)&vCapParamsChan, NULL);
} /* create video output channel, plane 0 */
if (DRV_SUCCESS == status) {
disChan = FVID_create("/VP2DISPLAY/SAA7105", IOM_OUTPUT, /* VP2, External Encoder 0 */
&status, (Ptr)&vDisParamsChan, NULL);
}
/* allocate and prime frame buffers for the capture channel */
/*FVID_allocBuffer alloc three buffer for one frame video*/
if (DRV_SUCCESS == status) {
for (i=0; i < FRAME_BUFF_CNT && status == DRV_SUCCESS; i++) {
status = FVID_allocBuffer(capChan, &frameBuffPtr); if (status == IOM_COMPLETED) {
status = FVID_queue(capChan, &frameBuffPtr);
}
}
}
/* allocate and prime frame buffers for the display channel */
if (DRV_SUCCESS == status) {
for (i=0; i < FRAME_BUFF_CNT && status == DRV_SUCCESS; i++) {
status = FVID_allocBuffer(disChan, &frameBuffPtr); if (status == IOM_COMPLETED) {
status = FVID_queue(disChan, &frameBuffPtr);
}
}
}
/* Configure external video encoders (SAA7105) & decoders (TVP5154) */
if (DRV_SUCCESS == status)
{
/* Configure SAA7105 */
status |= FVID_control(disChan,
VPORT_CMD_EDC_BASE + EDC_CONFIG,
(Ptr)&vDisParamsEncoder);
/* Configure TVP5154 */
status |= FVID_control(capChan,
VPORT_CMD_EDC_BASE + EDC_CONFIG,
(Ptr)&vCapParamsDecoder);
} /* start capture & display operation */
if(DRV_SUCCESS == status)
{
status |= FVID_control(disChan, VPORT_CMD_START, NULL);
if(DRV_SUCCESS == status)
{
status |= FVID_control(capChan, VPORT_CMD_START, NULL);
}
}
/* grab first buffer from input queue */
if (DRV_SUCCESS == status) {
status = FVID_dequeue(disChan, &frameBuffPtr);
} /* loop forever performing video capture and display */
while (status == 0) { /* grab a fresh video input frame */
FVID_exchange(capChan, &frameBuffPtr); /* display the video frame */
FVID_exchange(disChan, &frameBuffPtr);
}
}代码运行到status = FVID_dequeue(disChan, &frameBuffPtr)处就出错了,打断点发现:根据qout链为空,明显不满足条件表达式:
if ((viop = (FVID_Frame *)QUE_dequeue(&chan->qOut)) != (FVID_Frame *)& chan->qOut)进而返回retVal = packet->status = IOM_PENDING;
总感觉少了什么触发,没把qIn的buffer挂到qOut上,求指导
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>