ffmpeg | branch: master | Derek Buitenhuis <derek.buitenh...@gmail.com> | Wed Apr 13 15:36:55 2016 +0100| [3c461eecd48ba2cf7616d98e6f99954de3ad4b06] | committer: Derek Buitenhuis
Merge commit '1ceb07eb313c2d51383408025e57a2fe50ccd164' * commit '1ceb07eb313c2d51383408025e57a2fe50ccd164': avformat_find_stream_info: move duration guessing after updating codec parameters Merged-by: Derek Buitenhuis <derek.buitenh...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c461eecd48ba2cf7616d98e6f99954de3ad4b06 --- libavformat/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index d6aba5a..bf4ea2b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3723,9 +3723,6 @@ FF_ENABLE_DEPRECATION_WARNINGS } } - if (probesize) - estimate_timings(ic, old_offset); - av_opt_set(ic, "skip_clear", "0", AV_OPT_SEARCH_CHILDREN); if (ret >= 0 && ic->nb_streams) @@ -3806,6 +3803,9 @@ FF_ENABLE_DEPRECATION_WARNINGS st->internal->avctx_inited = 0; } + if (probesize) + estimate_timings(ic, old_offset); + find_stream_info_err: for (i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; ====================================================================== diff --cc libavformat/utils.c index d6aba5a,31faa95..bf4ea2b --- a/libavformat/utils.c +++ b/libavformat/utils.c @@@ -3723,36 -2431,6 +3723,33 @@@ FF_ENABLE_DEPRECATION_WARNING } } - if (probesize) - estimate_timings(ic, old_offset); - + av_opt_set(ic, "skip_clear", "0", AV_OPT_SEARCH_CHILDREN); + + if (ret >= 0 && ic->nb_streams) + /* We could not have all the codec parameters before EOF. */ + ret = -1; + for (i = 0; i < ic->nb_streams; i++) { + const char *errmsg; + st = ic->streams[i]; + + /* if no packet was ever seen, update context now for has_codec_parameters */ + if (!st->internal->avctx_inited) { + ret = avcodec_parameters_to_context(st->internal->avctx, st->codecpar); + if (ret < 0) + goto find_stream_info_err; + } + if (!has_codec_parameters(st, &errmsg)) { + char buf[256]; + avcodec_string(buf, sizeof(buf), st->internal->avctx, 0); + av_log(ic, AV_LOG_WARNING, + "Could not find codec parameters for stream %d (%s): %s\n" + "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n", + i, buf, errmsg); + } else { + ret = 0; + } + } + compute_chapters_end(ic); /* update the stream parameters from the internal codec contexts */ @@@ -3806,16 -2463,12 +3803,19 @@@ FF_ENABLE_DEPRECATION_WARNING st->internal->avctx_inited = 0; } - estimate_timings(ic, old_offset); ++ if (probesize) ++ estimate_timings(ic, old_offset); + find_stream_info_err: for (i = 0; i < ic->nb_streams; i++) { + st = ic->streams[i]; + if (st->info) + av_freep(&st->info->duration_error); av_freep(&ic->streams[i]->info); } + if (ic->pb) + av_log(ic, AV_LOG_DEBUG, "After avformat_find_stream_info() pos: %"PRId64" bytes read:%"PRId64" seeks:%d frames:%d\n", + avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count, count); return ret; } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog