Hi,

video(1) fails to read files that were previously recorded with -o
somefile, unless -g (to select read(2) as the input method) is also
specified:

   $ video -o foo
   ^C
   $ video -i foo
   video: ioctl VIDIOC_REQBUFS: Bad file descriptor
   $ video -g -i foo
   [ plays the file ]

mmap-mode doesn't work here because it uses a few v4l2-specific ioctls
to talk to the video device.

The patch below fixes that by always using read(2) when the -i option is
used.

-- 
        Gregor

Index: video.1
===================================================================
RCS file: /mnt/media/cvs/xenocara/app/video/video.1,v
retrieving revision 1.13
diff -u -p -r1.13 video.1
--- video.1     4 Jun 2016 07:44:32 -0000       1.13
+++ video.1     14 Sep 2016 19:47:52 -0000
@@ -113,6 +113,10 @@ If
 is
 .Ql - ,
 frames will be read from standard input.
+This will use
+.Xr read 2
+to grab frames instead of
+.Xr mmap 2 .
 .It Fl O Ar output
 File to which frames will be written.
 If
Index: video.c
===================================================================
RCS file: /mnt/media/cvs/xenocara/app/video/video.c,v
retrieving revision 1.19
diff -u -p -r1.19 video.c
--- video.c     6 Jun 2016 19:31:22 -0000       1.19
+++ video.c     14 Sep 2016 19:46:39 -0000
@@ -1805,6 +1805,7 @@ main(int argc, char *argv[])
                                err++;
                        } else {
                                vid.mode = (vid.mode & ~M_IN_DEV) | M_IN_FILE;
+                               vid.mmap_on = 0; /* mmap mode does not work for 
files */
                                snprintf(vid.iofile, sizeof(vid.iofile),
                                    optarg);
                        }

Reply via email to