[FFmpeg-devel] [PATCH] Set frame rate on v4l2 devices

jose.goncalves at inov.pt jose.goncalves
Mon Sep 13 13:55:48 CEST 2010


Quoting M?ns Rullg?rd <mans at mansr.com>:
>>
>> First, initializing a struct with {0} instead of using a memset(). I
>> always use memset() because gcc gives a warning of "missing
>> initializer" in the other way if you activate the '-Wextra' option.
>
> Don't do that then.  The C standard makes it quite clear that missing
> elements in an initialiser are implicitly zero.  Just do it.

I assumed that when using the options "-std=c99 -Wextra" gcc would only 
give me warnings for not complying with the C standard. It seems I'm 
wrong. Nevertheless, I quickly take a look to the C99 standard, section 
6.7.8, and that is not so clear to me.

>
>> Second, testing ioctl error against -1 instead of negative. As rule of
>> thumb I test for a function error as the negation of returning
>> OK. Most ioctls return 0 for OK, but some return a positive value,
>> hence testing for negative.
>
> The ioctl() definition says it returns -1 on error.  Therefore,
> testing for -1 is correct and testing for negative is not.  The same
> goes for most system calls.  This is a very common mistake but a
> mistake nonetheless.
>

Hum... I tend to disagree. The definition also says that OK is 0 or a 
positive value. So it's better to assume that values not explicitly 
indicated (all negative, except -1) are an error. But, this is a minor 
thing, the important is to add the missing functionality to ffmpeg... 
here goes the corrected patch.

Regards,
Jos? Gon?alves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-svn-r25108-v4l2_set_frame_rate.patch
Type: text/x-patch
Size: 1421 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100913/b5726ead/attachment.bin>



More information about the ffmpeg-devel mailing list