1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

mkv: use av_reduce instead of av_d2q for framerate estimation

It avoids some rounding errors.
This commit is contained in:
Luca Barbato 2012-04-17 16:32:07 -07:00
parent 204bcdf56c
commit ac97d47d9b

View File

@ -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;