smilestone,你好:
我想问您一下,下面这段代码有什么作用,个人不知道有什么用?还请您在闲暇的时候看看,谢谢!
static Void *Chains_ipcBitsRecvFxn(Void * prm)
{
Chains_IpcBitsCtrl *ipcBitsCtrl = (Chains_IpcBitsCtrl *) prm;
Chains_IpcBitsCtrlThrObj *thrObj = &ipcBitsCtrl->thrObj;
Chains_IpcBitsCtrlFileObj *fObj = &ipcBitsCtrl->fObj;
static Int printStats;
{
Chains_IpcBitsCtrl *ipcBitsCtrl = (Chains_IpcBitsCtrl *) prm;
Chains_IpcBitsCtrlThrObj *thrObj = &ipcBitsCtrl->thrObj;
Chains_IpcBitsCtrlFileObj *fObj = &ipcBitsCtrl->fObj;
static Int printStats;
OSA_printf("CHAINS_IPCBITS:%s:Entered...",__func__); //__func__:预定义标识符,等于函数名
while (FALSE == thrObj->exitBitsInThread)
{
OSA_semWait(&thrObj->bitsInNotifySem,OSA_TIMEOUT_FOREVER);
Chains_ipcBitsProcessFullBufs(SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0,
thrObj,
fObj);
if ((printStats % CHAINS_IPCBITS_INFO_PRINT_INTERVAL) == 0)
{
OSA_printf("CHAINS_IPCBITS:%s:INFO: periodic print..",__func__);
}
printStats++;
}
OSA_printf("CHAINS_IPCBITS:%s:Leaving...",__func__);
return NULL;
}
while (FALSE == thrObj->exitBitsInThread)
{
OSA_semWait(&thrObj->bitsInNotifySem,OSA_TIMEOUT_FOREVER);
Chains_ipcBitsProcessFullBufs(SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0,
thrObj,
fObj);
if ((printStats % CHAINS_IPCBITS_INFO_PRINT_INTERVAL) == 0)
{
OSA_printf("CHAINS_IPCBITS:%s:INFO: periodic print..",__func__);
}
printStats++;
}
OSA_printf("CHAINS_IPCBITS:%s:Leaving...",__func__);
return NULL;
}
答复:
static Void Chains_ipcBitsProcessFullBufs(UInt32 ipcBitsInLinkId,
Chains_IpcBitsCtrlThrObj *thrObj,
Chains_IpcBitsCtrlFileObj *fObj)
{
Bitstream_BufList fullBufList;
Bitstream_Buf *pFullBuf;
Bitstream_Buf *pEmptyBuf;
Int i,status;
IpcBitsInLink_getFullVideoBitStreamBufs(ipcBitsInLinkId,
&fullBufList);
for (i = 0; i < fullBufList.numBufs; i++)
{
status = OSA_queGet(&thrObj->bufQFreeBufs,(Int32 *)(&pEmptyBuf),
OSA_TIMEOUT_FOREVER);
OSA_assert(status == 0);
pFullBuf = fullBufList.bufs[i];
Chains_ipcBitsCopyBitBufInfo(pEmptyBuf,pFullBuf);
Chains_ipcBitsCopyBitBufDataMem2Mem(pEmptyBuf,pFullBuf);
status = OSA_quePut(&thrObj->bufQFullBufs,
(Int32)pEmptyBuf,OSA_TIMEOUT_NONE);
OSA_assert(status == 0);
}
if (fObj->enableFWrite)
{
Chains_ipcBitsWriteBitsToFile(fObj->fpWrHdr,
fObj->fpWrData,
&fullBufList,
fObj->maxFileSize,
fObj->fwriteEnableBitMask);
}
IpcBitsInLink_putEmptyVideoBitStreamBufs(ipcBitsInLinkId,
&fullBufList);
}
作用是从
IpcBitsInLink 接收bit数据,然后写到文件里面;
有用的dm8168帖子: