代码大致按照C:\dvsdk_1_11_00_00_DM648\examples\video_preview\evmDM648\video_preview.c 来写的,代码如下:
if (DRV_SUCCESS == status) {
capChan = FVID_create("/VP1CAPTURE/A/0", /* 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 (status == 0) {
for (i=0; i < FRAME_BUFF_CNT && status == 0; 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 (status == 0) {
for (i=0; i < FRAME_BUFF_CNT && status == 0; 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[2]);
}
else
{
LOG_printf(&LOGtrace,"Failed to open – Display channel\n");
}
/* 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);
if(DRV_SUCCESS != status)
{
LOG_printf(&LOGtrace,"Failed to start capture device\n");
}
}
else
{
LOG_printf(&LOGtrace,"Failed to start dispaly device\n");
}
}
else
{
LOG_printf(&LOGtrace,"Failed to configure cap/disp channel device\n");
}
/* grab first buffer from input queue */
if (status == 0) {
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);
}
上板子运行到FVID_dequeue(disChan, &frameBuffPtr);就不行了。
FVID_dequeue对应C:\dvsdk_1_11_00_00_DM648\pspdrivers_1_10_00\packages\ti\sdo\pspdrivers\drivers\vport\src\vportdis.c中的mdSubmitChan函数,即会进入 _cmdDequeue函数,而该函数中:if ((viop = (FVID_Frame *)QUE_dequeue(&chan->qOut)) != (FVID_Frame *)&chan->qOut) ,跟代码发现前后两者一致进而没有获取到缓存,但是前面三次FVID_allocBuffer和FVID_queue,感觉都是把分配出的缓存挂在chan->qIn,但为什么 _cmdDequeue确实取的chan->qOut?求助啊~~~~~
jun pu:
以后再也不用TI的片子了~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~