1 --- a/libavformat/avformat.h
2 +++ b/libavformat/avformat.h
4 The user or muxer can override this through
5 AVFormatContext.avoid_negative_ts
7 +#define AVFMT_SEEK_NOSTREAMS 0x80000 /**< Stream index ignored by seek,
8 + or some streams fail to seek
11 #define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
15 * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
16 * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
17 - * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
18 + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS,
19 + * AVFMT_SEEK_NOSTREAMS
23 --- a/libavformat/dv.c
24 +++ b/libavformat/dv.c
26 const FFInputFormat ff_dv_demuxer = {
28 .p.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
29 + .p.flags = AVFMT_SEEK_NOSTREAMS,
30 .p.extensions = "dv,dif",
31 .priv_data_size = sizeof(RawDVContext),
32 .read_probe = dv_probe,
34 --- a/libavformat/matroskadec.c
35 +++ b/libavformat/matroskadec.c
37 const FFInputFormat ff_webm_dash_manifest_demuxer = {
38 .p.name = "webm_dash_manifest",
39 .p.long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
40 + .p.flags = AVFMT_SEEK_NOSTREAMS,
41 .p.priv_class = &webm_dash_class,
42 .priv_data_size = sizeof(MatroskaDemuxContext),
43 .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
45 const FFInputFormat ff_matroska_demuxer = {
46 .p.name = "matroska,webm",
47 .p.long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
48 + .p.flags = AVFMT_SEEK_NOSTREAMS,
49 .p.extensions = "mkv,mk3d,mka,mks,webm",
50 .p.mime_type = "audio/webm,audio/x-matroska,video/webm,video/x-matroska",
51 .priv_data_size = sizeof(MatroskaDemuxContext),
53 --- a/libavformat/seek.c
54 +++ b/libavformat/seek.c
56 return seek_frame_byte(s, stream_index, timestamp, flags);
59 + if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
60 + timestamp = av_rescale_q(timestamp,
61 + s->streams[stream_index]->time_base,
66 if (stream_index < 0) {
67 stream_index = av_find_default_stream_index(s);