[FFmpeg-cvslog] lavf: use avg_frame_rate and packet number to exit find_stream_info
Michael Niedermayer
git at videolan.org
Thu Jan 5 01:13:04 CET 2012
ffmpeg | branch: release/0.9 | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 5 00:49:02 2012 +0100| [0a5bca957d0d6ee9e77150dc5a20038c178d5282] | committer: Michael Niedermayer
lavf: use avg_frame_rate and packet number to exit find_stream_info
qatar does this too but clobbers the AVPacket.duration by approximate
values.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit ad8e3304f701820f927527d8f0d11679738636df)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a5bca957d0d6ee9e77150dc5a20038c178d5282
---
libavformat/utils.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index fe67d00..b0d1ec3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2499,8 +2499,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st = ic->streams[pkt->stream_index];
if (st->codec_info_nb_frames>1) {
- int64_t t;
- if (st->time_base.den > 0 && (t=av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q)) >= ic->max_analyze_duration) {
+ int64_t t=0;
+ if (st->time_base.den > 0)
+ t = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q);
+ if (st->avg_frame_rate.num > 0)
+ t = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, (AVRational){st->avg_frame_rate.den, st->avg_frame_rate.num}, AV_TIME_BASE_Q));
+
+ if (t >= ic->max_analyze_duration) {
av_log(ic, AV_LOG_WARNING, "max_analyze_duration %d reached at %"PRId64"\n", ic->max_analyze_duration, t);
break;
}
More information about the ffmpeg-cvslog
mailing list