[FFmpeg-cvslog] mkv: use av_reduce instead of av_d2q for framerate estimation
Luca Barbato
git at videolan.org
Wed Apr 18 22:28:25 CEST 2012
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Apr 17 16:32:07 2012 -0700| [ac97d47d9b9276a930081d529a3997af13a7c0be] | committer: Luca Barbato
mkv: use av_reduce instead of av_d2q for framerate estimation
It avoids some rounding errors.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac97d47d9b9276a930081d529a3997af13a7c0be
---
libavformat/matroskadec.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8323601..03d7c32 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;
More information about the ffmpeg-cvslog
mailing list