[FFmpeg-devel] [PATCH] Improve video4linux? reporting in case of wrong size or timebase

Michael Niedermayer michaelni
Tue Aug 5 22:54:52 CEST 2008


On Tue, Aug 05, 2008 at 08:27:20PM +0200, Stefano Sabatini wrote:
> Hi,
> 
> sligthly more complicated code, slightly more idiot-proof error
> reporting.
> 
> Rationale: a program should say clearly what the problem is if this
> can be correctly determined rather than force the user to guess it
> choosing between N possible ones.
> 
> Regards.
> -- 
> FFmpeg = Frenzy and Fiendish Merciful Portable Extended God

> Index: libavdevice/v4l.c
> ===================================================================
> --- libavdevice/v4l.c	(revision 14623)
> +++ libavdevice/v4l.c	(working copy)
> @@ -78,12 +78,14 @@
>      int j;
>      int vformat_num = sizeof(video_formats) / sizeof(video_formats[0]);
>  
> -    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
> -        av_log(s1, AV_LOG_ERROR, "Bad capture size (%dx%d) or wrong time base (%d)\n",
> -            ap->width, ap->height, ap->time_base.den);
> -
> +    if (ap->width <= 0 || ap->height <= 0) {
> +        av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
>          return -1;
>      }
> +    if (ap->time_base.den <= 0) {
> +        av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
> +        return -1;
> +    }
>  
>      width = ap->width;
>      height = ap->height;

ok


> Index: libavdevice/v4l2.c

not maintained by me

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080805/b6ce36e2/attachment.pgp>



More information about the ffmpeg-devel mailing list