B-3
void H264BP_outputNalUnit(
unsigned int *pNalu,
unsigned int *pPacketSizeInBytes
)
{
int currPacketPtr = (int)ph264PacketBitStream;
int maxPacketPtr = (int)ph264PacketBit
sizeof(h264TotalPacketBitStream);
memcpy( ph264PacketBitStream, pNalu, *pPacketSizeInBytes );
ph264PacketBitStream += *pPacketSizeInBytes;
#if DEBUG
if ( currPacketPtr > maxPacketPtr )
{
printf("bitstream too large: %i bytes\n",
*pPacketSizeInBytes);
}
#endif
}
2) In dynamic parameters, set the call back function pointer.
/* This structure defines the run time parameters for
H264VEnc object */
IH264VENC_DynamicParams dynamicParams;
/* Set the call back function pointer to application
specific function */
dynamicParams
.videnc2DynamicParams.
putDataFxn =
H264BP_outputNalUnit;
/* Control call to set the dynamic parameters */
control(.., XDM_SETPARAMS,..)Call Back function for NAL Units
3) Call frame encode API.
/* Process call to encode one frame */
process(.. ,.. , outputBufDesc, .. );
During this process, encoder will call the call back function for each NAL
unit.