[FFmpeg-devel] [PATCH] lavfi/testsrc: add "decimals" option to the testsrc filter

Stefano Sabatini stefasab at gmail.com
Sun Jan 15 14:49:01 CET 2012


On date Thursday 2012-01-12 10:15:59 +0100, Nicolas George encoded:
> Le tridi 23 nivôse, an CCXX, Stefano Sabatini a écrit :
> > -        second = test->nb_frame * test->time_base.num / test->time_base.den;
> > +        double time = av_q2d(test->time_base) * test->nb_frame;
> > +        second = (int)(time * pow(10, test->nb_decimals));
> 
> This could probably be done more elegantly with av_rescale_q and a
> precomputed base, but I guess it does not matter much in a test source.
> 
> Apart from that, it looks nice to me.

Updated with overflow check (in this case no digits are shown at
all), please comment.
-- 
FFmpeg = Fundamentalist and Funny Mega Problematic Empowered Goblin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-lavfi-testsrc-add-decimals-option-to-the-testsrc-fil.patch
Type: text/x-diff
Size: 3261 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120115/ec6d808c/attachment.bin>


More information about the ffmpeg-devel mailing list