}
}
- 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 */
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;
}