diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-04-17 16:32:07 -0700 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-04-17 16:37:42 -0700 |
commit | ac97d47d9b9276a930081d529a3997af13a7c0be (patch) | |
tree | c4567238259475c375d9cd825777221adbb55d3e /libavformat | |
parent | 204bcdf56c8f7dae5c487ab0da5c647154f0cd2a (diff) | |
download | ffmpeg-ac97d47d9b9276a930081d529a3997af13a7c0be.tar.gz |
mkv: use av_reduce instead of av_d2q for framerate estimation
It avoids some rounding errors.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskadec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 8323601091..03d7c32886 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1550,9 +1550,11 @@ static int matroska_read_header(AVFormatContext *s) 255); if (st->codec->codec_id != CODEC_ID_H264) st->need_parsing = AVSTREAM_PARSE_HEADERS; - if (track->default_duration) - st->r_frame_rate = - st->avg_frame_rate = av_d2q(1000000000.0/track->default_duration, INT_MAX); + if (track->default_duration) { + av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, + 1000000000, track->default_duration, 30000); + st->avg_frame_rate = st->r_frame_rate; + } } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->sample_rate = track->audio.out_samplerate; |