update with-git-ffmpeg patches
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / ffmpeg.git.patch3
1 diff -urN a/libavformat/avformat.h b/libavformat/avformat.h
2 --- a/libavformat/avformat.h    2019-12-02 08:48:03.103361418 -0700
3 +++ b/libavformat/avformat.h    2019-12-02 08:52:16.724218813 -0700
4 @@ -485,6 +485,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 @@ -654,7 +657,8 @@
15      /**
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
21       */
22      int flags;
23  
24 diff -urN a/libavformat/dv.c b/libavformat/dv.c
25 --- a/libavformat/dv.c  2019-12-02 08:48:03.107361432 -0700
26 +++ b/libavformat/dv.c  2019-12-02 08:52:16.724218813 -0700
27 @@ -642,6 +642,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 -urN a/libavformat/matroskadec.c b/libavformat/matroskadec.c
36 --- a/libavformat/matroskadec.c 2019-12-02 08:48:03.116361462 -0700
37 +++ b/libavformat/matroskadec.c 2019-12-02 08:52:16.725218816 -0700
38 @@ -4224,6 +4224,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 @@ -4237,6 +4238,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 diff -urN a/libavformat/utils.c b/libavformat/utils.c
55 --- a/libavformat/utils.c       2019-12-02 08:48:03.138361536 -0700
56 +++ b/libavformat/utils.c       2019-12-02 08:52:16.726218820 -0700
57 @@ -2488,6 +2488,13 @@
58          return seek_frame_byte(s, stream_index, timestamp, flags);
59      }
60  
61 +    if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
62 +            timestamp = av_rescale_q(timestamp,
63 +                    s->streams[stream_index]->time_base,
64 +                    AV_TIME_BASE_Q);
65 +            stream_index = -1;
66 +    }
67 +
68      if (stream_index < 0) {
69          stream_index = av_find_default_stream_index(s);
70          if (stream_index < 0)