View | Details | Raw Unified | Return to bug 270310
Collapse All | Expand All

(-)b/multimedia/py-av/files/patch-git-upstream-PR-1110 (+238 lines)
Added Link Here
1
From 8871e13848cbf78615ba7b429d301adc071841ea Mon Sep 17 00:00:00 2001
2
From: Mattias Wadman <mattias.wadman@gmail.com>
3
Date: Tue, 21 Mar 2023 17:01:22 +0100
4
Subject: [PATCH] Update to ffmpeg 6.0
5
6
Removed and renamed constants with entry from API changes
7
https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/doc/APIchanges
8
9
Remove use of AVCodecContext.sub_text_format
10
  2021-09-20 - 176b8d785bf - lavc 59.9.100 - avcodec.h
11
    Deprecate AVCodecContext.sub_text_format and the corresponding
12
    AVOptions. It is unused since the last major bump.
13
14
AV_CODEC_CAP_TRUNCATED removed:
15
  2021-09-20 - dd846bc4a91 - lavc 59.8.100 - avcodec.h codec.h
16
    Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED,
17
    as they are redundant with parsers.
18
19
AV_CODEC_CAP_AUTO_THREADS renamed to AV_CODEC_CAP_AUTO_THREADS
20
  2021-03-16 - 7d09579190 - lavc 58.132.100 - codec.h
21
    Add AV_CODEC_CAP_OTHER_THREADS as a new name for
22
    AV_CODEC_CAP_AUTO_THREADS. AV_CODEC_CAP_AUTO_THREADS
23
    is now deprecated.
24
25
AV_CODEC_CAP_INTRA_ONLY removed (use AV_CODEC_PROP_INTRA_ONLY instead):
26
AV_CODEC_CAP_LOSSLESS removed (use AV_CODEC_PROP_LOESSNES instead):
27
  2020-05-21 - 13b1bbff0b - lavc 58.86.101 - avcodec.h
28
    Deprecated AV_CODEC_CAP_INTRA_ONLY and AV_CODEC_CAP_LOSSLESS.
29
30
AV_CODEC_FLAG_TRUNCATED removed:
31
AV_CODEC_CAP_TRUNCATED removed:
32
  2021-09-20 - dd846bc4a91 - lavc 59.8.100 - avcodec.h codec.h
33
    Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED,
34
    as they are redundant with parsers.
35
36
AV_CODEC_FLAG2_DROP_FRAME_TIMECODE removed:
37
  Not API changelog but was removed in f843460eb790d37e444e5946628f228421916537:
38
  avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
39
40
  It has been deprecated in 94d68a4
41
  and can't be set via AVOptions. The only codecs that use it
42
  (the MPEG-1/2 encoders) have private options for this.
43
  So remove it.
44
45
AVFMT_FLAG_PRIV_OPT removed:
46
  2021-03-03 - 2ff40b98ec - lavf 58.70.100 - avformat.h
47
    Deprecate AVFMT_FLAG_PRIV_OPT. It will do nothing
48
    as soon as av_demuxer_open() is removed.
49
50
Related to #1106
51
---
52
 av/codec/codec.pyx               | 12 ++++--------
53
 av/codec/context.pyx             | 11 -----------
54
 av/container/core.pyx            |  3 ---
55
 include/libavcodec/avcodec.pxd   | 10 +---------
56
 include/libavformat/avformat.pxd |  1 -
57
 scripts/activate.sh              |  2 +-
58
 6 files changed, 6 insertions(+), 33 deletions(-)
