double buffering problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I'm  trying  to  use  double  buffering to  burst  the  throuput  of  an
application of mine.

I'm having the problem  that if I try to use 2 frames,  the first one is
correct and  the second  one not.  The second one  is the  previous one,
which has already been elaborated. I can't understand why I can't get it
working.

I don't post all the code because it is too long, but here are some
lines, maybe you can tell me we're the bug...

  fd = open (telecamera (), O_RDWR);
                                                                                                               
  if (ioctl (fd, VIDIOCGMBUF, &b) < 0)
    {
      fprintf (stderr, "Visione, %s %d : VIDIOCGMBUF fallito\n", __FILE__,
               __LINE__);
      exit (1);
    }
                                                                                                               
  map = mmap (0, b.size, PROT_READ | PROT_READ, MAP_SHARED, fd, 0);
  if (map == MAP_FAILED)
    {
      fprintf (stderr, "Visione, %s %d : MMAP fallita\n", __FILE__, __LINE__);
      exit (1);
    }

  if (ioctl (fd, VIDIOCMCAPTURE, &v) < 0)
    {
      fprintf (stderr, "Visione, %s %d : VIDIOCMCAPTURE fallito\n",
               __FILE__, __LINE__);
      exit (1);
    }

...

  while (1)
    {
      /* read frame 0, get number 1 */
      v.frame = 1;
      ioctl (fd, VIDIOCMCAPTURE, &v);
      v.frame = 0;
      ioctl (fd, VIDIOCSYNC, &v.frame);
                                                                                                               
      /* elaborate frame 0 */
      ...

      /* read frame 1, get number 0 */
      v.frame = 0;
      ioctl (fd, VIDIOCMCAPTURE, &v);
      v.frame = 1;
      ioctl (fd, VIDIOCSYNC, &v.frame);

      /* elaborate  frame 1 */
      ...
    }

I've followed the  kernel documentation, but it doesn't  work. I've even
tried  to see  if  my card  doesn't support  double  buffering, but  the
video_mbuf b in VIDIOCGMBUF says that b.frame = 4 .

What's wrong?

-- 
Non c'è più forza nella normalità, c'è solo monotonia.

Attachment: pgplu92YswzJh.pgp
Description: PGP signature


[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux