[Ffmpeg-devel] [PATCH] grabbing with V4L

Flavio Pimentel Duarte flaviop
Thu Feb 23 12:54:57 CET 2006


Hi Luca!

On Wed, 22 Feb 2006, Luca Abeni wrote:

> Hi Flavio,
>
> On Tue, 2006-02-21 at 08:32 -0300, Flavio Pimentel Duarte wrote:
> [...]
>>>>  	I also have one question: how do I force ffmpeg to use v4l instead
>>>> v4l2 ? Is there an option for it ? In my tests I had to compile ffmpeg
>>>> using '--disable-v4l2' option, otherwise it uses v4l2.
>>> Sorry, you currently have to disable v4l2 at configure time.
>>> I'll send a patch for ffmpeg.c as soon as I'll find some time (maybe
>>> tomorrow).
>>  	Ok. Thanks.
> Can you try the attached patch?
 	It did not work at first try. But it was not your patch's 
fault. I had to change v4l2.c. In open_device function, it did not close 
the device after an error detection. I am sending the changes I had to do 
in an attached patch.

Flavio
-------------- next part --------------
--- a/ffmpeg/libavformat/v4l2.c	2006-02-23 08:52:12.000000000 -0500
+++ b/ffmpeg/libavformat/v4l2.c	2006-02-23 08:52:22.000000000 -0500
@@ -123,12 +123,14 @@ static int device_open(const char *devna
 
     res = ioctl(fd, VIDIOC_QUERYCAP, &cap);
     if (res < 0) {
+        close(fd);
         av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
                  strerror(errno));
 
         return -1;
     }
     if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
+        close(fd);
         av_log(NULL, AV_LOG_ERROR, "Not a video capture device\n");
 
         return -1;



More information about the ffmpeg-devel mailing list