summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-12-21 02:27:40 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-12-21 02:27:40 +0000
commitb3506cb42f82534161cde8ca813eb55aa2a7df35 (patch)
tree715487c4f30b1a319d497fa31cea7bf09a18d7db /libavformat
parent3e76d1b526276e0c8e767a7e60b9c78a5baf3adb (diff)
prefer integer fps if possible when guessing
Originally committed as revision 3769 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index be0ef6538d..6bc2c002a4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1846,9 +1846,18 @@ int av_find_stream_info(AVFormatContext *ic)
st->codec.codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec.pix_fmt);
if(best_duration[i] < INT64_MAX && st->codec.frame_rate_base*1000 <= st->codec.frame_rate){
+ int int_fps;
+
st->r_frame_rate= st->codec.frame_rate;
st->r_frame_rate_base= av_rescale(best_duration[i], st->codec.frame_rate, AV_TIME_BASE);
av_reduce(&st->r_frame_rate, &st->r_frame_rate_base, st->r_frame_rate, st->r_frame_rate_base, 1<<15);
+
+ int_fps= av_rescale(st->r_frame_rate, 1, st->r_frame_rate_base);
+
+ if(av_rescale(st->r_frame_rate, 1, int_fps) == st->r_frame_rate_base){
+ st->r_frame_rate= int_fps;
+ st->r_frame_rate_base= 1;
+ }
}
/* set real frame rate info */