[FFmpeg-devel] [PATCH 10/10] Implement av_parse_fraction(), and use it in av_parse_video_rate().

Michael Niedermayer michaelni
Fri Oct 1 17:22:38 CEST 2010


On Fri, Oct 01, 2010 at 09:19:22AM +0200, Stefano Sabatini wrote:
> On date Friday 2010-10-01 00:29:55 +0200, Michael Niedermayer encoded:
> > On Thu, Sep 30, 2010 at 11:50:57PM +0200, Stefano Sabatini wrote:
> > > The new function is useful for parsing framerates, timebases or
> > > generic fractions (not necessarily video frame rates).
> > 
> > see eval.c
> 
> #include <libavutil/eval.h>
> #include <libavutil/rational.h>
> 
> ...
> 
> double res;
> if ((ret = av_parse_and_eval_expr(&res, str, NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0)
>    return ret;
> AVRational q = av_d2q(res, INT_MAX);
> 
> That's slightly overkill compared to:
> 
> if ((ret = av_parse_fraction(&q, str))
>    return ret;

and i call adding 90 lines to do less than this, overkill
but you can implement av_parse_fraction based on av_parse_and_eval_expr()
if you like ...

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101001/3d42e0b9/attachment.pgp>



More information about the ffmpeg-devel mailing list