Google
  Web www.spinics.net

capture.c example

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


Hi, I have a 4 input Hauppage ImpactVCB.

I have modified capture.c to display frames from an input using SDL
and the mmap method and this seems to work great.  I would like to
modify capture.c to display video using 2 inputs.  The problem is that
if I change inputs, I have to wait for another frame to enter the
buffer.  This cuts the frame rate in half.

How do I capture frames from two inputs without cutting the frame rate?


static void
mainloop                        (void)
{
   unsigned int count;

   count = 1000;

   //Frame_timer = SDL_AddTimer(INTERVAL, process_image, NULL);
   while (count-- > 0)
   {
      for (;;)
      {
         fd_set fds;
         struct timeval tv;
         int r;

         FD_ZERO (&fds);
         FD_SET (fd, &fds);

         /* Timeout. */
         tv.tv_sec = 2;
         tv.tv_usec = 0;

         r = select (fd + 1, &fds, NULL, NULL, &tv);

         if (-1 == r)
         {
            if (EINTR == errno)
               continue;

            errno_exit ("select");
         }

         if (0 == r)
         {
            fprintf (stderr, "select timeout\n");
            exit (EXIT_FAILURE);
         }

//         if (read_frame (0))
         {
            ;
            //r = select (fd + 1, &fds, NULL, NULL, &tv);
         }


         while(read_frame (0)==0)  // I modified read_frame to change
the input: read_frame(int input_number)
            r = select (fd + 1, &fds, NULL, NULL, &tv);

         while(read_frame (1)==0)
            r = select (fd + 1, &fds, NULL, NULL, &tv);
            break;

         /* EAGAIN - continue select loop. */
      }
      printf("Count is %d\n", count);
   }
}

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

[Home]     [Older V4L]     [Linux DVB]     [Video Disk Recorder]     [Video Technology]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Plasma TVs]     [Video Projectors]     [PDAs]     [Xorg]     [Util Linux NG]     [Xfree86]     [Devices]     [Big List of Linux Books]     [Free Photo Albums]     [LCD TVs]     [Fedora Users]     [Webcams]     [Fedora Women]     [HDTV]     [ALSA Users]     [ALSA Devel]     [Stuff]     [SSH]     [DVB Maintainers]     [Linux USB]

Add to Google Powered by Linux