This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to use the user defined buffer to save the capture data(example saLoopbackFbdev,but not use fbdev buffer)

Other Parts Discussed in Thread: TVP7002

Hello all:
           I use the ADV7611(or TVP7002 ) which support HMDI receive to capture the 1280*720 video,and show on the  LCD screens  which only supports 
the resolution of 1024*600 and must be RGB ,not YUV .So based on the example of  saLoopbackFbedev, I have to get the 1280*720 capture data to another 
user buffer(not FBDEV buffer as the example) first and then extract 1024*600 by some algorithm ,But when I use my new user buffer to replace the fbdev buffer,
I found there are many *** question,eg:the programe will be crashed undefined,the picture is overlapping 。。。。althouh I use the methord to show the video on the TV Screeen which support 1280*720(so I not extract anything),still exist the above question,
My steps are: 
      (1)Add the new variable which will be used  to as the buffer  of caputre.
        unsigned char *captBufferArray[MAX_BUFFER];
     (2In function "setupFbdevAndBuffers"  add:
       captBufferArray[0]=(unsigned char *)malloc(1280*720*3*MAX_BUFFER);
for (i = 1; i < MAX_BUFFER; i++)
captBufferArray[i] = captBufferArray[i-1] + 1280*720*3;
memset(captBufferArray[0], 0x00,1280*720*3*MAX_BUFFER);
     (3)In function "queueCaptureBuffers" ,Replace fbdev.buffer_addr  with the capBufferArray.
 static int queueCaptureBuffers(void)
{
int ret, i;
for (i = 0; i < MAX_BUFFER; i++) {
capt.buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
capt.buf.memory = V4L2_MEMORY_USERPTR;
capt.buf.index = i;
/*capt.buf.m.userptr = (unsigned long)fbdev.buffer_addr[0];*/
        capt.buf.m.userptr = (unsigned long)captBufferArray[capt.buf.index];
capt.buf.length =1280*720*3;
ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
if (ret < 0) {
perror("VIDIOC_QBUF\n");
/*return -1;*/
}
}
return ret;
}
(4)
static int app_main(int argc , char *argv[])
{
-----------
for (i = 0; i < MAXLOOPCOUNT; i++)
{
    /*
  Get capture buffer using DQBUF ioctl
*/
/*printf("Get capture buffer 1\n");*/
ret = ioctl(capt.fd, VIDIOC_DQBUF, &capt.buf);
if (ret < 0) {
printf("VIDIOC_DQBUF\n");
/*return -1;*/
}
         memcpy(fbdev.buffer_addr[0],(unsigned char *)(capt.buf.m.userptr),1280*3*720);
-------------
capt.buf.m.userptr = (unsigned long)captBufferArray[capt.buf.index];
capt.buf.length = 1280*3*720;
ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
if (ret < 0) {
perror("VIDIOC_QBUF\n");
/*return -1;*/
}
}
Am I right?Is there something wrong? 
Thanks very much.
                                       zhichao.