From 67dd33f90efcab52a4730ba5d84faddf7358e9fa Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Fri, 24 Mar 2006 15:47:44 +0000 Subject: [PATCH] use av_d2q to parse frame rate Originally committed as revision 5209 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 560aace259..6f15dd2f42 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2742,8 +2742,9 @@ int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg) } else { /* Finally we give up and parse it as double */ - *frame_rate_base = DEFAULT_FRAME_RATE_BASE; //FIXME use av_d2q() - *frame_rate = (int)(strtod(arg, 0) * (*frame_rate_base) + 0.5); + AVRational time_base = av_d2q(strtod(arg, 0), DEFAULT_FRAME_RATE_BASE); + *frame_rate_base = time_base.den; + *frame_rate = time_base.num; } if (!*frame_rate || !*frame_rate_base) return -1;