[FFmpeg-devel] [PATCH] handle EAGAIN case in ffmpeg.c

Luca Abeni lucabe72
Wed Sep 12 13:01:30 CEST 2007


Hi Benoit,

Benoit Fouet wrote:
[...]
>>> what i'm trying to do is having v4l2 working
>>>     
>> Unless something broke in the last two or three weeks, v4l2 should be 
>> already working... What's the problem you are seeing?
>>   
> 
> shouldn't the DQBUF return EAGAIN when it has no frame available ?

According to my understanding of the v4l2 specification, EAGAIN is only 
returned if the video device has been opened using the O_NONBLOCK flag.

[...]
>> The way is currently works is that the v4l2 input format blocks until 
>> there is an available frame (unless you specify the 
>> AVFMT_FLAG_NONBLOCK... In that case you have to modify ffmpeg.c)
>>
>>   
> 
> i thought the DQBUF was always a non blocking ioctl, isn't it the case ?

According to
http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec-single/v4l2.html#VIDIOC-QBUF
(which should be the authoritative reference, I think)
"By default VIDIOC_DQBUF blocks when no buffer is in the outgoing queue. 
When the O_NONBLOCK flag was given to the open() function, VIDIOC_DQBUF 
returns immediately with an EAGAIN error code when no buffer is available."
So, the current code should be ok... As I said, it worked fine last time 
I tested it :)

What's the behaviour you see when you try to capture video with ffmpeg? 
Which capture card (and drivers) are you using?



			Thanks,
				Luca




More information about the ffmpeg-devel mailing list