[FFmpeg-devel] [PATCH] Make ffmpeg use parse_number_or_die instead of atoi

Stefano Sabatini stefano.sabatini-lala
Fri Mar 7 01:34:07 CET 2008


as in $subject,

improves error management, diagnostic and reduces code size.


-    video_qscale = atof(arg);
+    video_qscale = parse_number_or_die("qscale", arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
     if (video_qscale <= 0 ||
         video_qscale > 255) {
         fprintf(stderr, "qscale must be > 0.0 and <= 255\n");

I didn't do:
video_qscale = parse_number_or_die("qscale", arg, OPT_FLOAT, nextafter(0,1), 255)

because the resulting message for an error of the kind:
ffmpeg -qscale 0

would result as: 
"The value for qscale was 0 which is not within 0 - 255"

which is indeed quite confusing. Anyway the code for opt_qscale is
going to be removed soon with the libavilter inclusion.

Best regards.
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-ffmpeg-use-parse-number-or-die-00.patch
Type: text/x-diff
Size: 5969 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080307/5165ba1a/attachment.patch>

More information about the ffmpeg-devel mailing list