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

Michael Niedermayer michaelni
Fri Oct 1 21:35:28 CEST 2010


On Fri, Oct 01, 2010 at 06:10:04PM +0200, Stefano Sabatini wrote:
> 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).

ok if tested

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/aa2d363e/attachment.pgp>



More information about the ffmpeg-devel mailing list