Hello There:
I' using a TMS320DM648 evalutation board and my applicaton has to change video channel parameters at run time. I created the following function to do so:
Int configVideoCap(Uint8 channel, ChannelInfo *pCapChInfo)
{
Int status;
Uint8 i;
// Stop video channel.
status = FVID_control(pCapChInfo->chanHandle, VPORT_CMD_STOP, NULL);
// Toggle port scaling parameter.
staticCapParams[channel].scale ^= VPORT_SCALING_ENABLE;
// Free current frame buffer.
status |= FVID_freeBuffer(pCapChInfo->chanHandle, &(pCapChInfo->frame));
// Free remaing frame buffers.
for(i = 0; i < CAP_NUM_FRAME_BUF - 1; i++)
{
status |= FVID_dequeue(pCapChInfo->chanHandle, &(pCapChInfo->frame));
status |= FVID_freeBuffer(pCapChInfo->chanHandle, &(pCapChInfo->frame));
}
// Change channel parameters.
status |= FVID_control(pCapChInfo->chanHandle, VPORT_CMD_CONFIG_CHAN,
(Ptr)&staticCapParams[channel]);
// Allocate and prime buffers again.
for(i = 0; i < CAP_NUM_FRAME_BUF; i++)
{
status |= FVID_allocBuffer(pCapChInfo->chanHandle, &(pCapChInfo->frame));
status |= FVID_queue(pCapChInfo->chanHandle, &(pCapChInfo->frame));
}
// Restart video channel.
status |= FVID_control(pCapChInfo->chanHandle, VPORT_CMD_START, NULL);
return(status);
}
It works fine the first time is called, however, in the second time, FVID_dequeue() returns weired pointers which for sure do not contain any frame buffer. I'm using Normal mode.
If I comment out the following line:
// Toggle port scaling parameter.
//staticCapParams[channel].scale ^= VPORT_SCALING_ENABLE;
It works fine all the time.
I would appreciate if someone could help me to ping point the problem in the function provided or let me know what is the proper procedure to change the parameters.
Thanks;
Gabriel