[Ffmpeg-devel] grab.c changes

Luca Abeni lucabe72
Thu May 18 08:53:29 CEST 2006

Hi Richard,

On Thu, 2006-05-18 at 15:01 +1000, Richard wrote:
> Hello all,
> I'm questioning the latest changes done to grab.c (v1.44) regarding
> the lines around line 220. The previous version I had executed:
> "ret = ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf)"
> and upon failure would try various other video formats before
> deciding that the grab device did not support a suitable format. The
> latest version tries one ioctl(...) call with one format and if that
> fails then it assumes an unsupported format.
The "palette selection" code has been moved before, using
ioctl(video_fd, VIDIOCSPICT, ...) instead of ioctl(video_fd,
VIDIOCMCAPTURE,...) - look around line 157.

So, at line 220 pict.palette should be already set to a supported value.

>  I can supply a patch to
> have this fixed but it's essentially rolling back to the previous
> version.
> Can anyone comment on the changes made to grab.c and why they're
> preferred over the previous version?
It seems that the previous method did not work for webcams. An user
(Flavio Pimentel Duarte) debugged the problem, and provided the patch
that I committed. I verified that the patch did not break anything in
all the cases I was able to test.

What's the problem you are experiencing? Can you describe it in more
details? Isn't the code around line 157 working for you?

Also, please note that grab.c is unmaintained, and video4linux is
deprecated in linux. If possible, you should use video4linux2. If
libavformat/v4l2.c is not working for you, please let me know and I'll
try to fix the problem.

Proud to be "coglione"

More information about the ffmpeg-devel mailing list