X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavformat%2Futils.c;h=e095d601e13faf94623afe4c636be5a919ddf7df;hb=ef21b3d38e61ba6730eb1d4573da65ca222b3619;hp=b25576e7cb35649b443b164b6b2e5423b7b3023a;hpb=e8a966e361a7512ecfb03073074c8b9084229e69;p=ffmpeg diff --git a/libavformat/utils.c b/libavformat/utils.c index b25576e7cb3..e095d601e13 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -115,6 +115,11 @@ int64_t av_stream_get_end_pts(const AVStream *st) return st->pts.val; } +struct AVCodecParserContext *av_stream_get_parser(const AVStream *st) +{ + return st->parser; +} + void av_format_inject_global_side_data(AVFormatContext *s) { int i; @@ -1634,7 +1639,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) } /* read packet from packet buffer, if there is data */ - if (!(next_pkt->pts == AV_NOPTS_VALUE && + st = s->streams[next_pkt->stream_index]; + if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL && next_pkt->dts != AV_NOPTS_VALUE && !eof)) { ret = read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt); @@ -2500,6 +2506,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) } } + av_opt_set(ic, "skip_changes", "1", AV_OPT_SEARCH_CHILDREN); /* estimate the end time (duration) */ /* XXX: may need to support wrapping */ filesize = ic->pb ? avio_size(ic->pb) : 0; @@ -2567,6 +2574,8 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) offset && ++retry <= DURATION_MAX_RETRY); + av_opt_set(ic, "skip_changes", "0", AV_OPT_SEARCH_CHILDREN); + /* warn about audio/video streams which duration could not be estimated */ for (i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; @@ -3108,6 +3117,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) if (!max_analyze_duration) max_analyze_duration = ic->max_analyze_duration; + av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN); + if (!max_analyze_duration) { if (!strcmp(ic->iformat->name, "flv") && !(ic->ctx_flags & AVFMTCTX_NOHEADER)) { max_analyze_duration = 10*AV_TIME_BASE; @@ -3393,6 +3404,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) } } } + av_opt_set(ic, "skip_clear", "0", AV_OPT_SEARCH_CHILDREN); // close codecs which were opened in try_decode_frame() for (i = 0; i < ic->nb_streams; i++) {