Commit 3ddb887c authored by Peter Große's avatar Peter Große Committed by Michael Niedermayer

ffmpeg.c: fix calculation of input file duration in seek_to_start()

Fixes looping files without audio or when using stream_copy, where
ist->nb_samples is not set since no decoding is done.

This fixes ticket #5719 and also fixes an endless loop with the sample
in ticket #6139.
Signed-off-by: 's avatarPeter Große <pegro@friiks.de>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b9cd26f5
...@@ -4150,9 +4150,9 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is) ...@@ -4150,9 +4150,9 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is)
continue; continue;
} else { } else {
if (ist->framerate.num) { if (ist->framerate.num) {
duration = av_rescale_q(1, ist->framerate, ist->st->time_base); duration = av_rescale_q(1, av_inv_q(ist->framerate), ist->st->time_base);
} else if (ist->st->avg_frame_rate.num) { } else if (ist->st->avg_frame_rate.num) {
duration = av_rescale_q(1, ist->st->avg_frame_rate, ist->st->time_base); duration = av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate), ist->st->time_base);
} else duration = 1; } else duration = 1;
} }
if (!ifile->duration) if (!ifile->duration)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment