update ffmpeg.git patch set
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / ffmpeg.git.patch3
1 diff --git a/libavformat/avformat.h b/libavformat/avformat.h
2 index 734ae54cac..26d9bbafbc 100644
3 --- a/libavformat/avformat.h
4 +++ b/libavformat/avformat.h
5 @@ -485,6 +485,9 @@ typedef struct AVProbeData {
6                                          The user or muxer can override this through
7                                          AVFormatContext.avoid_negative_ts
8                                          */
9 +#define AVFMT_SEEK_NOSTREAMS  0x80000 /**< Stream index ignored by seek,
10 +                                           or some streams fail to seek
11 +                                           */
12  
13  #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
14  
15 @@ -653,8 +656,8 @@ typedef struct AVInputFormat {
16  
17      /**
18       * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
19 -     * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
20 -     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
21 +     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS,
22 +     * AVFMT_SEEK_NOSTREAMS
23       */
24      int flags;
25  
26 diff --git a/libavformat/dv.c b/libavformat/dv.c
27 index eb44e0acb6..b23759dd86 100644
28 --- a/libavformat/dv.c
29 +++ b/libavformat/dv.c
30 @@ -632,6 +632,7 @@ static int dv_probe(const AVProbeData *p)
31  AVInputFormat ff_dv_demuxer = {
32      .name           = "dv",
33      .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
34 +    .flags          = AVFMT_SEEK_NOSTREAMS,
35      .priv_data_size = sizeof(RawDVContext),
36      .read_probe     = dv_probe,
37      .read_header    = dv_read_header,
38 diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
39 index cba2b3d1f8..8427b2c421 100644
40 --- a/libavformat/matroskadec.c
41 +++ b/libavformat/matroskadec.c
42 @@ -4059,6 +4059,7 @@ static const AVClass webm_dash_class = {
43  AVInputFormat ff_matroska_demuxer = {
44      .name           = "matroska,webm",
45      .long_name      = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
46 +    .flags          = AVFMT_SEEK_NOSTREAMS,
47      .extensions     = "mkv,mk3d,mka,mks",
48      .priv_data_size = sizeof(MatroskaDemuxContext),
49      .read_probe     = matroska_probe,
50 @@ -4072,6 +4073,7 @@ AVInputFormat ff_matroska_demuxer = {
51  AVInputFormat ff_webm_dash_manifest_demuxer = {
52      .name           = "webm_dash_manifest",
53      .long_name      = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
54 +    .flags          = AVFMT_SEEK_NOSTREAMS,
55      .priv_data_size = sizeof(MatroskaDemuxContext),
56      .read_header    = webm_dash_manifest_read_header,
57      .read_packet    = webm_dash_manifest_read_packet,
58 diff --git a/libavformat/utils.c b/libavformat/utils.c
59 index a63d71b0f4..fe6608ade2 100644
60 --- a/libavformat/utils.c
61 +++ b/libavformat/utils.c
62 @@ -2472,6 +2472,13 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index,
63          return seek_frame_byte(s, stream_index, timestamp, flags);
64      }
65  
66 +    if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
67 +            timestamp = av_rescale_q(timestamp,
68 +                    s->streams[stream_index]->time_base,
69 +                    AV_TIME_BASE_Q);
70 +            stream_index = -1;
71 +    }
72 +
73      if (stream_index < 0) {
74          stream_index = av_find_default_stream_index(s);
75          if (stream_index < 0)