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

Stefano Sabatini stefano.sabatini-lala
Fri Oct 1 18:10:04 CEST 2010


On date Friday 2010-10-01 17:22:38 +0200, Michael Niedermayer encoded:
> 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 ...

Uhm no... afterall I'm pretty happy with
av_parse_and_eval_expr()... check the attached patch (I can put the
test into a separate commit or discard it altogheter).

Regards.
-- 
FFmpeg = Fabulous Faithful Magnificient Portentous Eager Gadget



More information about the ffmpeg-devel mailing list