summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2022-02-07 01:08:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-08 14:20:18 +0000
commit2ee8da4ccd86b6b3452afad2f5bd4f5f06dcf9c0 (patch)
tree1d53935e7998b299112233dae8e3d9e5f7c00682 /meta/recipes-multimedia
parent4bfc363af01e47a49113212948a438707b3f78a4 (diff)
downloadpoky-2ee8da4ccd86b6b3452afad2f5bd4f5f06dcf9c0.tar.gz
gstreamer1.0-libav: upgrade 1.18.5 -> 1.20.0
- License update: The code actually is LGPLv2.1 but the COPYING file is wrong. https://gitlab.freedesktop.org/gstreamer/gst-libav/-/commit/678773bb6468e815c180ff82a09d863451e89ba8 - Drop backported patches 0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch - Add new meson options (From OE-Core rev: db058e8a8bad0d98f908062871832cc6824deaf2) Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-multimedia')
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch346
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.0.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb)12
2 files changed, 7 insertions, 351 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch
deleted file mode 100644
index 022ff9af29..0000000000
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch
+++ /dev/null
@@ -1,346 +0,0 @@
1From 38d10ee800e42afeacc6bee714216e4c974c11f5 Mon Sep 17 00:00:00 2001
2From: Xi Ruoyao <xry111@mengyan1223.wang>
3Date: Mon, 17 Jan 2022 01:33:47 +0800
4Subject: [PATCH] gst-libav: fix build with ffmpeg-5.0.0
5
6Latest ffmpeg has removed avcodec_get_context_defaults(), and its
7documentation says a new AVCodecContext should be allocated for this
8purpose. The pointer returned by avcodec_find_decoder() is now
9const-qualified so we also need to adjust for it. And, AVCOL_RANGE_MPEG
10is now rejected with strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL.
11
12Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1531>
13Upstream-Status: Backport
14Signed-off-by: Alexander Kanavin <alex@linutronix.de>
15---
16 ext/libav/gstavauddec.c | 22 ++++++++-------------
17 ext/libav/gstavaudenc.c | 40 +++++++++++++++++++--------------------
18 ext/libav/gstavcodecmap.c | 7 ++++---
19 ext/libav/gstavutils.c | 2 +-
20 ext/libav/gstavviddec.c | 28 +++++++++++----------------
21 ext/libav/gstavvidenc.c | 21 ++++++++++----------
22 6 files changed, 54 insertions(+), 66 deletions(-)
23
24diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c
25index baf7aa5..b03a724 100644
26--- a/ext/libav/gstavauddec.c
27+++ b/ext/libav/gstavauddec.c
28@@ -168,12 +168,7 @@ gst_ffmpegauddec_finalize (GObject * object)
29 GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) object;
30
31 av_frame_free (&ffmpegdec->frame);
32-
33- if (ffmpegdec->context != NULL) {
34- gst_ffmpeg_avcodec_close (ffmpegdec->context);
35- av_free (ffmpegdec->context);
36- ffmpegdec->context = NULL;
37- }
38+ avcodec_free_context (&ffmpegdec->context);
39
40 G_OBJECT_CLASS (parent_class)->finalize (object);
41 }
42@@ -193,14 +188,12 @@ gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec, gboolean reset)
43 gst_ffmpeg_avcodec_close (ffmpegdec->context);
44 ffmpegdec->opened = FALSE;
45
46- if (ffmpegdec->context->extradata) {
47- av_free (ffmpegdec->context->extradata);
48- ffmpegdec->context->extradata = NULL;
49- }
50+ av_freep (&ffmpegdec->context->extradata);
51
52 if (reset) {
53- if (avcodec_get_context_defaults3 (ffmpegdec->context,
54- oclass->in_plugin) < 0) {
55+ avcodec_free_context (&ffmpegdec->context);
56+ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin);
57+ if (ffmpegdec->context == NULL) {
58 GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
59 return FALSE;
60 }
61@@ -219,8 +212,9 @@ gst_ffmpegauddec_start (GstAudioDecoder * decoder)
62 oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
63
64 GST_OBJECT_LOCK (ffmpegdec);
65- gst_ffmpeg_avcodec_close (ffmpegdec->context);
66- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) {
67+ avcodec_free_context (&ffmpegdec->context);
68+ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin);
69+ if (ffmpegdec->context == NULL) {
70 GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
71 GST_OBJECT_UNLOCK (ffmpegdec);
72 return FALSE;
73diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c
74index 3ff6432..689982f 100644
75--- a/ext/libav/gstavaudenc.c
76+++ b/ext/libav/gstavaudenc.c
77@@ -175,10 +175,8 @@ gst_ffmpegaudenc_finalize (GObject * object)
78
79 /* clean up remaining allocated data */
80 av_frame_free (&ffmpegaudenc->frame);
81- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
82- gst_ffmpeg_avcodec_close (ffmpegaudenc->refcontext);
83- av_free (ffmpegaudenc->context);
84- av_free (ffmpegaudenc->refcontext);
85+ avcodec_free_context (&ffmpegaudenc->context);
86+ avcodec_free_context (&ffmpegaudenc->refcontext);
87
88 G_OBJECT_CLASS (parent_class)->finalize (object);
89 }
90@@ -193,9 +191,9 @@ gst_ffmpegaudenc_start (GstAudioEncoder * encoder)
91 ffmpegaudenc->opened = FALSE;
92 ffmpegaudenc->need_reopen = FALSE;
93
94- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
95- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
96- oclass->in_plugin) < 0) {
97+ avcodec_free_context (&ffmpegaudenc->context);
98+ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin);
99+ if (ffmpegaudenc->context == NULL) {
100 GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
101 return FALSE;
102 }
103@@ -241,10 +239,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
104
105 /* close old session */
106 if (ffmpegaudenc->opened) {
107- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
108+ avcodec_free_context (&ffmpegaudenc->context);
109 ffmpegaudenc->opened = FALSE;
110- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
111- oclass->in_plugin) < 0) {
112+ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin);
113+ if (ffmpegaudenc->context == NULL) {
114 GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
115 return FALSE;
116 }
117@@ -286,11 +284,11 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
118 /* open codec */
119 if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) {
120 gst_caps_unref (allowed_caps);
121- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
122+ avcodec_free_context (&ffmpegaudenc->context);
123 GST_DEBUG_OBJECT (ffmpegaudenc, "avenc_%s: Failed to open FFMPEG codec",
124 oclass->in_plugin->name);
125- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
126- oclass->in_plugin) < 0)
127+ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin);
128+ if (ffmpegaudenc->context == NULL)
129 GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
130
131 if ((oclass->in_plugin->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
132@@ -312,10 +310,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
133
134 if (!other_caps) {
135 gst_caps_unref (allowed_caps);
136- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
137+ avcodec_free_context (&ffmpegaudenc->context);
138 GST_DEBUG ("Unsupported codec - no caps found");
139- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
140- oclass->in_plugin) < 0)
141+ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin);
142+ if (ffmpegaudenc->context == NULL)
143 GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
144 return FALSE;
145 }
146@@ -331,10 +329,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
147
148 if (!gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (ffmpegaudenc),
149 icaps)) {
150- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
151+ avcodec_free_context (&ffmpegaudenc->context);
152 gst_caps_unref (icaps);
153- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
154- oclass->in_plugin) < 0)
155+ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin);
156+ if (ffmpegaudenc->context == NULL)
157 GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
158 return FALSE;
159 }
160@@ -403,8 +401,8 @@ buffer_info_free (void *opaque, guint8 * data)
161 gst_buffer_unmap (info->buffer, &info->map);
162 gst_buffer_unref (info->buffer);
163 } else {
164- av_free (info->ext_data);
165- av_free (info->ext_data_array);
166+ av_freep (&info->ext_data);
167+ av_freep (&info->ext_data_array);
168 }
169 g_slice_free (BufferInfo, info);
170 }
171diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
172index f58633d..e2a3641 100644
173--- a/ext/libav/gstavcodecmap.c
174+++ b/ext/libav/gstavcodecmap.c
175@@ -2331,7 +2331,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
176 }
177
178 if (buildcaps) {
179- AVCodec *codec;
180+ const AVCodec *codec;
181
182 if ((codec = avcodec_find_decoder (codec_id)) ||
183 (codec = avcodec_find_encoder (codec_id))) {
184@@ -2975,6 +2975,7 @@ gst_ffmpeg_videoinfo_to_context (GstVideoInfo * info, AVCodecContext * context)
185 context->color_range = AVCOL_RANGE_JPEG;
186 } else {
187 context->color_range = AVCOL_RANGE_MPEG;
188+ context->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL;
189 }
190 }
191
192@@ -4330,7 +4331,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
193 audio = TRUE;
194 } else if (!strncmp (mimetype, "audio/x-gst-av-", 15)) {
195 gchar ext[16];
196- AVCodec *codec;
197+ const AVCodec *codec;
198
199 if (strlen (mimetype) <= 30 &&
200 sscanf (mimetype, "audio/x-gst-av-%s", ext) == 1) {
201@@ -4342,7 +4343,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
202 }
203 } else if (!strncmp (mimetype, "video/x-gst-av-", 15)) {
204 gchar ext[16];
205- AVCodec *codec;
206+ const AVCodec *codec;
207
208 if (strlen (mimetype) <= 30 &&
209 sscanf (mimetype, "video/x-gst-av-%s", ext) == 1) {
210diff --git a/ext/libav/gstavutils.c b/ext/libav/gstavutils.c
211index 3780cff..f3878c3 100644
212--- a/ext/libav/gstavutils.c
213+++ b/ext/libav/gstavutils.c
214@@ -36,7 +36,7 @@
215 const gchar *
216 gst_ffmpeg_get_codecid_longname (enum AVCodecID codec_id)
217 {
218- AVCodec *codec;
219+ const AVCodec *codec;
220 /* Let's use what ffmpeg can provide us */
221
222 if ((codec = avcodec_find_decoder (codec_id)) ||
223diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
224index 7ec5766..5dd207e 100644
225--- a/ext/libav/gstavviddec.c
226+++ b/ext/libav/gstavviddec.c
227@@ -320,12 +320,7 @@ gst_ffmpegviddec_finalize (GObject * object)
228 GstFFMpegVidDec *ffmpegdec = (GstFFMpegVidDec *) object;
229
230 av_frame_free (&ffmpegdec->picture);
231-
232- if (ffmpegdec->context != NULL) {
233- gst_ffmpeg_avcodec_close (ffmpegdec->context);
234- av_free (ffmpegdec->context);
235- ffmpegdec->context = NULL;
236- }
237+ avcodec_free_context (&ffmpegdec->context);
238
239 G_OBJECT_CLASS (parent_class)->finalize (object);
240 }
241@@ -363,13 +358,11 @@ gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec, gboolean reset)
242
243 gst_buffer_replace (&ffmpegdec->palette, NULL);
244
245- if (ffmpegdec->context->extradata) {
246- av_free (ffmpegdec->context->extradata);
247- ffmpegdec->context->extradata = NULL;
248- }
249+ av_freep (&ffmpegdec->context->extradata);
250 if (reset) {
251- if (avcodec_get_context_defaults3 (ffmpegdec->context,
252- oclass->in_plugin) < 0) {
253+ avcodec_free_context (&ffmpegdec->context);
254+ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin);
255+ if (ffmpegdec->context == NULL) {
256 GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
257 return FALSE;
258 }
259@@ -1704,7 +1697,7 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
260 if (side_data) {
261 GST_LOG_OBJECT (ffmpegdec,
262 "Found CC side data of type AV_FRAME_DATA_A53_CC, size %d",
263- side_data->size);
264+ (int) side_data->size);
265 GST_MEMDUMP ("A53 CC", side_data->data, side_data->size);
266
267 /* do not add closed caption meta if it already exists */
268@@ -1966,8 +1959,9 @@ gst_ffmpegviddec_start (GstVideoDecoder * decoder)
269 oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
270
271 GST_OBJECT_LOCK (ffmpegdec);
272- gst_ffmpeg_avcodec_close (ffmpegdec->context);
273- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) {
274+ avcodec_free_context (&ffmpegdec->context);
275+ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin);
276+ if (ffmpegdec->context == NULL) {
277 GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
278 GST_OBJECT_UNLOCK (ffmpegdec);
279 return FALSE;
280@@ -2261,10 +2255,10 @@ gst_ffmpegviddec_get_property (GObject * object,
281
282 switch (prop_id) {
283 case PROP_LOWRES:
284- g_value_set_enum (value, ffmpegdec->context->lowres);
285+ g_value_set_enum (value, ffmpegdec->lowres);
286 break;
287 case PROP_SKIPFRAME:
288- g_value_set_enum (value, ffmpegdec->context->skip_frame);
289+ g_value_set_enum (value, ffmpegdec->skip_frame);
290 break;
291 case PROP_DIRECT_RENDERING:
292 g_value_set_boolean (value, ffmpegdec->direct_rendering);
293diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c
294index 0468d88..2ed9e5a 100644
295--- a/ext/libav/gstavvidenc.c
296+++ b/ext/libav/gstavvidenc.c
297@@ -224,8 +224,8 @@ gst_ffmpegvidenc_finalize (GObject * object)
298 av_frame_free (&ffmpegenc->picture);
299 gst_ffmpeg_avcodec_close (ffmpegenc->context);
300 gst_ffmpeg_avcodec_close (ffmpegenc->refcontext);
301- av_free (ffmpegenc->context);
302- av_free (ffmpegenc->refcontext);
303+ av_freep (&ffmpegenc->context);
304+ av_freep (&ffmpegenc->refcontext);
305
306 G_OBJECT_CLASS (parent_class)->finalize (object);
307 }
308@@ -247,10 +247,10 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
309
310 /* close old session */
311 if (ffmpegenc->opened) {
312- gst_ffmpeg_avcodec_close (ffmpegenc->context);
313+ avcodec_free_context (&ffmpegenc->context);
314 ffmpegenc->opened = FALSE;
315- if (avcodec_get_context_defaults3 (ffmpegenc->context,
316- oclass->in_plugin) < 0) {
317+ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin);
318+ if (ffmpegenc->context == NULL) {
319 GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
320 return FALSE;
321 }
322@@ -454,9 +454,9 @@ bad_input_fmt:
323 }
324 close_codec:
325 {
326- gst_ffmpeg_avcodec_close (ffmpegenc->context);
327- if (avcodec_get_context_defaults3 (ffmpegenc->context,
328- oclass->in_plugin) < 0)
329+ avcodec_free_context (&ffmpegenc->context);
330+ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin);
331+ if (ffmpegenc->context == NULL)
332 GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
333 goto cleanup_stats_in;
334 }
335@@ -896,8 +896,9 @@ gst_ffmpegvidenc_start (GstVideoEncoder * encoder)
336 ffmpegenc->need_reopen = FALSE;
337
338 /* close old session */
339- gst_ffmpeg_avcodec_close (ffmpegenc->context);
340- if (avcodec_get_context_defaults3 (ffmpegenc->context, oclass->in_plugin) < 0) {
341+ avcodec_free_context (&ffmpegenc->context);
342+ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin);
343+ if (ffmpegenc->context == NULL) {
344 GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
345 return FALSE;
346 }
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.0.bb
index 64b8bcdb52..98b2650bb0 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.0.bb
@@ -7,14 +7,12 @@ SECTION = "multimedia"
7# ffmpeg has comercial license flags so add it as we need ffmpeg as a dependency 7# ffmpeg has comercial license flags so add it as we need ffmpeg as a dependency
8LICENSE_FLAGS = "commercial" 8LICENSE_FLAGS = "commercial"
9LICENSE = "LGPLv2+" 9LICENSE = "LGPLv2+"
10LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ 10LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770 \
11 file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \ 11 file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \
12 " 12 "
13 13
14SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \ 14SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz"
15 file://0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch \ 15SRC_URI[sha256sum] = "5eee5ed8d5082a31b500448e41535c722ee30cd5f8224f32982bbaba2eedef17"
16 "
17SRC_URI[sha256sum] = "822e008a910e9dd13aedbdd8dc63fedef4040c0ee2e927bab3112e9de693a548"
18 16
19S = "${WORKDIR}/gst-libav-${PV}" 17S = "${WORKDIR}/gst-libav-${PV}"
20 18
@@ -22,5 +20,9 @@ DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base ffmpeg"
22 20
23inherit meson pkgconfig upstream-version-is-even 21inherit meson pkgconfig upstream-version-is-even
24 22
23EXTRA_OEMESON += " \
24 -Dtests=disabled \
25"
26
25FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" 27FILES:${PN} += "${libdir}/gstreamer-1.0/*.so"
26FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a" 28FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a"