I've been, since then working on ndk_1_92_00_22_eval version for DM6437 device. The udpHello.c program in the Hello World project is being used for network send/rcv, as far as i guess. Now i'm trying to modify the program and map the encoded video from video_encdec.pjt to this program but i'm not getting how to map the encoded video on the network code. Below are related code snippets of both the related video_encdec.pjt for video encode and helloWorld.pjt for packet send/rcv.
udphello.c
int dtask_udp_hello( SOCKET s, UINT32 unused )
{
struct sockaddr_in sin1;
struct timeval to;
int i,tmp;
char *pBuf;
HANDLE hBuffer;
(void)unused;
// Configure our socket timeout to be 3 seconds
to.tv_sec = 3;
to.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );
for(;;)
{
tmp = sizeof( sin1 );
i = (int)recvncfrom( s, (void **)&pBuf, 0, &sin1, &tmp, &hBuffer );
// Spit any data back out
if( i >= 0 )
{
sendto( s, pBuf, i, 0, &sin1, sizeof(sin1) );
recvncfree( hBuffer );
}
else
break;
}
// Since the socket is still open, return "1"
// (we need to leave UDP sockets open)
return(1);
}
Video Encode portion of video_encdec.pjt.
for (n=0;;n++) {
/* prepare "per loop" buffer descriptor settings */
inBufDesc.bufs = &src;
encoded = encodedBuf;
encodedBufDesc.bufs = &encodedBuf;
outBufDesc.bufs = &dst;
/* grab a fresh video input frame */
FVID_exchange(hGioVpfeCcdc, &frameBuffPtr);
/* Set as input buffer to Encoder: */
src = frameBuffPtr->frame.frameBufferPtr;
/* encode the frame */
status = VIDENC_process(enc, &inBufDesc, &encodedBufDesc, &encInArgs,
&encOutArgs);
Memory_cacheWbInv(encoded, encOutArgs.bytesGenerated);
if (status != VIDENC_EOK) {
printf("Encoder frame %d processing FAILED, status = 0x%x, "
"extendedError = 0x%x\n", n, status, encOutArgs.extendedError);
break;
}
/* Reuse the video input frame for display exchange: */
dst = frameBuffPtr->frame.frameBufferPtr;
if (encOutArgs.bytesGenerated == 0)
{
printf("Frame %d dropped\n", n);
}
/* decode the frame */
decInArgs.numBytes = encOutArgs.bytesGenerated;
status = VIDDEC_process(dec, &encodedBufDesc, &outBufDesc, &decInArgs,
&decOutArgs);
if (status != VIDDEC_EOK) {
printf("Decoder frame %d processing FAILED, status = 0x%x, "
"extendedError = 0x%x\n", n, status, decOutArgs.extendedError);
break;
}
else {
Memory_cacheWbInv(dst, framesize);
}
/* display the video frame */
FVID_exchange(hGioVpbeVid0, &frameBuffPtr);
}
Now i'm not sure how to map the encoded video frame into the udp program.
Kindly give any suggestion or hint if possible.
Thanks!