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 AVInputFormat ff_dv_demuxer = {
28 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
29 + .flags = AVFMT_SEEK_NOSTREAMS,
30 .priv_data_size = sizeof(RawDVContext),
31 .read_probe = dv_probe,
32 .read_header = dv_read_header,
33 --- a/libavformat/matroskadec.c
34 +++ b/libavformat/matroskadec.c
36 const AVInputFormat ff_webm_dash_manifest_demuxer = {
37 .name = "webm_dash_manifest",
38 .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
39 + .flags = AVFMT_SEEK_NOSTREAMS,
40 .priv_class = &webm_dash_class,
41 .priv_data_size = sizeof(MatroskaDemuxContext),
42 .flags_internal = FF_FMT_INIT_CLEANUP,
44 const AVInputFormat ff_matroska_demuxer = {
45 .name = "matroska,webm",
46 .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
47 + .flags = AVFMT_SEEK_NOSTREAMS,
48 .extensions = "mkv,mk3d,mka,mks,webm",
49 .priv_data_size = sizeof(MatroskaDemuxContext),
50 .flags_internal = FF_FMT_INIT_CLEANUP,
51 --- a/libavformat/seek.c
52 +++ b/libavformat/seek.c
54 return seek_frame_byte(s, stream_index, timestamp, flags);
57 + if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
58 + timestamp = av_rescale_q(timestamp,
59 + s->streams[stream_index]->time_base,
64 if (stream_index < 0) {
65 stream_index = av_find_default_stream_index(s);