c774d19a40d88325300cf4f338bb0f57572ca23f
[goodguy/history.git] / ffmpeg.git.patch3
1 diff -ur a/libavformat/avformat.h b/libavformat/avformat.h
2 --- a/libavformat/avformat.h    2017-10-13 16:31:25.000000000 -0600
3 +++ b/libavformat/avformat.h    2017-10-13 20:07:24.178440418 -0600
4 @@ -504,6 +504,9 @@
5                                          The user or muxer can override this through
6                                          AVFormatContext.avoid_negative_ts
7                                          */
8 +#define AVFMT_SEEK_NOSTREAMS  0x80000 /**< Stream index ignored by seek,
9 +                                           or some streams fail to seek
10 +                                           */
11  
12  #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
13  
14 @@ -664,7 +667,8 @@
15      /**
16       * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
17       * 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
21       */
22      int flags;
23  
24 diff -ur a/libavformat/dv.c b/libavformat/dv.c
25 --- a/libavformat/dv.c  2017-10-13 16:31:25.000000000 -0600
26 +++ b/libavformat/dv.c  2017-10-13 20:07:24.178440418 -0600
27 @@ -632,6 +632,7 @@
28  AVInputFormat ff_dv_demuxer = {
29      .name           = "dv",
30      .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
31 +    .flags          = AVFMT_SEEK_NOSTREAMS,
32      .priv_data_size = sizeof(RawDVContext),
33      .read_probe     = dv_probe,
34      .read_header    = dv_read_header,
35 diff -ur a/libavformat/matroskadec.c b/libavformat/matroskadec.c
36 --- a/libavformat/matroskadec.c 2017-10-13 16:31:25.000000000 -0600
37 +++ b/libavformat/matroskadec.c 2017-10-13 20:07:24.180440304 -0600
38 @@ -3984,6 +3984,7 @@
39  AVInputFormat ff_matroska_demuxer = {
40      .name           = "matroska,webm",
41      .long_name      = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
42 +    .flags          = AVFMT_SEEK_NOSTREAMS,
43      .extensions     = "mkv,mk3d,mka,mks",
44      .priv_data_size = sizeof(MatroskaDemuxContext),
45      .read_probe     = matroska_probe,
46 @@ -3997,6 +3998,7 @@
47  AVInputFormat ff_webm_dash_manifest_demuxer = {
48      .name           = "webm_dash_manifest",
49      .long_name      = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
50 +    .flags          = AVFMT_SEEK_NOSTREAMS,
51      .priv_data_size = sizeof(MatroskaDemuxContext),
52      .read_header    = webm_dash_manifest_read_header,
53      .read_packet    = webm_dash_manifest_read_packet,
54 Only in b/libavformat: matroskadec.c.orig
55 diff -ur a/libavformat/utils.c b/libavformat/utils.c
56 --- a/libavformat/utils.c       2017-10-13 16:31:25.000000000 -0600
57 +++ b/libavformat/utils.c       2017-10-13 20:07:24.182440190 -0600
58 @@ -2415,6 +2415,13 @@
59          return seek_frame_byte(s, stream_index, timestamp, flags);
60      }
61  
62 +    if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
63 +            timestamp = av_rescale_q(timestamp,
64 +                    s->streams[stream_index]->time_base,
65 +                    AV_TIME_BASE_Q);
66 +            stream_index = -1;
67 +    }
68 +
69      if (stream_index < 0) {
70          stream_index = av_find_default_stream_index(s);
71          if (stream_index < 0)
72 Only in b/libavformat: utils.c.orig