Dear Sir,
I use Vsys_allocBuf to get 4M memory and OSA_DMA copy YUV data from Vcam_getFullVideoFrames(&bufList,0) in the ti_mcfw_ipcframes.c
There is src code
static Void * App_ipcFramesSendRecvFxn(Void * prm)
{
App_IpcFramesCtrlThrObj *thrObj = ( App_IpcFramesCtrlThrObj *) prm;
static Int printStatsInterval = 0;
VIDEO_FRAMEBUF_LIST_S bufList;
Int status;
Vsys_AllocBufInfo HDYUV, *pHDYUV;
pHDYUV=&HDYUV;
VIDEO_FRAMEBUF_S *pBuf;
UInt32 frameSize = 0;
int i=0;
FILE *fp;
char a[50];
CMEM_init();
//==========================================================================
OSA_printf("MCFW_IPCFRAMES:%s:Entered...",__func__);
OSA_semWait(&thrObj->framesInNotifySem,OSA_TIMEOUT_FOREVER);
OSA_printf("MCFW_IPCFRAMES:Received first frame notify...");
while (FALSE == thrObj->exitFramesInOutThread)
{
Vsys_allocBuf(VSYS_SR1_SHAREMEM, HD_YUV_SIZE, 32, &HDYUV);
status = Vcam_getFullVideoFrames(&bufList,0);
OSA_assert(0 == status);
if( bufList.numFrames )
{
sprintf(a,"/home/VID_CH%02d.yuv",i++);
fp=fopen(a,"wb");
if( fp == NULL ) perror("FOPEN:");
fseek(fp, 0L, SEEK_SET);
App_ipcFramesPrintFullFrameListInfo(&bufList,"FullFrameList");
pBuf = &bufList.frames[0];
frameSize = (pBuf->frameWidth * pBuf->frameHeight) << 1;
OSA_dmaCoFill( (Uint8 *)pBuf->phyAddr[0][0], (Uint8 *)pHDYUV->physAddr, frameSize);
fwrite((Uint8 *)pHDYUV->virtAddr, 1, frameSize, fp);
fclose(fp);
status = Vdis_putFullVideoFrames(&bufList);
OSA_assert(0 == status);
}
status = Vdis_getEmptyVideoFrames(&bufList,0);
OSA_assert(0 == status);
if( bufList.numFrames )
{
App_ipcFramesPrintFullFrameListInfo(&bufList,"EmptyFrameList");
status = Vcam_putEmptyVideoFrames(&bufList);
OSA_assert(0 == status);
}
#ifdef IPC_FRAMES_DEBUG
if( (printStatsInterval % 1000)==0)//MCFW_IPCFRAMES_INFO_PRINT_INTERVAL) == 0)
{
OSA_printf("MCFW_IPCFRAMES:%s:INFO: periodic print..",__func__);
}
#endif
printStatsInterval++;
Vsys_freeBuf(VSYS_SR1_SHAREMEM, pHDYUV->virtAddr, HD_YUV_SIZE);
OSA_waitMsecs(MCFW_IPCFRAMES_SENDRECVFXN_PERIOD_MS);
}
OSA_printf("MCFW_IPCFRAMES:%s:Leaving...",__func__);
return NULL;
}
The YUV image is opened by DCC Tools but the Images just has top only.
I also saw the struct VIDEO_FRAMEBUF_S below:
typedef struct {
Ptr addr[VIDEO_MAX_FIELDS][VIDEO_MAX_PLANES];
/**< virtual address of vid frame buffer pointers */
Ptr phyAddr[VIDEO_MAX_FIELDS][VIDEO_MAX_PLANES];
/**< virtual address of vid frame buffer pointers */
VCAP_CHN channelNum;
/**< Coding type */
UInt32 timeStamp;
/**< Capture or Display time stamp */
UInt32 fid;
/**< Field indentifier (TOP/BOTTOM/FRAME) */
UInt32 frameWidth;
/**< Width of the frame */
UInt32 frameHeight;
/**< Height of the frame */
UInt32 framePitch[VIDEO_MAX_PLANES];
/**< Pitch of the frame */
Ptr linkPrivate;
/**< Link private info. Application should preserve this value and not overwrite it */
} VIDEO_FRAMEBUF_S;
The question is:
How can I do to assemble YUV data from VIDEO_FRAMEBUF_S struct.
Thank you.