[FFmpeg-devel] [PATCH] lavu: introduce av_parse_ratio() and use it in ffmpeg and lavfi/aspect

Michael Niedermayer michaelni at gmx.at
Fri Jan 20 17:46:58 CET 2012


On Fri, Jan 20, 2012 at 03:44:09PM +0100, Stefano Sabatini wrote:
[...]
> +int av_parse_ratio(AVRational *q, const char *str, int max)
> +{
> +    char c;
> +    int ret;
> +    int64_t gcd;
> +
> +    if (sscanf(str, "%d:%d%c", &q->num, &q->den, &c) == 2) {
> +        if (q->num == 0 && q->den == 0)
> +            return AVERROR(EINVAL);
[...]
> @@ -29,6 +29,21 @@
>   */
>  
>  /**
> + * Parse str and store the parsed ratio in q.
> + *
> + * Note that a ratio with infinite (1/0) or negative value is
> + * considered valid, so you should check on the returned value if you
> + * want to exclude those values.

why is 0/0 less valid ?

It seems like a pretty good choice for "not known", which could be
used to override a known value in transcoding


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120120/9011635d/attachment.asc>


More information about the ffmpeg-devel mailing list