59
60
diff --git a/av/codec/codec.pyx b/av/codec/codec.pyx
61
index ad3198fd..978d4277 100644
62
--- av/codec/codec.pyx
63
+++ av/codec/codec.pyx
64
@@ -52,7 +52,6 @@ Capabilities = define_enum('Capabilities', 'av.codec', (
65
         """Codec uses get_buffer() for allocating buffers and supports custom allocators.
66
         If not set, it might not use get_buffer() at all or use operations that
67
         assume the buffer was allocated by avcodec_default_get_buffer."""),
68
-    ('TRUNCATED', lib.AV_CODEC_CAP_TRUNCATED),
69
     ('HWACCEL', 1 << 4),
70
     ('DELAY', lib.AV_CODEC_CAP_DELAY,
71
         """Encoder or decoder requires flushing with NULL input at the end in order to
72
@@ -102,8 +101,10 @@ Capabilities = define_enum('Capabilities', 'av.codec', (
73
         """Codec supports slice-based (or partition-based) multithreading."""),
74
     ('PARAM_CHANGE', lib.AV_CODEC_CAP_PARAM_CHANGE,
75
         """Codec supports changed parameters at any point."""),
76
-    ('AUTO_THREADS', lib.AV_CODEC_CAP_AUTO_THREADS,
77
-        """Codec supports avctx->thread_count == 0 (auto)."""),
78
+    ('AUTO_THREADS', lib.AV_CODEC_CAP_OTHER_THREADS,
79
+        """Codec supports multithreading through a method other than slice- or
80
+        frame-level multithreading. Typically this marks wrappers around
81
+        multithreading-capable external libraries."""),
82
     ('VARIABLE_FRAME_SIZE', lib.AV_CODEC_CAP_VARIABLE_FRAME_SIZE,
83
         """Audio encoder supports receiving a different number of samples in each call."""),
84
     ('AVOID_PROBING', lib.AV_CODEC_CAP_AVOID_PROBING,
85
@@ -114,10 +115,6 @@ Capabilities = define_enum('Capabilities', 'av.codec', (
86
         the stream.
87
         A decoder marked with this flag should only be used as last resort
88
         choice for probing."""),
89
-    ('INTRA_ONLY', lib.AV_CODEC_CAP_INTRA_ONLY,
90
-        """Codec is intra only."""),
91
-    ('LOSSLESS', lib.AV_CODEC_CAP_LOSSLESS,
92
-        """Codec is lossless."""),
93
     ('HARDWARE', lib.AV_CODEC_CAP_HARDWARE,
94
         """Codec is backed by a hardware implementation. Typically used to
95
         identify a non-hwaccel hardware decoder. For information about hwaccels, use
96
@@ -312,7 +309,6 @@ cdef class Codec(object):
97
 
98
     draw_horiz_band = capabilities.flag_property('DRAW_HORIZ_BAND')
99
     dr1 = capabilities.flag_property('DR1')
100
-    truncated = capabilities.flag_property('TRUNCATED')
101
     hwaccel = capabilities.flag_property('HWACCEL')
102
     delay = capabilities.flag_property('DELAY')
103
     small_last_frame = capabilities.flag_property('SMALL_LAST_FRAME')
104
diff --git a/av/codec/context.pyx b/av/codec/context.pyx
105
index 5c831461..2cdf7ef5 100644
106
--- av/codec/context.pyx
107
+++ av/codec/context.pyx
108
@@ -96,9 +96,6 @@ Flags = define_enum('Flags', __name__, (
109
         """Only decode/encode grayscale."""),
110
     ('PSNR', lib.AV_CODEC_FLAG_PSNR,
111
         """error[?] variables will be set during encoding."""),
112
-    ('TRUNCATED', lib.AV_CODEC_FLAG_TRUNCATED,
113
-        """Input bitstream might be truncated at a random location
114
-        instead of only at frame boundaries."""),
115
     ('INTERLACED_DCT', lib.AV_CODEC_FLAG_INTERLACED_DCT,
116
         """Use interlaced DCT."""),
117
     ('LOW_DELAY', lib.AV_CODEC_FLAG_LOW_DELAY,
118
@@ -122,8 +119,6 @@ Flags2 = define_enum('Flags2', __name__, (
119
         """Skip bitstream encoding."""),
120
     ('LOCAL_HEADER', lib.AV_CODEC_FLAG2_LOCAL_HEADER,
121
         """Place global headers at every keyframe instead of in extradata."""),
122
-    ('DROP_FRAME_TIMECODE', lib.AV_CODEC_FLAG2_DROP_FRAME_TIMECODE,
123
-        """Timecode is in drop frame format. DEPRECATED!!!!"""),
124
     ('CHUNKS', lib.AV_CODEC_FLAG2_CHUNKS,
125
         """Input bitstream might be truncated at a packet boundaries
126
         instead of only at frame boundaries."""),
127
@@ -168,10 +163,6 @@ cdef class CodecContext(object):
128
         self.ptr.thread_count = 0
129
         self.ptr.thread_type = 2
130
 
131
-        # Use "ass" format for subtitles (default as of FFmpeg 5.0), not the
132
-        # deprecated "ass_with_timings" formats.
133
-        self.ptr.sub_text_format = 0
134
-
135
     def _get_flags(self):
136
         return self.ptr.flags
137
 
138
@@ -195,7 +186,6 @@ cdef class CodecContext(object):
139
     loop_filter = flags.flag_property('LOOP_FILTER')
140
     gray = flags.flag_property('GRAY')
141
     psnr = flags.flag_property('PSNR')
142
-    truncated = flags.flag_property('TRUNCATED')
143
     interlaced_dct = flags.flag_property('INTERLACED_DCT')
144
     low_delay = flags.flag_property('LOW_DELAY')
145
     global_header = flags.flag_property('GLOBAL_HEADER')
146
@@ -219,7 +209,6 @@ cdef class CodecContext(object):
147
     fast = flags2.flag_property('FAST')
148
     no_output = flags2.flag_property('NO_OUTPUT')
149
     local_header = flags2.flag_property('LOCAL_HEADER')
150
-    drop_frame_timecode = flags2.flag_property('DROP_FRAME_TIMECODE')
151
     chunks = flags2.flag_property('CHUNKS')
152
     ignore_crop = flags2.flag_property('IGNORE_CROP')
153
     show_all = flags2.flag_property('SHOW_ALL')
154
diff --git a/av/container/core.pyx b/av/container/core.pyx
155
index d21893c4..1c5c75b8 100755
156
--- av/container/core.pyx
157
+++ av/container/core.pyx
158
@@ -157,8 +157,6 @@ Flags = define_enum('Flags', __name__, (
159
         This flag is mainly intended for testing."""),
160
     ('SORT_DTS', lib.AVFMT_FLAG_SORT_DTS,
161
         "Try to interleave outputted packets by dts (using this flag can slow demuxing down)."),
162
-    ('PRIV_OPT', lib.AVFMT_FLAG_PRIV_OPT,
163
-        "Enable use of private options by delaying codec open (this could be made default once all code is converted)."),
164
     ('FAST_SEEK', lib.AVFMT_FLAG_FAST_SEEK,
165
         "Enable fast, but inaccurate seeks for some formats."),
166
     ('SHORTEST', lib.AVFMT_FLAG_SHORTEST,
167
@@ -329,7 +327,6 @@ cdef class Container(object):
168
     flush_packets = flags.flag_property('FLUSH_PACKETS')
169
     bit_exact = flags.flag_property('BITEXACT')
170
     sort_dts = flags.flag_property('SORT_DTS')
171
-    priv_opt = flags.flag_property('PRIV_OPT')
172
     fast_seek = flags.flag_property('FAST_SEEK')
173
     shortest = flags.flag_property('SHORTEST')
174
     auto_bsf = flags.flag_property('AUTO_BSF')
175
diff --git a/include/libavcodec/avcodec.pxd b/include/libavcodec/avcodec.pxd
176
index 1e611180..0334b18e 100644
177
--- include/libavcodec/avcodec.pxd
178
+++ include/libavcodec/avcodec.pxd
179
@@ -39,7 +39,6 @@ cdef extern from "libavcodec/avcodec.h" nogil:
180
     cdef enum:
181
         AV_CODEC_CAP_DRAW_HORIZ_BAND
182
         AV_CODEC_CAP_DR1
183
-        AV_CODEC_CAP_TRUNCATED
184
         # AV_CODEC_CAP_HWACCEL
185
         AV_CODEC_CAP_DELAY
186
         AV_CODEC_CAP_SMALL_LAST_FRAME
187
@@ -51,11 +50,9 @@ cdef extern from "libavcodec/avcodec.h" nogil:
188
         AV_CODEC_CAP_FRAME_THREADS
189
         AV_CODEC_CAP_SLICE_THREADS
190
         AV_CODEC_CAP_PARAM_CHANGE
191
-        AV_CODEC_CAP_AUTO_THREADS
192
+        AV_CODEC_CAP_OTHER_THREADS
193
         AV_CODEC_CAP_VARIABLE_FRAME_SIZE
194
         AV_CODEC_CAP_AVOID_PROBING
195
-        AV_CODEC_CAP_INTRA_ONLY
196
-        AV_CODEC_CAP_LOSSLESS
197
         AV_CODEC_CAP_HARDWARE
198
         AV_CODEC_CAP_HYBRID
199
         AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
200
@@ -76,7 +73,6 @@ cdef extern from "libavcodec/avcodec.h" nogil:
201
         AV_CODEC_FLAG_LOOP_FILTER
202
         AV_CODEC_FLAG_GRAY
203
         AV_CODEC_FLAG_PSNR
204
-        AV_CODEC_FLAG_TRUNCATED
205
         AV_CODEC_FLAG_INTERLACED_DCT
206
         AV_CODEC_FLAG_LOW_DELAY
207
         AV_CODEC_FLAG_GLOBAL_HEADER
208
@@ -89,7 +85,6 @@ cdef extern from "libavcodec/avcodec.h" nogil:
209
         AV_CODEC_FLAG2_FAST
210
         AV_CODEC_FLAG2_NO_OUTPUT
211
         AV_CODEC_FLAG2_LOCAL_HEADER
212
-        AV_CODEC_FLAG2_DROP_FRAME_TIMECODE
213
         AV_CODEC_FLAG2_CHUNKS
214
         AV_CODEC_FLAG2_IGNORE_CROP
215
         AV_CODEC_FLAG2_SHOW_ALL
216
@@ -224,9 +219,6 @@ cdef extern from "libavcodec/avcodec.h" nogil:
217
         int frame_size
218
         int channel_layout
219
 
220
-        # Subtitles.
221
-        int sub_text_format
222
-
223
         #: .. todo:: ``get_buffer`` is deprecated for get_buffer2 in newer versions of FFmpeg.
224
         int get_buffer(AVCodecContext *ctx, AVFrame *frame)
225
         void release_buffer(AVCodecContext *ctx, AVFrame *frame)
226
diff --git a/include/libavformat/avformat.pxd b/include/libavformat/avformat.pxd
227
index ed3e503f..06029d9f 100644
228
--- include/libavformat/avformat.pxd
229
+++ include/libavformat/avformat.pxd
230
@@ -146,7 +146,6 @@ cdef extern from "libavformat/avformat.h" nogil:
231
         AVFMT_FLAG_FLUSH_PACKETS
232
         AVFMT_FLAG_BITEXACT
233
         AVFMT_FLAG_SORT_DTS
234
-        AVFMT_FLAG_PRIV_OPT
235
         AVFMT_FLAG_FAST_SEEK
236
         AVFMT_FLAG_SHORTEST
237
         AVFMT_FLAG_AUTO_BSF
238

Return to bug 270310