X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Futils.c;h=e67147c246eba06cd53b83f7c270b2167f766e23;hb=e2adb00ec587dd48746b0d24648005d22c91423c;hp=ccc212912662d259363089489a0345b41ec014cb;hpb=9947902601e7bf1b061ef972ee3422ae9b0653d2;p=ffmpeg diff --git a/libavformat/utils.c b/libavformat/utils.c index ccc21291266..e67147c246e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -116,7 +116,10 @@ MAKE_ACCESSORS(AVFormatContext, format, AVOpenCallback, open_cb) int64_t av_stream_get_end_pts(const AVStream *st) { - return st->pts.val; + if (st->priv_pts) { + return st->priv_pts->val; + } else + return AV_NOPTS_VALUE; } struct AVCodecParserContext *av_stream_get_parser(const AVStream *st) @@ -3088,10 +3091,18 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) // new streams might appear, no options for those int orig_nb_streams = ic->nb_streams; int flush_codecs; +#if FF_API_PROBESIZE_32 int64_t max_analyze_duration = ic->max_analyze_duration2; +#else + int64_t max_analyze_duration = ic->max_analyze_duration; +#endif int64_t max_stream_analyze_duration; int64_t max_subtitle_analyze_duration; +#if FF_API_PROBESIZE_32 int64_t probesize = ic->probesize2; +#else + int64_t probesize = ic->probesize; +#endif if (!max_analyze_duration) max_analyze_duration = ic->max_analyze_duration; @@ -3668,6 +3679,7 @@ void ff_free_stream(AVFormatContext *s, AVStream *st) { av_freep(&st->info->duration_error); av_freep(&st->info); av_freep(&st->recommended_encoder_configuration); + av_freep(&st->priv_pts); av_freep(&s->streams[ --s->nb_streams ]); } @@ -4300,8 +4312,9 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, if (*spec <= '9' && *spec >= '0') /* opt:index */ return strtol(spec, NULL, 0) == st->index; else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' || - *spec == 't') { /* opt:[vasdt] */ + *spec == 't' || *spec == 'V') { /* opt:[vasdtV] */ enum AVMediaType type; + int nopic = 0; switch (*spec++) { case 'v': type = AVMEDIA_TYPE_VIDEO; break; @@ -4309,15 +4322,20 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, case 's': type = AVMEDIA_TYPE_SUBTITLE; break; case 'd': type = AVMEDIA_TYPE_DATA; break; case 't': type = AVMEDIA_TYPE_ATTACHMENT; break; + case 'V': type = AVMEDIA_TYPE_VIDEO; nopic = 1; break; default: av_assert0(0); } if (type != st->codec->codec_type) return 0; + if (nopic && (st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + return 0; if (*spec++ == ':') { /* possibly followed by :index */ int i, index = strtol(spec, NULL, 0); for (i = 0; i < s->nb_streams; i++) - if (s->streams[i]->codec->codec_type == type && index-- == 0) - return i == st->index; + if (s->streams[i]->codec->codec_type == type && + !(nopic && (st->disposition & AV_DISPOSITION_ATTACHED_PIC)) && + index-- == 0) + return i == st->index; return 0; } return 1;