Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
befa801151 |
21 changed files with 5610 additions and 598 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,5 +2,3 @@ ffmpeg-*.asc
|
||||||
ffmpeg-*.rpm
|
ffmpeg-*.rpm
|
||||||
ffmpeg-*.tar.xz
|
ffmpeg-*.tar.xz
|
||||||
/ffmpeg.keyring
|
/ffmpeg.keyring
|
||||||
/results_*
|
|
||||||
/*.rpm
|
|
||||||
|
|
|
||||||
109
0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch
Normal file
109
0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
From a641e629591d68bd3edd99bddec623dc31295f6b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kalev Lember <klember@redhat.com>
|
||||||
|
Date: Wed, 6 Dec 2023 14:37:34 +0100
|
||||||
|
Subject: [PATCH] lavc/libopenh264: Drop openh264 runtime version checks
|
||||||
|
|
||||||
|
Years ago, openh264 releases often changed their ABI without changing
|
||||||
|
the library soname. To avoid running into ABI issues, a version check
|
||||||
|
was added to lavc libopenh264 code to error out at runtime in case the
|
||||||
|
build time and runtime openh264 versions don't match.
|
||||||
|
|
||||||
|
This should no longer be an issue with newer openh264 releases and we
|
||||||
|
can drop the runtime version check and rely on upstream doing the right
|
||||||
|
thing and bump the library soname if the ABI changes, similar to how
|
||||||
|
other libraries are consumed in ffmpeg.
|
||||||
|
|
||||||
|
Almost all major distributions now include openh264 and this means there
|
||||||
|
are more eyes on ABI changes and issues are discovered and reported
|
||||||
|
quickly. See e.g. https://github.com/cisco/openh264/issues/3564 where an
|
||||||
|
ABI issue was quickly discovered and fixed.
|
||||||
|
|
||||||
|
Relaxing the check allows downstream distributions to build ffmpeg
|
||||||
|
against e.g. openh264 2.3.1 and ship an update to ABI-compatible
|
||||||
|
openh264 2.4.0, without needing to coordinate a lock step update between
|
||||||
|
ffmpeg and openh264 (which can be difficult if openh264 is distributed
|
||||||
|
by Cisco and ffmpeg comes from the distro, such as is the case for
|
||||||
|
Fedora).
|
||||||
|
|
||||||
|
Signed-off-by: Kalev Lember <klember@redhat.com>
|
||||||
|
---
|
||||||
|
libavcodec/libopenh264.c | 15 ---------------
|
||||||
|
libavcodec/libopenh264.h | 2 --
|
||||||
|
libavcodec/libopenh264dec.c | 4 ----
|
||||||
|
libavcodec/libopenh264enc.c | 4 ----
|
||||||
|
4 files changed, 25 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
|
||||||
|
index 0f6d28ed88..c80c85ea8b 100644
|
||||||
|
--- a/libavcodec/libopenh264.c
|
||||||
|
+++ b/libavcodec/libopenh264.c
|
||||||
|
@@ -46,18 +46,3 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg)
|
||||||
|
int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level);
|
||||||
|
av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-int ff_libopenh264_check_version(void *logctx)
|
||||||
|
-{
|
||||||
|
- // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
|
||||||
|
- // function (for functions returning larger structs), thus skip the check in those
|
||||||
|
- // configurations.
|
||||||
|
-#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
|
||||||
|
- OpenH264Version libver = WelsGetCodecVersion();
|
||||||
|
- if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
|
||||||
|
- av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
|
||||||
|
- return AVERROR(EINVAL);
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
diff --git a/libavcodec/libopenh264.h b/libavcodec/libopenh264.h
|
||||||
|
index dbb9c5d429..0b462d6fdc 100644
|
||||||
|
--- a/libavcodec/libopenh264.h
|
||||||
|
+++ b/libavcodec/libopenh264.h
|
||||||
|
@@ -34,6 +34,4 @@
|
||||||
|
|
||||||
|
void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg);
|
||||||
|
|
||||||
|
-int ff_libopenh264_check_version(void *logctx);
|
||||||
|
-
|
||||||
|
#endif /* AVCODEC_LIBOPENH264_H */
|
||||||
|
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
|
||||||
|
index 7d650ae03e..b6a9bba2dc 100644
|
||||||
|
--- a/libavcodec/libopenh264dec.c
|
||||||
|
+++ b/libavcodec/libopenh264dec.c
|
||||||
|
@@ -52,13 +52,9 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
SVCContext *s = avctx->priv_data;
|
||||||
|
SDecodingParam param = { 0 };
|
||||||
|
- int err;
|
||||||
|
int log_level;
|
||||||
|
WelsTraceCallback callback_function;
|
||||||
|
|
||||||
|
- if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
||||||
|
- return AVERROR_DECODER_NOT_FOUND;
|
||||||
|
-
|
||||||
|
if (WelsCreateDecoder(&s->decoder)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
|
||||||
|
index f518d0894e..6f231d22b2 100644
|
||||||
|
--- a/libavcodec/libopenh264enc.c
|
||||||
|
+++ b/libavcodec/libopenh264enc.c
|
||||||
|
@@ -110,14 +110,10 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
SVCContext *s = avctx->priv_data;
|
||||||
|
SEncParamExt param = { 0 };
|
||||||
|
- int err;
|
||||||
|
int log_level;
|
||||||
|
WelsTraceCallback callback_function;
|
||||||
|
AVCPBProperties *props;
|
||||||
|
|
||||||
|
- if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
||||||
|
- return AVERROR_ENCODER_NOT_FOUND;
|
||||||
|
-
|
||||||
|
if (WelsCreateSVCEncoder(&s->encoder)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
137
0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch
Normal file
137
0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
From 5176821735c397de2a108cd266a6c6759a5e0ffe Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Rosca <nowrep@gmail.com>
|
||||||
|
Date: Wed, 8 May 2024 09:11:11 +0200
|
||||||
|
Subject: [PATCH 1/2] lavc/vaapi_decode: Make it possible to send multiple
|
||||||
|
slice params buffers
|
||||||
|
|
||||||
|
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
|
||||||
|
Signed-off-by: David Rosca <nowrep@gmail.com>
|
||||||
|
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
|
||||||
|
(cherry picked from commit fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c)
|
||||||
|
|
||||||
|
[modified to drop h264/hevc/vc1 parts stripped in Fedora Linux]
|
||||||
|
---
|
||||||
|
libavcodec/vaapi_av1.c | 2 +-
|
||||||
|
libavcodec/vaapi_decode.c | 3 ++-
|
||||||
|
libavcodec/vaapi_decode.h | 1 +
|
||||||
|
libavcodec/vaapi_mjpeg.c | 2 +-
|
||||||
|
libavcodec/vaapi_mpeg2.c | 2 +-
|
||||||
|
libavcodec/vaapi_mpeg4.c | 2 +-
|
||||||
|
libavcodec/vaapi_vp8.c | 2 +-
|
||||||
|
libavcodec/vaapi_vp9.c | 2 +-
|
||||||
|
8 files changed, 9 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
|
||||||
|
index 1f9a6071ba..03771dd3e0 100644
|
||||||
|
--- a/libavcodec/vaapi_av1.c
|
||||||
|
+++ b/libavcodec/vaapi_av1.c
|
||||||
|
@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
|
||||||
|
.tg_end = s->tg_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param,
|
||||||
|
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
|
||||||
|
sizeof(VASliceParameterBufferAV1),
|
||||||
|
buffer,
|
||||||
|
size);
|
||||||
|
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
|
||||||
|
index ceac769c52..9344c21fd2 100644
|
||||||
|
--- a/libavcodec/vaapi_decode.c
|
||||||
|
+++ b/libavcodec/vaapi_decode.c
|
||||||
|
@@ -62,6 +62,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
|
||||||
|
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
|
||||||
|
VAAPIDecodePicture *pic,
|
||||||
|
const void *params_data,
|
||||||
|
+ int nb_params,
|
||||||
|
size_t params_size,
|
||||||
|
const void *slice_data,
|
||||||
|
size_t slice_size)
|
||||||
|
@@ -90,7 +91,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
|
||||||
|
|
||||||
|
vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
|
||||||
|
VASliceParameterBufferType,
|
||||||
|
- params_size, 1, (void*)params_data,
|
||||||
|
+ params_size, nb_params, (void*)params_data,
|
||||||
|
&pic->slice_buffers[index]);
|
||||||
|
if (vas != VA_STATUS_SUCCESS) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Failed to create slice "
|
||||||
|
diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h
|
||||||
|
index 6beda14e52..702171e108 100644
|
||||||
|
--- a/libavcodec/vaapi_decode.h
|
||||||
|
+++ b/libavcodec/vaapi_decode.h
|
||||||
|
@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
|
||||||
|
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
|
||||||
|
VAAPIDecodePicture *pic,
|
||||||
|
const void *params_data,
|
||||||
|
+ int nb_params,
|
||||||
|
size_t params_size,
|
||||||
|
const void *slice_data,
|
||||||
|
size_t slice_size);
|
||||||
|
diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c
|
||||||
|
index 5b8d47bb2a..9557cf5f9b 100644
|
||||||
|
--- a/libavcodec/vaapi_mjpeg.c
|
||||||
|
+++ b/libavcodec/vaapi_mjpeg.c
|
||||||
|
@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
|
||||||
|
sp.components[i].ac_table_selector = s->ac_index[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size);
|
||||||
|
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size);
|
||||||
|
if (err)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
|
||||||
|
index eeb4e87321..171a742c7f 100644
|
||||||
|
--- a/libavcodec/vaapi_mpeg2.c
|
||||||
|
+++ b/libavcodec/vaapi_mpeg2.c
|
||||||
|
@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
|
||||||
|
- &slice_param, sizeof(slice_param),
|
||||||
|
+ &slice_param, 1, sizeof(slice_param),
|
||||||
|
buffer, size);
|
||||||
|
if (err < 0) {
|
||||||
|
ff_vaapi_decode_cancel(avctx, pic);
|
||||||
|
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
|
||||||
|
index 363b686e42..612de10cd7 100644
|
||||||
|
--- a/libavcodec/vaapi_mpeg4.c
|
||||||
|
+++ b/libavcodec/vaapi_mpeg4.c
|
||||||
|
@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
|
||||||
|
- &slice_param, sizeof(slice_param),
|
||||||
|
+ &slice_param, 1, sizeof(slice_param),
|
||||||
|
buffer, size);
|
||||||
|
if (err < 0) {
|
||||||
|
ff_vaapi_decode_cancel(avctx, pic);
|
||||||
|
diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c
|
||||||
|
index 31137a45bd..66fdde1f39 100644
|
||||||
|
--- a/libavcodec/vaapi_vp8.c
|
||||||
|
+++ b/libavcodec/vaapi_vp8.c
|
||||||
|
@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx,
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
sp.partition_size[i+1] = s->coeff_partition_size[i];
|
||||||
|
|
||||||
|
- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size);
|
||||||
|
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size);
|
||||||
|
if (err)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
|
||||||
|
index 9dc7d5e72b..ff11022db7 100644
|
||||||
|
--- a/libavcodec/vaapi_vp9.c
|
||||||
|
+++ b/libavcodec/vaapi_vp9.c
|
||||||
|
@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
|
||||||
|
- &slice_param, sizeof(slice_param),
|
||||||
|
+ &slice_param, 1, sizeof(slice_param),
|
||||||
|
buffer, size);
|
||||||
|
if (err) {
|
||||||
|
ff_vaapi_decode_cancel(avctx, pic);
|
||||||
|
--
|
||||||
|
2.45.1
|
||||||
|
|
||||||
112
0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch
Normal file
112
0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
From 1740980b070897fd147b2d1a5259c9d7957d58a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Rosca <nowrep@gmail.com>
|
||||||
|
Date: Wed, 8 May 2024 09:11:13 +0200
|
||||||
|
Subject: [PATCH 2/2] lavc/vaapi_av1: Avoid sending the same slice buffer
|
||||||
|
multiple times
|
||||||
|
|
||||||
|
When there are multiple tiles in one slice buffer, use multiple slice
|
||||||
|
params to avoid sending the same slice buffer multiple times and thus
|
||||||
|
increasing the bitstream size the driver will need to upload to hw.
|
||||||
|
|
||||||
|
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
|
||||||
|
Signed-off-by: David Rosca <nowrep@gmail.com>
|
||||||
|
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
|
||||||
|
(cherry picked from commit d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba)
|
||||||
|
---
|
||||||
|
libavcodec/vaapi_av1.c | 47 +++++++++++++++++++++++++++++-------------
|
||||||
|
1 file changed, 33 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
|
||||||
|
index 03771dd3e0..ea8dd4d93d 100644
|
||||||
|
--- a/libavcodec/vaapi_av1.c
|
||||||
|
+++ b/libavcodec/vaapi_av1.c
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/frame.h"
|
||||||
|
+#include "libavutil/mem.h"
|
||||||
|
#include "hwaccel_internal.h"
|
||||||
|
#include "vaapi_decode.h"
|
||||||
|
#include "internal.h"
|
||||||
|
@@ -42,6 +43,9 @@ typedef struct VAAPIAV1DecContext {
|
||||||
|
*/
|
||||||
|
VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES];
|
||||||
|
AVFrame *tmp_frame;
|
||||||
|
+
|
||||||
|
+ int nb_slice_params;
|
||||||
|
+ VASliceParameterBufferAV1 *slice_params;
|
||||||
|
} VAAPIAV1DecContext;
|
||||||
|
|
||||||
|
static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
|
||||||
|
@@ -97,6 +101,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx)
|
||||||
|
for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++)
|
||||||
|
av_frame_free(&ctx->ref_tab[i].frame);
|
||||||
|
|
||||||
|
+ av_freep(&ctx->slice_params);
|
||||||
|
+
|
||||||
|
return ff_vaapi_decode_uninit(avctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -393,13 +399,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
|
||||||
|
{
|
||||||
|
const AV1DecContext *s = avctx->priv_data;
|
||||||
|
VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
|
||||||
|
- VASliceParameterBufferAV1 slice_param;
|
||||||
|
- int err = 0;
|
||||||
|
+ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||||
|
+ int err, nb_params;
|
||||||
|
+
|
||||||
|
+ nb_params = s->tg_end - s->tg_start + 1;
|
||||||
|
+ if (ctx->nb_slice_params < nb_params) {
|
||||||
|
+ ctx->slice_params = av_realloc_array(ctx->slice_params,
|
||||||
|
+ nb_params,
|
||||||
|
+ sizeof(*ctx->slice_params));
|
||||||
|
+ if (!ctx->slice_params) {
|
||||||
|
+ ctx->nb_slice_params = 0;
|
||||||
|
+ err = AVERROR(ENOMEM);
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+ ctx->nb_slice_params = nb_params;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
for (int i = s->tg_start; i <= s->tg_end; i++) {
|
||||||
|
- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1));
|
||||||
|
-
|
||||||
|
- slice_param = (VASliceParameterBufferAV1) {
|
||||||
|
+ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) {
|
||||||
|
.slice_data_size = s->tile_group_info[i].tile_size,
|
||||||
|
.slice_data_offset = s->tile_group_info[i].tile_offset,
|
||||||
|
.slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
|
||||||
|
@@ -408,18 +425,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
|
||||||
|
.tg_start = s->tg_start,
|
||||||
|
.tg_end = s->tg_end,
|
||||||
|
};
|
||||||
|
-
|
||||||
|
- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
|
||||||
|
- sizeof(VASliceParameterBufferAV1),
|
||||||
|
- buffer,
|
||||||
|
- size);
|
||||||
|
- if (err) {
|
||||||
|
- ff_vaapi_decode_cancel(avctx, pic);
|
||||||
|
- return err;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params,
|
||||||
|
+ sizeof(VASliceParameterBufferAV1),
|
||||||
|
+ buffer,
|
||||||
|
+ size);
|
||||||
|
+ if (err)
|
||||||
|
+ goto fail;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
+
|
||||||
|
+fail:
|
||||||
|
+ ff_vaapi_decode_cancel(avctx, pic);
|
||||||
|
+ return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FFHWAccel ff_av1_vaapi_hwaccel = {
|
||||||
|
--
|
||||||
|
2.45.1
|
||||||
|
|
||||||
21
README.md
21
README.md
|
|
@ -5,3 +5,24 @@ demux, stream, filter and play pretty much anything that humans and machines
|
||||||
have created. It supports the most obscure ancient formats up to the cutting
|
have created. It supports the most obscure ancient formats up to the cutting
|
||||||
edge. No matter if they were designed by some standards committee, the
|
edge. No matter if they were designed by some standards committee, the
|
||||||
community or a corporation.
|
community or a corporation.
|
||||||
|
|
||||||
|
## Creating the 'free' tarball
|
||||||
|
|
||||||
|
1. Update the `Version` in the spec file.
|
||||||
|
2. Set the `Release` to 0 in the spec file.
|
||||||
|
3. Set `pkg_suffix` to `%nil`
|
||||||
|
4. Do a full build locally: `fedpkg mockbuild --with full_build`
|
||||||
|
5. Run `./ffmpeg_update_free_sources.sh results_ffmpeg/5.0/0.fc35/build.log`
|
||||||
|
This will update the `ffmpeg_free_sources` file list.
|
||||||
|
Note that header files will need to be manually added
|
||||||
|
to the `ffmpeg_free_sources` file list.
|
||||||
|
6. Run `./ffmpeg_gen_free_tarball.sh` to create the tarball.
|
||||||
|
7. Set `pkg_suffix` to `-free` again
|
||||||
|
8. Set the `Release` to 1 in the spec file.
|
||||||
|
9. Do a scratch build.
|
||||||
|
|
||||||
|
OR
|
||||||
|
|
||||||
|
1. Edit `ffmpeg_free_sources` and add missing files
|
||||||
|
2. Run `./ffmpeg_gen_free_tarball.sh` to create the tarball.
|
||||||
|
3. Do a scratch build.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
## module name # reason for enablement in ffmpeg (usually there is another package that already got legal review)
|
## module name # reason for enablement in ffmpeg (usually there is another package that already got legal review)
|
||||||
aac
|
|
||||||
aasc
|
aasc
|
||||||
libfdk_aac # fdk-aac-free
|
libfdk_aac # fdk-aac-free
|
||||||
ac3
|
ac3
|
||||||
|
|
@ -57,7 +56,6 @@ adpcm_xa
|
||||||
adpcm_xmd
|
adpcm_xmd
|
||||||
adpcm_yamaha
|
adpcm_yamaha
|
||||||
adpcm_zork
|
adpcm_zork
|
||||||
aic
|
|
||||||
alac
|
alac
|
||||||
alias_pix
|
alias_pix
|
||||||
amrnb
|
amrnb
|
||||||
|
|
@ -69,7 +67,6 @@ anull
|
||||||
apac
|
apac
|
||||||
ape
|
ape
|
||||||
apng # animated png
|
apng # animated png
|
||||||
apv
|
|
||||||
arbc
|
arbc
|
||||||
argo
|
argo
|
||||||
ass # trivial
|
ass # trivial
|
||||||
|
|
@ -84,6 +81,7 @@ aura
|
||||||
aura2
|
aura2
|
||||||
av1 # libaom
|
av1 # libaom
|
||||||
av1_qsv # libaom
|
av1_qsv # libaom
|
||||||
|
ayuv # trivial
|
||||||
bethsoftvid # trivial
|
bethsoftvid # trivial
|
||||||
bfi # trivial
|
bfi # trivial
|
||||||
bink
|
bink
|
||||||
|
|
@ -116,7 +114,6 @@ dfa
|
||||||
dfpwm
|
dfpwm
|
||||||
dirac # dirac
|
dirac # dirac
|
||||||
dnxhd
|
dnxhd
|
||||||
dnxhr
|
|
||||||
dolby_e
|
dolby_e
|
||||||
dpx
|
dpx
|
||||||
dsd_lsbf
|
dsd_lsbf
|
||||||
|
|
@ -165,7 +162,7 @@ gsm_ms
|
||||||
gsm_ms_at
|
gsm_ms_at
|
||||||
h261
|
h261
|
||||||
h263
|
h263
|
||||||
h263_v4l2m2m # hardware
|
h263_v4l2m2m
|
||||||
h263i
|
h263i
|
||||||
h263p
|
h263p
|
||||||
hap
|
hap
|
||||||
|
|
@ -198,8 +195,6 @@ jv
|
||||||
kgv1
|
kgv1
|
||||||
kmvc
|
kmvc
|
||||||
lagarith
|
lagarith
|
||||||
libaribb24 # aribb24
|
|
||||||
libaribcaption # libaribcaption
|
|
||||||
libaom # libaom
|
libaom # libaom
|
||||||
libaom_av1 # libaom
|
libaom_av1 # libaom
|
||||||
libcodec2 # codec2
|
libcodec2 # codec2
|
||||||
|
|
@ -208,10 +203,9 @@ libgsm # libgsm
|
||||||
libgsm_ms # libgsm
|
libgsm_ms # libgsm
|
||||||
libilbc # ilbc
|
libilbc # ilbc
|
||||||
libjxl # libjxl
|
libjxl # libjxl
|
||||||
liblc3 # liblc3
|
|
||||||
libopencore_amrnb # opencore-amr
|
libopencore_amrnb # opencore-amr
|
||||||
libopencore_amrwb # opencore-amr
|
libopencore_amrwb # opencore-amr
|
||||||
libopenh264 # openh264
|
libopenh264 # openh264_dlopen
|
||||||
libopenjpeg # openjpeg
|
libopenjpeg # openjpeg
|
||||||
libopus # opus
|
libopus # opus
|
||||||
librsvg # librsvg
|
librsvg # librsvg
|
||||||
|
|
@ -220,7 +214,6 @@ libspeex # speex
|
||||||
libvorbis # libvorbis
|
libvorbis # libvorbis
|
||||||
libvpx_vp8 # libvpx
|
libvpx_vp8 # libvpx
|
||||||
libvpx_vp9 # libvpx
|
libvpx_vp9 # libvpx
|
||||||
libxevd
|
|
||||||
libzvbi_teletext # zvbi
|
libzvbi_teletext # zvbi
|
||||||
loco
|
loco
|
||||||
lscr
|
lscr
|
||||||
|
|
@ -251,13 +244,13 @@ mp3on4
|
||||||
mp3on4float
|
mp3on4float
|
||||||
mpc7
|
mpc7
|
||||||
mpc8
|
mpc8
|
||||||
mpeg1_v4l2m2m
|
|
||||||
mpeg1video
|
mpeg1video
|
||||||
|
mpeg1_v4l2m2m
|
||||||
|
mpeg2video
|
||||||
mpeg2_qsv
|
mpeg2_qsv
|
||||||
mpeg2_v4l2m2m
|
mpeg2_v4l2m2m
|
||||||
mpeg2video
|
|
||||||
mpeg4
|
mpeg4
|
||||||
mpeg4_v4l2m2m # hardware
|
mpeg4_v4l2m2m
|
||||||
mpegvideo
|
mpegvideo
|
||||||
mpl2
|
mpl2
|
||||||
msa1
|
msa1
|
||||||
|
|
@ -335,8 +328,6 @@ pictor
|
||||||
pjs
|
pjs
|
||||||
png # libpng
|
png # libpng
|
||||||
ppm # trivial
|
ppm # trivial
|
||||||
prores
|
|
||||||
prores_raw
|
|
||||||
prosumer
|
prosumer
|
||||||
psd
|
psd
|
||||||
ptx
|
ptx
|
||||||
|
|
@ -344,7 +335,6 @@ qcelp
|
||||||
qdm2
|
qdm2
|
||||||
qdmc
|
qdmc
|
||||||
qdraw
|
qdraw
|
||||||
qoa
|
|
||||||
qoi
|
qoi
|
||||||
qpeg
|
qpeg
|
||||||
qtrle
|
qtrle
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ av1_amf
|
||||||
av1_nvenc
|
av1_nvenc
|
||||||
av1_qsv
|
av1_qsv
|
||||||
av1_vaapi
|
av1_vaapi
|
||||||
|
ayuv # trival
|
||||||
bitpacked # trivial
|
bitpacked # trivial
|
||||||
bmp # trivial
|
bmp # trivial
|
||||||
cinepak
|
cinepak
|
||||||
|
|
@ -38,7 +39,6 @@ cljr
|
||||||
dca
|
dca
|
||||||
dfpwm
|
dfpwm
|
||||||
dnxhd
|
dnxhd
|
||||||
dnxhr
|
|
||||||
dpx
|
dpx
|
||||||
dvbsub
|
dvbsub
|
||||||
dvdsub
|
dvdsub
|
||||||
|
|
@ -70,23 +70,22 @@ hevc_v4l2m2m # hardware
|
||||||
hevc_vaapi # hardware
|
hevc_vaapi # hardware
|
||||||
huffyuv # trivial+zlib
|
huffyuv # trivial+zlib
|
||||||
ilbc # ilbc
|
ilbc # ilbc
|
||||||
jpeg2000
|
|
||||||
jpegls
|
jpegls
|
||||||
libaom
|
jpeg2000
|
||||||
|
libaom # libaom
|
||||||
libaom_av1 # libaom
|
libaom_av1 # libaom
|
||||||
libcodec2 # codec2
|
libcodec2 # codec2
|
||||||
libgsm # libgsm
|
libgsm # libgsm
|
||||||
libgsm_ms # libgsm
|
libgsm_ms # libgsm
|
||||||
libilbc # ilbc
|
libilbc # ilbc
|
||||||
libjxl # libjxl
|
libjxl # libjxl
|
||||||
liblc3 # liblc3
|
|
||||||
libmp3lame # lame
|
libmp3lame # lame
|
||||||
liboapv
|
|
||||||
libopencore_amrnb
|
libopencore_amrnb
|
||||||
libopenh264 # openh264
|
libopenh264 # openh264_dlopen
|
||||||
libopenjpeg # openjpeg
|
libopenjpeg # openjpeg
|
||||||
libopus # opus
|
libopus # opus
|
||||||
librav1e # rav1e
|
librav1e # rav1e
|
||||||
|
libschroedinger # schroedinger
|
||||||
libspeex # speex
|
libspeex # speex
|
||||||
libsvtav1
|
libsvtav1
|
||||||
libtheora # libtheora
|
libtheora # libtheora
|
||||||
|
|
@ -97,7 +96,6 @@ libvpx_vp8 # libvpx
|
||||||
libvpx_vp9 # libvpx
|
libvpx_vp9 # libvpx
|
||||||
libwebp # libwebp
|
libwebp # libwebp
|
||||||
libwebp_anim # libwebp
|
libwebp_anim # libwebp
|
||||||
libxeve
|
|
||||||
libxvid # xvidcore
|
libxvid # xvidcore
|
||||||
mjpeg # mjpegtools
|
mjpeg # mjpegtools
|
||||||
mjpeg_qsv # mjpegtools
|
mjpeg_qsv # mjpegtools
|
||||||
|
|
@ -106,9 +104,9 @@ mlp
|
||||||
mp2 # twolame
|
mp2 # twolame
|
||||||
mp2fixed # twolame
|
mp2fixed # twolame
|
||||||
mpeg1video
|
mpeg1video
|
||||||
|
mpeg2video
|
||||||
mpeg2_qsv
|
mpeg2_qsv
|
||||||
mpeg2_vaapi
|
mpeg2_vaapi
|
||||||
mpeg2video
|
|
||||||
mpeg4
|
mpeg4
|
||||||
mpeg4_v4l2m2m # hardware
|
mpeg4_v4l2m2m # hardware
|
||||||
msmpeg4v2
|
msmpeg4v2
|
||||||
|
|
@ -149,9 +147,6 @@ pgmyuv # trivial
|
||||||
phm # trivial
|
phm # trivial
|
||||||
png # libpng
|
png # libpng
|
||||||
ppm # trivial
|
ppm # trivial
|
||||||
prores
|
|
||||||
prores_aw
|
|
||||||
prores_ks
|
|
||||||
qoi
|
qoi
|
||||||
qtrle
|
qtrle
|
||||||
r10k # trivial
|
r10k # trivial
|
||||||
|
|
|
||||||
54
ffmpeg-CVE-2023-49528.patch
Normal file
54
ffmpeg-CVE-2023-49528.patch
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
From 2d9ed64859c9887d0504cd71dbd5b2c15e14251a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul B Mahol <onemda@gmail.com>
|
||||||
|
Date: Sat, 25 Nov 2023 12:54:28 +0100
|
||||||
|
Subject: [PATCH] avfilter/af_dialoguenhance: fix overreads
|
||||||
|
|
||||||
|
---
|
||||||
|
libavfilter/af_dialoguenhance.c | 17 +++++++++--------
|
||||||
|
1 file changed, 9 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c
|
||||||
|
index 1762ea7cde..29c8ab10a7 100644
|
||||||
|
--- a/libavfilter/af_dialoguenhance.c
|
||||||
|
+++ b/libavfilter/af_dialoguenhance.c
|
||||||
|
@@ -96,12 +96,12 @@ static int config_input(AVFilterLink *inlink)
|
||||||
|
if (!s->window)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
- s->in_frame = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
- s->center_frame = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
- s->out_dist_frame = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
- s->windowed_frame = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
- s->windowed_out = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
- s->windowed_prev = ff_get_audio_buffer(inlink, s->fft_size * 4);
|
||||||
|
+ s->in_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
+ s->center_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
+ s->out_dist_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
+ s->windowed_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
+ s->windowed_out = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
+ s->windowed_prev = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2);
|
||||||
|
if (!s->in_frame || !s->windowed_out || !s->windowed_prev ||
|
||||||
|
!s->out_dist_frame || !s->windowed_frame || !s->center_frame)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
@@ -250,6 +250,7 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out)
|
||||||
|
float *right_osamples = (float *)out->extended_data[1];
|
||||||
|
float *center_osamples = (float *)out->extended_data[2];
|
||||||
|
const int offset = s->fft_size - s->overlap;
|
||||||
|
+ const int nb_samples = FFMIN(s->overlap, s->in->nb_samples);
|
||||||
|
float vad;
|
||||||
|
|
||||||
|
// shift in/out buffers
|
||||||
|
@@ -258,8 +259,8 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out)
|
||||||
|
memmove(left_out, &left_out[s->overlap], offset * sizeof(float));
|
||||||
|
memmove(right_out, &right_out[s->overlap], offset * sizeof(float));
|
||||||
|
|
||||||
|
- memcpy(&left_in[offset], left_samples, s->overlap * sizeof(float));
|
||||||
|
- memcpy(&right_in[offset], right_samples, s->overlap * sizeof(float));
|
||||||
|
+ memcpy(&left_in[offset], left_samples, nb_samples * sizeof(float));
|
||||||
|
+ memcpy(&right_in[offset], right_samples, nb_samples * sizeof(float));
|
||||||
|
memset(&left_out[offset], 0, s->overlap * sizeof(float));
|
||||||
|
memset(&right_out[offset], 0, s->overlap * sizeof(float));
|
||||||
|
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
32
ffmpeg-CVE-2024-12361.patch
Normal file
32
ffmpeg-CVE-2024-12361.patch
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
From 4065ff69a2ed49872f8694a03d0642b18c9d977c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jiasheng Jiang <jiashengjiangcool@outlook.com>
|
||||||
|
Date: Mon, 10 Jun 2024 14:18:11 +0000
|
||||||
|
Subject: [PATCH] avcodec/mpegvideo_enc: Add check for
|
||||||
|
av_packet_new_side_data()
|
||||||
|
|
||||||
|
Add check for av_packet_new_side_data() to avoid null pointer
|
||||||
|
dereference if allocation fails.
|
||||||
|
|
||||||
|
Fixes: bdc1220eeb ("h263enc: Add an option for outputting info about MBs as side data")
|
||||||
|
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@outlook.com>
|
||||||
|
Signed-off-by: Anton Khirnov <anton@khirnov.net>
|
||||||
|
---
|
||||||
|
libavcodec/mpegvideo_enc.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
|
||||||
|
index 620ca08869..d33754d115 100644
|
||||||
|
--- a/libavcodec/mpegvideo_enc.c
|
||||||
|
+++ b/libavcodec/mpegvideo_enc.c
|
||||||
|
@@ -1825,6 +1825,8 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
|
s->mb_info_ptr = av_packet_new_side_data(pkt,
|
||||||
|
AV_PKT_DATA_H263_MB_INFO,
|
||||||
|
s->mb_width*s->mb_height*12);
|
||||||
|
+ if (!s->mb_info_ptr)
|
||||||
|
+ return AVERROR(ENOMEM);
|
||||||
|
s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
|
|
@ -4,24 +4,23 @@ fdk-aac-free-devel is GPL compatible
|
||||||
|
|
||||||
See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112
|
See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112
|
||||||
|
|
||||||
Index: ffmpeg-7.0/configure
|
Index: ffmpeg-5.0/configure
|
||||||
===================================================================
|
===================================================================
|
||||||
--- ffmpeg-7.0.orig/configure 2022-02-09 20:07:49.490888877 +0100
|
--- ffmpeg-5.0.orig/configure 2022-02-09 20:07:49.490888877 +0100
|
||||||
+++ ffmpeg-7.0/configure 2022-02-09 20:08:30.102854308 +0100
|
+++ ffmpeg-5.0/configure 2022-02-09 20:08:30.102854308 +0100
|
||||||
@@ -1872,7 +1872,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
@@ -1783,7 +1783,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
||||||
|
|
||||||
EXTERNAL_LIBRARY_NONFREE_LIST="
|
EXTERNAL_LIBRARY_NONFREE_LIST="
|
||||||
decklink
|
decklink
|
||||||
- libfdk_aac
|
- libfdk_aac
|
||||||
libtls
|
libtls
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -1912,6 +1911,7 @@ EXTERNAL_LIBRARY_LIST="
|
@@ -1822,6 +1821,7 @@ EXTERNAL_LIBRARY_LIST="
|
||||||
libcodec2
|
|
||||||
libdav1d
|
libdav1d
|
||||||
libdc1394
|
libdc1394
|
||||||
|
libdrm
|
||||||
+ libfdk_aac
|
+ libfdk_aac
|
||||||
libflite
|
libflite
|
||||||
libfontconfig
|
libfontconfig
|
||||||
libfreetype
|
libfreetype
|
||||||
|
|
||||||
|
|
|
||||||
67
ffmpeg-c99.patch
Normal file
67
ffmpeg-c99.patch
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Frank Plowman <post@frankplowman.com>
|
||||||
|
Date: Fri, 22 Dec 2023 12:00:01 +0000
|
||||||
|
Subject: [PATCH] avformat/ffrtmpcrypt: Fix int-conversion warning
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
Content-type: text/plain
|
||||||
|
|
||||||
|
The gcrypt definition of `bn_new` used to use the return statement
|
||||||
|
on errors, with an AVERROR return value, regardless of the signature
|
||||||
|
of the function where the macro is used - it is called in
|
||||||
|
`dh_generate_key` and `ff_dh_init` which return pointers. As a result,
|
||||||
|
compiling with gcrypt and the ffrtmpcrypt protocol resulted in an
|
||||||
|
int-conversion warning. GCC 14 may upgrade these to errors [1].
|
||||||
|
|
||||||
|
This patch fixes the problem by changing the macro to remove `AVERROR`
|
||||||
|
and instead set `bn` to null if the allocation fails. This is the
|
||||||
|
behaviour of all the other `bn_new` implementations and so the result is
|
||||||
|
already checked at all the callsites. AFAICT, this should be the only
|
||||||
|
change needed to get ffmpeg off Fedora's naughty list of projects with
|
||||||
|
warnings which may be upgraded to errors in GCC 14 [2].
|
||||||
|
|
||||||
|
[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html
|
||||||
|
[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html
|
||||||
|
|
||||||
|
Signed-off-by: Frank Plowman <post@frankplowman.com>
|
||||||
|
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||||
|
---
|
||||||
|
libavformat/rtmpdh.c | 21 ++++++++++++---------
|
||||||
|
1 file changed, 12 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
|
||||||
|
index 5ddae537a1..6a6c2ccd87 100644
|
||||||
|
--- a/libavformat/rtmpdh.c
|
||||||
|
+++ b/libavformat/rtmpdh.c
|
||||||
|
@@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#elif CONFIG_GCRYPT
|
||||||
|
-#define bn_new(bn) \
|
||||||
|
- do { \
|
||||||
|
- if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \
|
||||||
|
- if (!gcry_check_version("1.5.4")) \
|
||||||
|
- return AVERROR(EINVAL); \
|
||||||
|
- gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \
|
||||||
|
- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \
|
||||||
|
- } \
|
||||||
|
- bn = gcry_mpi_new(1); \
|
||||||
|
+#define bn_new(bn) \
|
||||||
|
+ do { \
|
||||||
|
+ if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \
|
||||||
|
+ if (gcry_check_version("1.5.4")) { \
|
||||||
|
+ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \
|
||||||
|
+ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \
|
||||||
|
+ } \
|
||||||
|
+ } \
|
||||||
|
+ if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) \
|
||||||
|
+ bn = gcry_mpi_new(1); \
|
||||||
|
+ else \
|
||||||
|
+ bn = NULL; \
|
||||||
|
} while (0)
|
||||||
|
#define bn_free(bn) gcry_mpi_release(bn)
|
||||||
|
#define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w)
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
|
|
@ -12,35 +12,35 @@ diff --git a/libavformat/avformat.h b/libavformat/avformat.h
|
||||||
index 1916aa2dc5..e6682849fa 100644
|
index 1916aa2dc5..e6682849fa 100644
|
||||||
--- a/libavformat/avformat.h
|
--- a/libavformat/avformat.h
|
||||||
+++ b/libavformat/avformat.h
|
+++ b/libavformat/avformat.h
|
||||||
@@ -1170,6 +1170,10 @@ typedef struct AVStreamGroup {
|
@@ -1019,6 +1019,10 @@ attribute_deprecated
|
||||||
|
int64_t av_stream_get_end_pts(const AVStream *st);
|
||||||
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
|
#endif
|
||||||
|
|
||||||
+// Chromium: We use the internal field first_dts vvv
|
+// Chromium: We use the internal field first_dts vvv
|
||||||
+int64_t av_stream_get_first_dts(const AVStream *st);
|
+int64_t av_stream_get_first_dts(const AVStream *st);
|
||||||
+// Chromium: We use the internal field first_dts ^^^
|
+// Chromium: We use the internal field first_dts ^^^
|
||||||
+
|
+
|
||||||
#define AV_PROGRAM_RUNNING 1
|
#define AV_PROGRAM_RUNNING 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||||
index cf4d68bff9..7d750abf88 100644
|
index cf4d68bff9..7d750abf88 100644
|
||||||
--- a/libavformat/utils.c
|
--- a/libavformat/utils.c
|
||||||
+++ b/libavformat/utils.c
|
+++ b/libavformat/utils.c
|
||||||
@@ -56,6 +56,13 @@ int ff_unlock_avformat(void)
|
@@ -55,6 +55,13 @@ int ff_unlock_avformat(void)
|
||||||
* various utility functions for use within FFmpeg
|
return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
|
||||||
*/
|
}
|
||||||
|
|
||||||
+// Chromium: We use the internal field first_dts vvv
|
+// Chromium: We use the internal field first_dts vvv
|
||||||
+int64_t av_stream_get_first_dts(const AVStream *st)
|
+int64_t av_stream_get_first_dts(const AVStream *st)
|
||||||
+{
|
+{
|
||||||
+ return cffstream(st)->first_dts;
|
+ return cffstream(st)->first_dts;
|
||||||
+}
|
+}
|
||||||
+// Chromium: We use the internal field first_dts ^^^
|
+// Chromium: We use the internal field first_dts ^^^
|
||||||
+
|
+
|
||||||
/* an arbitrarily chosen "sane" max packet size -- 50M */
|
/* an arbitrarily chosen "sane" max packet size -- 50M */
|
||||||
#define SANE_CHUNK_SIZE (50000000)
|
#define SANE_CHUNK_SIZE (50000000)
|
||||||
|
|
||||||
--
|
--
|
||||||
2.41.0
|
2.41.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,19 @@ reduced codec selection list.
|
||||||
libavformat/matroskaenc.c | 20 ++++++++++++++------
|
libavformat/matroskaenc.c | 20 ++++++++++++++------
|
||||||
1 file changed, 14 insertions(+), 6 deletions(-)
|
1 file changed, 14 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
Index: ffmpeg-7.0/libavformat/matroskaenc.c
|
Index: ffmpeg-6.0/libavformat/matroskaenc.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- ffmpeg-7.0.orig/libavformat/matroskaenc.c
|
--- ffmpeg-6.0.orig/libavformat/matroskaenc.c
|
||||||
+++ ffmpeg-7.0/libavformat/matroskaenc.c
|
+++ ffmpeg-6.0/libavformat/matroskaenc.c
|
||||||
@@ -3540,16 +3540,25 @@ static int mkv_query_codec(enum AVCodecI
|
@@ -3321,16 +3321,25 @@ static int mkv_query_codec(enum AVCodecI
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
+#define PREFAUDIO \
|
+#define PREFAUDIO \
|
||||||
+ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \
|
+ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \
|
||||||
+ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \
|
+ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \
|
||||||
+ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \
|
+ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \
|
||||||
+ AV_CODEC_ID_AC3
|
+ AV_CODEC_ID_AC3
|
||||||
+
|
+
|
||||||
const FFOutputFormat ff_matroska_muxer = {
|
const FFOutputFormat ff_matroska_muxer = {
|
||||||
.p.name = "matroska",
|
.p.name = "matroska",
|
||||||
|
|
@ -36,16 +36,16 @@ Index: ffmpeg-7.0/libavformat/matroskaenc.c
|
||||||
- .p.video_codec = CONFIG_LIBX264_ENCODER ?
|
- .p.video_codec = CONFIG_LIBX264_ENCODER ?
|
||||||
- AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
|
- AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
|
||||||
+ .p.audio_codec = PREFAUDIO,
|
+ .p.audio_codec = PREFAUDIO,
|
||||||
+ .p.video_codec =
|
+ .p.video_codec =
|
||||||
+ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \
|
+ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \
|
||||||
+ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \
|
+ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \
|
||||||
+ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \
|
+ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \
|
||||||
+ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \
|
+ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \
|
||||||
+ AV_CODEC_ID_THEORA,
|
+ AV_CODEC_ID_THEORA,
|
||||||
.init = mkv_init,
|
.init = mkv_init,
|
||||||
.deinit = mkv_deinit,
|
.deinit = mkv_deinit,
|
||||||
.write_header = mkv_write_header,
|
.write_header = mkv_write_header,
|
||||||
@@ -3617,8 +3626,7 @@ const FFOutputFormat ff_matroska_audio_m
|
@@ -3388,8 +3397,7 @@ const FFOutputFormat ff_matroska_audio_m
|
||||||
.p.mime_type = "audio/x-matroska",
|
.p.mime_type = "audio/x-matroska",
|
||||||
.p.extensions = "mka",
|
.p.extensions = "mka",
|
||||||
.priv_data_size = sizeof(MatroskaMuxContext),
|
.priv_data_size = sizeof(MatroskaMuxContext),
|
||||||
|
|
@ -55,4 +55,3 @@ Index: ffmpeg-7.0/libavformat/matroskaenc.c
|
||||||
.p.video_codec = AV_CODEC_ID_NONE,
|
.p.video_codec = AV_CODEC_ID_NONE,
|
||||||
.init = mkv_init,
|
.init = mkv_init,
|
||||||
.deinit = mkv_deinit,
|
.deinit = mkv_deinit,
|
||||||
|
|
||||||
|
|
|
||||||
363
ffmpeg-dlopen-openh264.patch
Normal file
363
ffmpeg-dlopen-openh264.patch
Normal file
|
|
@ -0,0 +1,363 @@
|
||||||
|
From 3daa49cae0bfc3de434dd28c3a23ae877f0639db Mon Sep 17 00:00:00 2001
|
||||||
|
From: Neal Gompa <ngompa@fedoraproject.org>
|
||||||
|
Date: Thu, 4 Jan 2024 10:21:17 -0500
|
||||||
|
Subject: [PATCH] lavc/openh264: Add the ability to dlopen() OpenH264
|
||||||
|
|
||||||
|
We can't directly depend on OpenH264, but we can weakly link to it
|
||||||
|
and gracefully expose the capability.
|
||||||
|
|
||||||
|
Co-authored-by: Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
Co-authored-by: Neal Gompa <ngompa@fedoraproject.org>
|
||||||
|
|
||||||
|
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
|
||||||
|
---
|
||||||
|
configure | 3 +
|
||||||
|
libavcodec/Makefile | 1 +
|
||||||
|
libavcodec/libopenh264.c | 5 ++
|
||||||
|
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
|
||||||
|
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
|
||||||
|
libavcodec/libopenh264dec.c | 10 +++
|
||||||
|
libavcodec/libopenh264enc.c | 10 +++
|
||||||
|
7 files changed, 234 insertions(+)
|
||||||
|
create mode 100644 libavcodec/libopenh264_dlopen.c
|
||||||
|
create mode 100644 libavcodec/libopenh264_dlopen.h
|
||||||
|
|
||||||
|
diff --git a/configure b/configure
|
||||||
|
index 1f0b9497cb..97fa4a5d6a 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -249,6 +249,7 @@ External library support:
|
||||||
|
--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
|
||||||
|
--enable-libopencv enable video filtering via libopencv [no]
|
||||||
|
--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
|
||||||
|
+ --enable-libopenh264-dlopen enable H.264 encoding via dlopen()'ed OpenH264 [no]
|
||||||
|
--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
|
||||||
|
--enable-libopenmpt enable decoding tracked files via libopenmpt [no]
|
||||||
|
--enable-libopenvino enable OpenVINO as a DNN module backend
|
||||||
|
@@ -1871,6 +1872,7 @@ EXTERNAL_LIBRARY_LIST="
|
||||||
|
libmysofa
|
||||||
|
libopencv
|
||||||
|
libopenh264
|
||||||
|
+ libopenh264_dlopen
|
||||||
|
libopenjpeg
|
||||||
|
libopenmpt
|
||||||
|
libopenvino
|
||||||
|
@@ -6765,6 +6767,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h &&
|
||||||
|
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
|
||||||
|
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
|
||||||
|
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
|
||||||
|
+enabled libopenh264_dlopen && enable libopenh264 && add_cppflags "-I$(dirname `readlink -f $0`)/ffdlopenhdrs/include -DCONFIG_LIBOPENH264_DLOPEN=1"
|
||||||
|
enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
|
||||||
|
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
|
||||||
|
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
|
||||||
|
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
|
||||||
|
index 580a8d6b54..c27d229f6d 100644
|
||||||
|
--- a/libavcodec/Makefile
|
||||||
|
+++ b/libavcodec/Makefile
|
||||||
|
@@ -1115,6 +1115,7 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
|
||||||
|
+OBJS-$(CONFIG_LIBOPENH264_DLOPEN) += libopenh264_dlopen.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
|
||||||
|
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
|
||||||
|
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
|
||||||
|
index c80c85ea8b..128c3d9846 100644
|
||||||
|
--- a/libavcodec/libopenh264.c
|
||||||
|
+++ b/libavcodec/libopenh264.c
|
||||||
|
@@ -20,8 +20,13 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+#include "libopenh264_dlopen.h"
|
||||||
|
+#else
|
||||||
|
#include <wels/codec_api.h>
|
||||||
|
#include <wels/codec_ver.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "libavutil/error.h"
|
||||||
|
#include "libavutil/log.h"
|
||||||
|
diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..49ea8ff44f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libavcodec/libopenh264_dlopen.c
|
||||||
|
@@ -0,0 +1,147 @@
|
||||||
|
+/*
|
||||||
|
+ * OpenH264 dlopen code
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2022 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
+ *
|
||||||
|
+ * This file is part of FFmpeg.
|
||||||
|
+ *
|
||||||
|
+ * FFmpeg is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with FFmpeg; if not, write to the Free Software
|
||||||
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <dlfcn.h>
|
||||||
|
+
|
||||||
|
+#include "libopenh264_dlopen.h"
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * The symbol binding makes sure we do not run into strict aliasing issues which
|
||||||
|
+ * can lead into segfaults.
|
||||||
|
+ */
|
||||||
|
+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **);
|
||||||
|
+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *);
|
||||||
|
+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *);
|
||||||
|
+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **);
|
||||||
|
+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *);
|
||||||
|
+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void);
|
||||||
|
+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *);
|
||||||
|
+
|
||||||
|
+#define OH264_SYMBOL_ENTRY(i) \
|
||||||
|
+ union { \
|
||||||
|
+ __oh264_##i f; \
|
||||||
|
+ void *obj; \
|
||||||
|
+ } _oh264_##i
|
||||||
|
+
|
||||||
|
+struct oh264_symbols {
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsGetDecoderCapability);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsCreateDecoder);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsDestroyDecoder);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersion);
|
||||||
|
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx);
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Symbols are bound by loadLibOpenH264() */
|
||||||
|
+static struct oh264_symbols openh264_symbols;
|
||||||
|
+
|
||||||
|
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder) {
|
||||||
|
+ return openh264_symbols._oh264_WelsCreateSVCEncoder.f(ppEncoder);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder) {
|
||||||
|
+ return openh264_symbols._oh264_WelsDestroySVCEncoder.f(pEncoder);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability) {
|
||||||
|
+ return openh264_symbols._oh264_WelsGetDecoderCapability.f(pDecCapability);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder) {
|
||||||
|
+ return openh264_symbols._oh264_WelsCreateDecoder.f(ppDecoder);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder) {
|
||||||
|
+ return openh264_symbols._oh264_WelsDestroyDecoder.f(pDecoder);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OpenH264Version oh264_WelsGetCodecVersion(void) {
|
||||||
|
+ return openh264_symbols._oh264_WelsGetCodecVersion.f();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion) {
|
||||||
|
+ openh264_symbols._oh264_WelsGetCodecVersionEx.f(pVersion);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void *_oh264_bind_symbol(AVCodecContext *avctx,
|
||||||
|
+ void *handle,
|
||||||
|
+ const char *sym_name) {
|
||||||
|
+ void *sym = NULL;
|
||||||
|
+
|
||||||
|
+ sym = dlsym(handle, sym_name);
|
||||||
|
+ if (sym == NULL) {
|
||||||
|
+ const char *err = dlerror();
|
||||||
|
+ av_log(avctx,
|
||||||
|
+ AV_LOG_WARNING,
|
||||||
|
+ "%s: Failed to bind %s\n",
|
||||||
|
+ err,
|
||||||
|
+ sym_name);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return sym;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#define oh264_bind_symbol(avctx, handle, sym_name) \
|
||||||
|
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
|
||||||
|
+ openh264_symbols._oh264_##sym_name.obj = _oh264_bind_symbol(avctx, handle, #sym_name); \
|
||||||
|
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
|
||||||
|
+ return 1; \
|
||||||
|
+ } \
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+int loadLibOpenH264(AVCodecContext *avctx) {
|
||||||
|
+ static bool initialized = false;
|
||||||
|
+ void *libopenh264 = NULL;
|
||||||
|
+ const char *err = NULL;
|
||||||
|
+
|
||||||
|
+ if (initialized) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#define OPENH264_LIB "libopenh264.so.7"
|
||||||
|
+ libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY);
|
||||||
|
+ err = dlerror();
|
||||||
|
+ if (err != NULL) {
|
||||||
|
+ av_log(avctx, AV_LOG_WARNING,
|
||||||
|
+ "%s: %s is missing, openh264 support will be disabled\n", err,
|
||||||
|
+ OPENH264_LIB);
|
||||||
|
+
|
||||||
|
+ if (libopenh264 != NULL) {
|
||||||
|
+ dlclose(libopenh264);
|
||||||
|
+ }
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateSVCEncoder);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroySVCEncoder);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsGetDecoderCapability);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateDecoder);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroyDecoder);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersion);
|
||||||
|
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersionEx);
|
||||||
|
+
|
||||||
|
+ initialized = true;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
diff --git a/libavcodec/libopenh264_dlopen.h b/libavcodec/libopenh264_dlopen.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..d7d8bb7cad
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libavcodec/libopenh264_dlopen.h
|
||||||
|
@@ -0,0 +1,58 @@
|
||||||
|
+/*
|
||||||
|
+ * OpenH264 dlopen code
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2022 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
+ *
|
||||||
|
+ * This file is part of FFmpeg.
|
||||||
|
+ *
|
||||||
|
+ * FFmpeg is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with FFmpeg; if not, write to the Free Software
|
||||||
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HAVE_LIBOPENH264_DLOPEN_H
|
||||||
|
+#define HAVE_LIBOPENH264_DLOPEN_H
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+
|
||||||
|
+#include <wels/codec_api.h>
|
||||||
|
+#include <wels/codec_ver.h>
|
||||||
|
+
|
||||||
|
+#include "avcodec.h"
|
||||||
|
+
|
||||||
|
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder);
|
||||||
|
+#define WelsCreateSVCEncoder oh264_WelsCreateSVCEncoder
|
||||||
|
+
|
||||||
|
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder);
|
||||||
|
+#define WelsDestroySVCEncoder oh264_WelsDestroySVCEncoder
|
||||||
|
+
|
||||||
|
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability);
|
||||||
|
+#define WelsGetDecoderCapability oh264_WelsGetDecoderCapability
|
||||||
|
+
|
||||||
|
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder);
|
||||||
|
+#define WelsCreateDecoder oh264_WelsCreateDecoder
|
||||||
|
+
|
||||||
|
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder);
|
||||||
|
+#define WelsDestroyDecoder oh264_WelsDestroyDecoder
|
||||||
|
+
|
||||||
|
+OpenH264Version oh264_WelsGetCodecVersion(void);
|
||||||
|
+#define WelsGetCodecVersion oh264_WelsGetCodecVersion
|
||||||
|
+
|
||||||
|
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion);
|
||||||
|
+#define WelsGetCodecVersionEx oh264_WelsGetCodecVersionEx
|
||||||
|
+
|
||||||
|
+int loadLibOpenH264(AVCodecContext *avctx);
|
||||||
|
+
|
||||||
|
+#endif /* CONFIG_LIBOPENH264_DLOPEN */
|
||||||
|
+
|
||||||
|
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
|
||||||
|
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
|
||||||
|
index b6a9bba2dc..e042189161 100644
|
||||||
|
--- a/libavcodec/libopenh264dec.c
|
||||||
|
+++ b/libavcodec/libopenh264dec.c
|
||||||
|
@@ -19,8 +19,12 @@
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+#include "libopenh264_dlopen.h"
|
||||||
|
+#else
|
||||||
|
#include <wels/codec_api.h>
|
||||||
|
#include <wels/codec_ver.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "libavutil/common.h"
|
||||||
|
#include "libavutil/fifo.h"
|
||||||
|
@@ -55,6 +59,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
|
||||||
|
int log_level;
|
||||||
|
WelsTraceCallback callback_function;
|
||||||
|
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+ if (loadLibOpenH264(avctx)) {
|
||||||
|
+ return AVERROR_DECODER_NOT_FOUND;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (WelsCreateDecoder(&s->decoder)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
|
||||||
|
index 6f231d22b2..3f0e990d80 100644
|
||||||
|
--- a/libavcodec/libopenh264enc.c
|
||||||
|
+++ b/libavcodec/libopenh264enc.c
|
||||||
|
@@ -19,8 +19,12 @@
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+#include "libopenh264_dlopen.h"
|
||||||
|
+#else
|
||||||
|
#include <wels/codec_api.h>
|
||||||
|
#include <wels/codec_ver.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/common.h"
|
||||||
|
@@ -114,6 +118,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
||||||
|
WelsTraceCallback callback_function;
|
||||||
|
AVCPBProperties *props;
|
||||||
|
|
||||||
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
|
+ if (loadLibOpenH264(avctx)) {
|
||||||
|
+ return AVERROR_ENCODER_NOT_FOUND;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (WelsCreateSVCEncoder(&s->encoder)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
131
ffmpeg-gcc14.patch
Normal file
131
ffmpeg-gcc14.patch
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
From 68ef9a29478fad450ec29ec14120afad3938e75b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sandro Mani <manisandro@gmail.com>
|
||||||
|
Date: Tue, 30 Jan 2024 09:16:13 +0100
|
||||||
|
Subject: [PATCH] Fix -Wint-conversion and -Wincompatible-pointer-types errors
|
||||||
|
|
||||||
|
---
|
||||||
|
libavcodec/pcm-bluray.c | 4 ++--
|
||||||
|
libavcodec/pcm-dvd.c | 2 +-
|
||||||
|
libavcodec/vulkan_av1.c | 2 +-
|
||||||
|
libavcodec/vulkan_decode.c | 6 +++---
|
||||||
|
libavcodec/vulkan_video.c | 2 +-
|
||||||
|
libavfilter/vsrc_testsrc_vulkan.c | 4 ++--
|
||||||
|
libavutil/hwcontext_vaapi.c | 2 +-
|
||||||
|
7 files changed, 11 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c
|
||||||
|
index f656095..56fa373 100644
|
||||||
|
--- a/libavcodec/pcm-bluray.c
|
||||||
|
+++ b/libavcodec/pcm-bluray.c
|
||||||
|
@@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
|
samples *= num_source_channels;
|
||||||
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
|
#if HAVE_BIGENDIAN
|
||||||
|
- bytestream2_get_buffer(&gb, dst16, buf_size);
|
||||||
|
+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size);
|
||||||
|
#else
|
||||||
|
do {
|
||||||
|
*dst16++ = bytestream2_get_be16u(&gb);
|
||||||
|
@@ -187,7 +187,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
|
do {
|
||||||
|
#if HAVE_BIGENDIAN
|
||||||
|
- bytestream2_get_buffer(&gb, dst16, avctx->ch_layout.nb_channels * 2);
|
||||||
|
+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, avctx->ch_layout.nb_channels * 2);
|
||||||
|
dst16 += avctx->ch_layout.nb_channels;
|
||||||
|
#else
|
||||||
|
channel = avctx->ch_layout.nb_channels;
|
||||||
|
diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c
|
||||||
|
index 419b2a1..319746c 100644
|
||||||
|
--- a/libavcodec/pcm-dvd.c
|
||||||
|
+++ b/libavcodec/pcm-dvd.c
|
||||||
|
@@ -157,7 +157,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
|
||||||
|
switch (avctx->bits_per_coded_sample) {
|
||||||
|
case 16: {
|
||||||
|
#if HAVE_BIGENDIAN
|
||||||
|
- bytestream2_get_buffer(&gb, dst16, blocks * s->block_size);
|
||||||
|
+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, blocks * s->block_size);
|
||||||
|
dst16 += blocks * s->block_size / 2;
|
||||||
|
#else
|
||||||
|
int samples = blocks * avctx->ch_layout.nb_channels;
|
||||||
|
diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
|
||||||
|
index 4998bf7..9730e4b 100644
|
||||||
|
--- a/libavcodec/vulkan_av1.c
|
||||||
|
+++ b/libavcodec/vulkan_av1.c
|
||||||
|
@@ -180,7 +180,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf)
|
||||||
|
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
|
||||||
|
.pNext = &av1_params,
|
||||||
|
.videoSession = ctx->common.session,
|
||||||
|
- .videoSessionParametersTemplate = NULL,
|
||||||
|
+ .videoSessionParametersTemplate = VK_NULL_HANDLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create);
|
||||||
|
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
|
||||||
|
index a89d84f..fdbcbb4 100644
|
||||||
|
--- a/libavcodec/vulkan_decode.c
|
||||||
|
+++ b/libavcodec/vulkan_decode.c
|
||||||
|
@@ -188,9 +188,9 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic,
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
vkpic->dpb_frame = NULL;
|
||||||
|
- vkpic->img_view_ref = NULL;
|
||||||
|
- vkpic->img_view_out = NULL;
|
||||||
|
- vkpic->img_view_dest = NULL;
|
||||||
|
+ vkpic->img_view_ref = VK_NULL_HANDLE;
|
||||||
|
+ vkpic->img_view_out = VK_NULL_HANDLE;
|
||||||
|
+ vkpic->img_view_dest = VK_NULL_HANDLE;
|
||||||
|
|
||||||
|
vkpic->destroy_image_view = vk->DestroyImageView;
|
||||||
|
vkpic->wait_semaphores = vk->WaitSemaphores;
|
||||||
|
diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
|
||||||
|
index 236aa12..c5144bd 100644
|
||||||
|
--- a/libavcodec/vulkan_video.c
|
||||||
|
+++ b/libavcodec/vulkan_video.c
|
||||||
|
@@ -287,7 +287,7 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s,
|
||||||
|
if (common->session) {
|
||||||
|
vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session,
|
||||||
|
s->hwctx->alloc);
|
||||||
|
- common->session = NULL;
|
||||||
|
+ common->session = VK_NULL_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (common->nb_mem && common->mem)
|
||||||
|
diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c
|
||||||
|
index 8761c21..1720bfa 100644
|
||||||
|
--- a/libavfilter/vsrc_testsrc_vulkan.c
|
||||||
|
+++ b/libavfilter/vsrc_testsrc_vulkan.c
|
||||||
|
@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL,
|
||||||
|
- NULL, &s->opts, sizeof(s->opts));
|
||||||
|
+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts));
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)
|
||||||
|
frame->sample_aspect_ratio = s->sar;
|
||||||
|
if (!s->draw_once) {
|
||||||
|
err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL,
|
||||||
|
- NULL, &s->opts, sizeof(s->opts));
|
||||||
|
+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts));
|
||||||
|
if (err < 0) {
|
||||||
|
av_frame_free(&frame);
|
||||||
|
return err;
|
||||||
|
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
|
||||||
|
index 12bc951..d326ad6 100644
|
||||||
|
--- a/libavutil/hwcontext_vaapi.c
|
||||||
|
+++ b/libavutil/hwcontext_vaapi.c
|
||||||
|
@@ -1203,7 +1203,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
|
||||||
|
|
||||||
|
if (!use_prime2 || vas != VA_STATUS_SUCCESS) {
|
||||||
|
int k;
|
||||||
|
- unsigned long buffer_handle;
|
||||||
|
+ size_t buffer_handle;
|
||||||
|
VASurfaceAttribExternalBuffers buffer_desc;
|
||||||
|
VASurfaceAttrib buffer_attrs[2] = {
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
From 80bf83e3099652a3e7f8d1e8b6d902fea1ce4db9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: James Almer <jamrial@gmail.com>
|
|
||||||
Date: Sun, 24 Aug 2025 15:57:16 -0300
|
|
||||||
Subject: [PATCH] configure: support linking to base profile libxev{d,e}
|
|
||||||
|
|
||||||
Addresses issue #20328.
|
|
||||||
|
|
||||||
Signed-off-by: James Almer <jamrial@gmail.com>
|
|
||||||
---
|
|
||||||
configure | 16 ++++++++++++++--
|
|
||||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index aa41b2a7b3..5386ae8b9a 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -299,7 +299,9 @@ External library support:
|
|
||||||
--enable-libx264 enable H.264 encoding via x264 [no]
|
|
||||||
--enable-libx265 enable HEVC encoding via x265 [no]
|
|
||||||
--enable-libxeve enable EVC encoding via libxeve [no]
|
|
||||||
+ --enable-libxeveb enable EVC encoding via libxeve (Base profile) [no]
|
|
||||||
--enable-libxevd enable EVC decoding via libxevd [no]
|
|
||||||
+ --enable-libxevdb enable EVC decoding via libxevd (Base profile) [no]
|
|
||||||
--enable-libxavs enable AVS encoding via xavs [no]
|
|
||||||
--enable-libxavs2 enable AVS2 encoding via xavs2 [no]
|
|
||||||
--enable-libxcb enable X11 grabbing using XCB [autodetect]
|
|
||||||
@@ -1992,7 +1994,9 @@ EXTERNAL_LIBRARY_LIST="
|
|
||||||
libvvenc
|
|
||||||
libwebp
|
|
||||||
libxevd
|
|
||||||
+ libxevdb
|
|
||||||
libxeve
|
|
||||||
+ libxeveb
|
|
||||||
libxml2
|
|
||||||
libzimg
|
|
||||||
libzmq
|
|
||||||
@@ -3669,8 +3673,8 @@ libx265_encoder_deps="libx265"
|
|
||||||
libx265_encoder_select="atsc_a53 dovi_rpuenc"
|
|
||||||
libxavs_encoder_deps="libxavs"
|
|
||||||
libxavs2_encoder_deps="libxavs2"
|
|
||||||
-libxevd_decoder_deps="libxevd"
|
|
||||||
-libxeve_encoder_deps="libxeve"
|
|
||||||
+libxevd_decoder_deps_any="libxevd libxevdb"
|
|
||||||
+libxeve_encoder_deps_any="libxeve libxeveb"
|
|
||||||
libxvid_encoder_deps="libxvid"
|
|
||||||
libzvbi_teletext_decoder_deps="libzvbi"
|
|
||||||
vapoursynth_demuxer_deps="vapoursynth"
|
|
||||||
@@ -4615,6 +4619,12 @@ enabled_all gnutls mbedtls &&
|
|
||||||
enabled_all openssl mbedtls &&
|
|
||||||
die "OpenSSL and mbedTLS must not be enabled at the same time."
|
|
||||||
|
|
||||||
+enabled_all libxevd libxevdb &&
|
|
||||||
+ die "libxevd and libxevdb must not be enabled at the same time."
|
|
||||||
+
|
|
||||||
+enabled_all libxeve libxeveb &&
|
|
||||||
+ die "libxeve and libxevdb must not be enabled at the same time."
|
|
||||||
+
|
|
||||||
# Disable all the library-specific components if the library itself
|
|
||||||
# is disabled, see AVCODEC_LIST and following _LIST variables.
|
|
||||||
|
|
||||||
@@ -7204,7 +7214,9 @@ enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get
|
|
||||||
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
|
|
||||||
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
|
|
||||||
enabled libxevd && require_pkg_config libxevd "xevd >= 0.4.1" "xevd.h" xevd_decode
|
|
||||||
+enabled libxevdb && require_pkg_config libxevdb "xevdb >= 0.4.1" "xevd.h" xevd_decode
|
|
||||||
enabled libxeve && require_pkg_config libxeve "xeve >= 0.5.1" "xeve.h" xeve_encode
|
|
||||||
+enabled libxeveb && require_pkg_config libxeveb "xeveb >= 0.5.1" "xeve.h" xeve_encode
|
|
||||||
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
|
|
||||||
enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
|
|
||||||
enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new
|
|
||||||
--
|
|
||||||
2.49.1
|
|
||||||
|
|
||||||
725
ffmpeg.spec
725
ffmpeg.spec
File diff suppressed because it is too large
Load diff
4078
ffmpeg_free_sources
Normal file
4078
ffmpeg_free_sources
Normal file
File diff suppressed because it is too large
Load diff
130
ffmpeg_gen_free_tarball.sh
Executable file
130
ffmpeg_gen_free_tarball.sh
Executable file
|
|
@ -0,0 +1,130 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# shellcheck disable=2181
|
||||||
|
|
||||||
|
export LC_COLLATE="C.UTF-8"
|
||||||
|
|
||||||
|
FF_PKGNAME="ffmpeg"
|
||||||
|
FF_PKGNAME_SUFFIX="-free"
|
||||||
|
FF_VERSION="$(rpmspec -P ./*.spec | grep ^Version | sed -e 's/Version:[ ]*//g')"
|
||||||
|
FF_TARBALL_URL="https://ffmpeg.org/releases/${FF_PKGNAME}-${FF_VERSION}.tar.xz"
|
||||||
|
FF_TARBALL="$(basename "${FF_TARBALL_URL}")"
|
||||||
|
FF_GPG_ARMOR_FILE="${FF_TARBALL}.asc"
|
||||||
|
FF_PKG_DIR="$(pwd)"
|
||||||
|
FF_KEYRING="${FF_PKG_DIR}/ffmpeg.keyring"
|
||||||
|
FF_TMPDIR=$(mktemp --tmpdir -d ffmpeg-XXXXXXXX)
|
||||||
|
FF_PATH="${FF_TMPDIR}/${FF_PKGNAME}-${FF_VERSION}"
|
||||||
|
|
||||||
|
cleanup_tmpdir() {
|
||||||
|
# shellcheck disable=2164
|
||||||
|
popd 2>/dev/null
|
||||||
|
rm -rf "${FF_TMPDIR}"
|
||||||
|
}
|
||||||
|
trap cleanup_tmpdir SIGINT
|
||||||
|
|
||||||
|
cleanup_and_exit()
|
||||||
|
{
|
||||||
|
cleanup_tmpdir
|
||||||
|
|
||||||
|
if test "$1" = 0 -o -z "$1"; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
# shellcheck disable=2086
|
||||||
|
exit ${1}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! -w "${FF_TARBALL}" ]]; then
|
||||||
|
echo ">>> Downloading tarball"
|
||||||
|
wget "${FF_TARBALL_URL}"
|
||||||
|
fi
|
||||||
|
if [[ ! -w "${FF_TARBALL}.asc" ]]; then
|
||||||
|
echo ">>> Downloading signature"
|
||||||
|
wget "${FF_TARBALL_URL}.asc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ">>> Verifying ${FF_TARBALL} GPG signature"
|
||||||
|
gpgv2 --quiet --keyring "${FF_KEYRING}" "${FF_GPG_ARMOR_FILE}" "${FF_TARBALL}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: GPG signature verification failed"
|
||||||
|
cleanup_and_exit 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ">>> Unpacking ${FF_TARBALL}"
|
||||||
|
|
||||||
|
tar -xf "${FF_TARBALL}" -C "${FF_TMPDIR}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Failed to unpack ${FF_TARBALL}"
|
||||||
|
cleanup_and_exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -r ffmpeg_free_sources ]]; then
|
||||||
|
echo "ERROR: ffmpeg_free_sources doesn't exist!"
|
||||||
|
cleanup_and_exit 1
|
||||||
|
fi
|
||||||
|
readarray -t keepfiles < ffmpeg_free_sources
|
||||||
|
|
||||||
|
pushd "${FF_PATH}" || cleanup_and_exit 1
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> Cleaning up sources for new tarball ..."
|
||||||
|
|
||||||
|
# Get file list from ffmpeg
|
||||||
|
mapfile -d '' filelist < <(find ./ -type f -printf '%P\0')
|
||||||
|
|
||||||
|
# Sort arrays
|
||||||
|
readarray -t keepfiles_sorted < <(printf '%s\0' "${keepfiles[@]}" | sort -z | xargs -0n1)
|
||||||
|
readarray -t filelist_sorted < <(printf '%s\0' "${filelist[@]}" | sort -z | xargs -0n1)
|
||||||
|
|
||||||
|
# Compare arrays and remove files which are left over
|
||||||
|
comm -2 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0 rm -f
|
||||||
|
|
||||||
|
readarray -t removed_files < <(comm -1 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0n1)
|
||||||
|
if [[ "${#removed_files[@]}" -ge 1 ]]; then
|
||||||
|
if [[ "${#removed_files[@]}" -eq 1 ]] && [[ -z "${removed_files[0]}" ]]; then
|
||||||
|
echo "... done"
|
||||||
|
else
|
||||||
|
echo "File not in upstream tarball anymore (please cleanup 'ffmpeg_free_sources'):"
|
||||||
|
for f in "${removed_files[@]}"; do
|
||||||
|
if [[ -z "${f}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo " * ${f}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
popd || cleanup_and_exit 1 # /FF_PATH
|
||||||
|
|
||||||
|
pushd "${FF_TMPDIR}" || cleanup_and_exit 1
|
||||||
|
|
||||||
|
echo ">>> Create new tarball ${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz ..."
|
||||||
|
tar -cJf "${FF_PKG_DIR}/${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz" "${FF_PKGNAME}-${FF_VERSION}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Creating tarball failed"
|
||||||
|
cleanup_and_exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd || cleanup_and_exit 1 # /FF_TMPDIR
|
||||||
|
|
||||||
|
du -sh "${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz"
|
||||||
|
echo
|
||||||
|
|
||||||
|
cleanup_and_exit 0
|
||||||
60
ffmpeg_update_free_sources.sh
Executable file
60
ffmpeg_update_free_sources.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# shellcheck disable=2181
|
||||||
|
|
||||||
|
export LC_COLLATE="C.UTF-8"
|
||||||
|
|
||||||
|
cleanup_and_exit()
|
||||||
|
{
|
||||||
|
if test "$1" = 0 -o -z "$1"; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
# shellcheck disable=2086
|
||||||
|
exit ${1}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ">>> Collect information from ${1}"
|
||||||
|
build_log="$(readlink -f "${1}")"
|
||||||
|
if [[ -z "${build_log}" ]] || [[ ! -r "${build_log}" ]]; then
|
||||||
|
echo "Build log doesn't exist: %{build_log}"
|
||||||
|
cleanup_and_exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
asm_files="$(grep "^gcc.*\.c$" "${build_log}" | awk 'NF>1{print $NF}' | sort)"
|
||||||
|
c_files="$(grep "^nasm.*\.asm$" "${build_log}" | awk 'NF>1{print $NF}' | sort)"
|
||||||
|
|
||||||
|
# shellcheck disable=2206
|
||||||
|
new_sources=(${asm_files}
|
||||||
|
${c_files})
|
||||||
|
|
||||||
|
# Sort arrays
|
||||||
|
readarray -t new_sources_sorted < <(printf '%s\0' "${new_sources[@]}" | sort -z | xargs -0n1)
|
||||||
|
|
||||||
|
# Create a backup for a diff
|
||||||
|
cp -a ffmpeg_free_sources ffmpeg_free_sources.orig
|
||||||
|
cp -a ffmpeg_free_sources ffmpeg_free_sources.new
|
||||||
|
printf "%s\n" "${new_sources_sorted[@]}" >> ffmpeg_free_sources.new
|
||||||
|
# Update ffmpeg_free_sources
|
||||||
|
echo ">>> Updating ffmpeg_free_sources"
|
||||||
|
sort < ffmpeg_free_sources.new | uniq | sed '/^$/d' > ffmpeg_free_sources
|
||||||
|
echo ">>> Differences in file list"
|
||||||
|
diff -u ffmpeg_free_sources.orig ffmpeg_free_sources
|
||||||
|
rm -f ffmpeg_free_sources.new
|
||||||
|
|
||||||
|
cleanup_and_exit 0
|
||||||
5
sources
5
sources
|
|
@ -1,3 +1,4 @@
|
||||||
SHA512 (ffmpeg-8.0.1.tar.xz) = 7af5cd1c7ba04f8d7ea1b54b64b9c235f2a606dc0c18d25cfdf20958bcad4851d3265b4894fc6ba5dd205c2309971c7e7fb890ee1d64e0a41a3faf159f77957f
|
SHA512 (ffmpeg-free-6.1.2.tar.xz) = edaa836c69b0ec2f484a4fd9b49dab97f76e7c6451449f8db8f81f04558974d850b725e3affc36f9790c206a049e42b710f54bb8fd7e4da00ec80ebce6a13e5f
|
||||||
SHA512 (ffmpeg-8.0.1.tar.xz.asc) = f56e9e89ecdf9f12e3dae90b52289e5d09bfbfc0f6e13aaf17da9330c138fdb62b132f856c2fd16f5d9f5d6bcf1725602c8781c3e5f07bda6ce1306c379792ab
|
SHA512 (ffmpeg-6.1.2.tar.xz.asc) = a26dba1f4870b964080b45f8468f5ce3591eb6aa69be426bf4afbe5a60c3cbd0fe5056dc86ca7bb817c04ae30d39160cb7773772a9a2123ae7f095b18a6d7050
|
||||||
|
SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099
|
||||||
SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165
|
SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue