1 diff -ru a/libavformat/avformat.h b/libavformat/avformat.h
2 --- a/libavformat/avformat.h 2019-08-05 14:52:21.000000000 -0600
3 +++ b/libavformat/avformat.h 2019-08-08 17:26:45.869297510 -0600
5 The user or muxer can override this through
6 AVFormatContext.avoid_negative_ts
8 +#define AVFMT_SEEK_NOSTREAMS 0x80000 /**< Stream index ignored by seek,
9 + or some streams fail to seek
12 #define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
16 * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
17 * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
18 - * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
19 + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS,
20 + * AVFMT_SEEK_NOSTREAMS
24 Only in b/libavformat: avformat.h.orig
25 Only in b/libavformat: avformat.h.rej
26 diff -ru a/libavformat/dv.c b/libavformat/dv.c
27 --- a/libavformat/dv.c 2019-08-05 14:52:21.000000000 -0600
28 +++ b/libavformat/dv.c 2019-08-08 17:23:57.558692650 -0600
30 AVInputFormat ff_dv_demuxer = {
32 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
33 + .flags = AVFMT_SEEK_NOSTREAMS,
34 .priv_data_size = sizeof(RawDVContext),
35 .read_probe = dv_probe,
36 .read_header = dv_read_header,
37 diff -ru a/libavformat/matroskadec.c b/libavformat/matroskadec.c
38 --- a/libavformat/matroskadec.c 2019-08-05 14:52:21.000000000 -0600
39 +++ b/libavformat/matroskadec.c 2019-08-08 17:23:57.559692582 -0600
41 AVInputFormat ff_matroska_demuxer = {
42 .name = "matroska,webm",
43 .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
44 + .flags = AVFMT_SEEK_NOSTREAMS,
45 .extensions = "mkv,mk3d,mka,mks",
46 .priv_data_size = sizeof(MatroskaDemuxContext),
47 .read_probe = matroska_probe,
49 AVInputFormat ff_webm_dash_manifest_demuxer = {
50 .name = "webm_dash_manifest",
51 .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
52 + .flags = AVFMT_SEEK_NOSTREAMS,
53 .priv_data_size = sizeof(MatroskaDemuxContext),
54 .read_header = webm_dash_manifest_read_header,
55 .read_packet = webm_dash_manifest_read_packet,
56 Only in b/libavformat: matroskadec.c.orig
57 diff -ru a/libavformat/utils.c b/libavformat/utils.c
58 --- a/libavformat/utils.c 2019-08-05 14:52:21.000000000 -0600
59 +++ b/libavformat/utils.c 2019-08-08 17:23:57.560692514 -0600
60 @@ -2472,6 +2472,13 @@
61 return seek_frame_byte(s, stream_index, timestamp, flags);
64 + if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
65 + timestamp = av_rescale_q(timestamp,
66 + s->streams[stream_index]->time_base,
71 if (stream_index < 0) {
72 stream_index = av_find_default_stream_index(s);