forked from pool/ffmpeg-6
Jan Engelhardt
6f66ffe151
- Update to version 6.1.1: * libaribcaption decoder * Playdate video decoder and demuxer * Extend VAAPI support for libva-win32 on Windows * afireqsrc audio source filter * arls filter * ffmpeg CLI new option: -readrate_initial_burst * zoneplate video source filter * command support in the setpts and asetpts filters * Vulkan decode hwaccel, supporting H264, HEVC and AV1 * color_vulkan filter * bwdif_vulkan filter * nlmeans_vulkan filter * RivaTuner video decoder * xfade_vulkan filter * vMix video decoder * Essential Video Coding parser, muxer and demuxer * Essential Video Coding frame merge bsf * bwdif_cuda filter * Microsoft RLE video encoder * Raw AC-4 muxer and demuxer * Raw VVC bitstream parser, muxer and demuxer * Bitstream filter for editing metadata in VVC streams * Bitstream filter for converting VVC from MP4 to Annex B * scale_vt filter for videotoolbox * transpose_vt filter for videotoolbox * support for the P_SKIP hinting to speed up libx264 encoding * Support HEVC,VP9,AV1 codec in enhanced flv format * apsnr and asisdr audio filters * OSQ demuxer and decoder * Support HEVC,VP9,AV1 codec fourcclist in enhanced rtmp protocol * CRI USM demuxer * ffmpeg CLI '-top' option deprecated in favor of the setfield filter * VAAPI AV1 encoder * ffprobe XML output schema changed to account for multiple variable-fields elements within the same parent element * ffprobe -output_format option added as an alias of -of - Remove patch6 0001-avfilter-vf_libplacebo-remove-deprecated-field.diff - Prefer libvpl to libmfx: the latter is deprecated - Delete ffmpeg-6-private-devel package as it is only needed to build libav-tools - Remove patch2 ffmpeg-new-coder-errors.diff OBS-URL: https://build.opensuse.org/request/show/1138974 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ffmpeg-6?expand=0&rev=20
196 lines
8.4 KiB
Diff
196 lines
8.4 KiB
Diff
From: Ismail Dönmez <ismail@i10z.com>
|
|
Date: 2019-06-11 11:21:23
|
|
|
|
This is ffmpeg-4.1-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
|
|
from OpenMandriva to optionally enable runtime enabling of
|
|
fdkaac/lame/x264/x265.
|
|
|
|
---
|
|
configure | 3 ++
|
|
libavcodec/dlopen.h | 12 ++++++++++
|
|
libavcodec/libfdk-aacdec.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
|
|
libavcodec/libfdk-aacenc.c | 47 +++++++++++++++++++++++++++++++++++++++
|
|
4 files changed, 115 insertions(+)
|
|
|
|
Index: ffmpeg-6.1.1/configure
|
|
===================================================================
|
|
--- ffmpeg-6.1.1.orig/configure
|
|
+++ ffmpeg-6.1.1/configure
|
|
@@ -228,6 +228,7 @@ External library support:
|
|
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
|
|
and libraw1394 [no]
|
|
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
|
|
+ --enable-libfdk-aac-dlopen enable AAC de/encoding via dlopen()'ed libfdk-aac [no]
|
|
--enable-libflite enable flite (voice synthesis) support via libflite [no]
|
|
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
|
|
--enable-libfreetype enable libfreetype, needed for drawtext filter [no]
|
|
@@ -1812,6 +1813,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
|
EXTERNAL_LIBRARY_NONFREE_LIST="
|
|
decklink
|
|
libfdk_aac
|
|
+ libfdk_aac_dlopen
|
|
libtls
|
|
"
|
|
|
|
@@ -6697,6 +6699,7 @@ enabled libdrm && require_pkg
|
|
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
|
|
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
|
|
warn "using libfdk without pkg-config"; } }
|
|
+enabled libfdk_aac_dlopen && enable libfdk_aac && add_cppflags "-I/usr/include/fdk-aac"
|
|
flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
|
|
enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
|
|
enabled fontconfig && enable libfontconfig
|
|
Index: ffmpeg-6.1.1/libavcodec/dlopen.h
|
|
===================================================================
|
|
--- /dev/null
|
|
+++ ffmpeg-6.1.1/libavcodec/dlopen.h
|
|
@@ -0,0 +1,12 @@
|
|
+#ifndef LOCALINC_DLOPEN_H
|
|
+#define LOCALINC_DLOPEN_H
|
|
+#include <dlfcn.h>
|
|
+#define num2str(x) str(x)
|
|
+#define str(x) #x
|
|
+
|
|
+#define dl_sym(func, args, lib) \
|
|
+ dl_##func = args dlsym(lib, #func); \
|
|
+ if ((err = dlerror())) \
|
|
+ goto error;
|
|
+
|
|
+#endif
|
|
Index: ffmpeg-6.1.1/libavcodec/libfdk-aacdec.c
|
|
===================================================================
|
|
--- ffmpeg-6.1.1.orig/libavcodec/libfdk-aacdec.c
|
|
+++ ffmpeg-6.1.1/libavcodec/libfdk-aacdec.c
|
|
@@ -38,6 +38,54 @@
|
|
#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
|
|
#endif
|
|
|
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
|
+#include "dlopen.h"
|
|
+AAC_DECODER_ERROR (*dl_aacDecoder_AncDataInit)(HANDLE_AACDECODER, UCHAR*, int);
|
|
+HANDLE_AACDECODER (*dl_aacDecoder_Open)(TRANSPORT_TYPE, UINT);
|
|
+AAC_DECODER_ERROR (*dl_aacDecoder_Fill)(HANDLE_AACDECODER, UCHAR**, const UINT*, UINT*);
|
|
+AAC_DECODER_ERROR (*dl_aacDecoder_ConfigRaw)(HANDLE_AACDECODER, UCHAR **, const UINT*);
|
|
+AAC_DECODER_ERROR (*dl_aacDecoder_SetParam)(const HANDLE_AACDECODER, const AACDEC_PARAM, const INT);
|
|
+AAC_DECODER_ERROR (*dl_aacDecoder_DecodeFrame)(HANDLE_AACDECODER, INT_PCM*, const INT, const UINT);
|
|
+CStreamInfo* (*dl_aacDecoder_GetStreamInfo)(HANDLE_AACDECODER);
|
|
+void (*dl_aacDecoder_Close)(HANDLE_AACDECODER);
|
|
+#define aacDecoder_AncDataInit dl_aacDecoder_AncDataInit
|
|
+#define aacDecoder_Open dl_aacDecoder_Open
|
|
+#define aacDecoder_Fill dl_aacDecoder_Fill
|
|
+#define aacDecoder_ConfigRaw dl_aacDecoder_ConfigRaw
|
|
+#define aacDecoder_SetParam dl_aacDecoder_SetParam
|
|
+#define aacDecoder_DecodeFrame dl_aacDecoder_DecodeFrame
|
|
+#define aacDecoder_GetStreamInfo dl_aacDecoder_GetStreamInfo
|
|
+#define aacDecoder_Close dl_aacDecoder_Close
|
|
+#define FDKAAC_LIB "libfdk-aac.so.2"
|
|
+static int loadLibFdkAac(AVCodecContext *avctx);
|
|
+static int loadLibFdkAac(AVCodecContext *avctx) {
|
|
+ void *libfdkaac = NULL;
|
|
+ const char *err = NULL;
|
|
+
|
|
+ libfdkaac = dlopen(FDKAAC_LIB, RTLD_LAZY);
|
|
+ if(err = dlerror()) {
|
|
+ av_log(avctx, AV_LOG_FATAL, "%s\n%s is missing, libfdk-aac support will be disabled\n", err, FDKAAC_LIB);
|
|
+ if(libfdkaac)
|
|
+ dlclose(libfdkaac);
|
|
+ return 1;
|
|
+ }
|
|
+ dl_sym(aacDecoder_AncDataInit, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR*, int)), libfdkaac);
|
|
+ dl_sym(aacDecoder_Open, (HANDLE_AACDECODER (*)(TRANSPORT_TYPE, UINT)), libfdkaac);
|
|
+ dl_sym(aacDecoder_Fill, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR**, const UINT*, UINT*)), libfdkaac);
|
|
+ dl_sym(aacDecoder_ConfigRaw, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR**, const UINT*)), libfdkaac);
|
|
+ dl_sym(aacDecoder_SetParam, (AAC_DECODER_ERROR (*)(const HANDLE_AACDECODER, const AACDEC_PARAM, const INT)), libfdkaac);
|
|
+ dl_sym(aacDecoder_DecodeFrame, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, INT_PCM*, const INT, const UINT)), libfdkaac);
|
|
+ dl_sym(aacDecoder_GetStreamInfo, (CStreamInfo* (*)(HANDLE_AACDECODER)), libfdkaac);
|
|
+ dl_sym(aacDecoder_Close, (void (*)(HANDLE_AACDECODER)), libfdkaac);
|
|
+ return 0;
|
|
+error:
|
|
+ av_log(avctx, AV_LOG_FATAL, "libfdk-aac: Missing symbols in %s: %s\n"
|
|
+ "libfdk-aac support disabled\n", FDKAAC_LIB, err);
|
|
+ dlclose(libfdkaac);
|
|
+ return 1;
|
|
+}
|
|
+#endif
|
|
+
|
|
enum ConcealMethod {
|
|
CONCEAL_METHOD_SPECTRAL_MUTING = 0,
|
|
CONCEAL_METHOD_NOISE_SUBSTITUTION = 1,
|
|
@@ -244,6 +292,11 @@ static av_cold int fdk_aac_decode_init(A
|
|
FDKAACDecContext *s = avctx->priv_data;
|
|
AAC_DECODER_ERROR err;
|
|
|
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
|
+ if (loadLibFdkAac(avctx))
|
|
+ return -1;
|
|
+#endif
|
|
+
|
|
s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
|
|
if (!s->handle) {
|
|
av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
|
|
Index: ffmpeg-6.1.1/libavcodec/libfdk-aacenc.c
|
|
===================================================================
|
|
--- ffmpeg-6.1.1.orig/libavcodec/libfdk-aacenc.c
|
|
+++ ffmpeg-6.1.1/libavcodec/libfdk-aacenc.c
|
|
@@ -37,6 +37,48 @@
|
|
#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
|
|
#endif
|
|
|
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
|
+#include "dlopen.h"
|
|
+#include <fdk-aac/aacdecoder_lib.h>
|
|
+AACENC_ERROR (*dl_aacEncOpen)(HANDLE_AACENCODER*, const UINT, const UINT);
|
|
+AACENC_ERROR (*dl_aacEncoder_SetParam)(const HANDLE_AACENCODER, const AACENC_PARAM, const UINT);
|
|
+AACENC_ERROR (*dl_aacEncEncode)(const HANDLE_AACENCODER, const AACENC_BufDesc*, const AACENC_BufDesc*, const AACENC_InArgs*, AACENC_OutArgs*);
|
|
+AACENC_ERROR (*dl_aacEncInfo)(const HANDLE_AACENCODER, AACENC_InfoStruct*);
|
|
+AACENC_ERROR (*dl_aacEncClose)(HANDLE_AACENCODER*);
|
|
+
|
|
+#define aacEncOpen dl_aacEncOpen
|
|
+#define aacEncoder_SetParam dl_aacEncoder_SetParam
|
|
+#define aacEncEncode dl_aacEncEncode
|
|
+#define aacEncInfo dl_aacEncInfo
|
|
+#define aacEncClose dl_aacEncClose
|
|
+#define FDKAAC_LIB "libfdk-aac.so.2"
|
|
+
|
|
+static int loadLibFdkAac(AVCodecContext *avctx);
|
|
+static int loadLibFdkAac(AVCodecContext *avctx) {
|
|
+ void *libfdkaac = NULL;
|
|
+ const char *err = NULL;
|
|
+
|
|
+ libfdkaac = dlopen(FDKAAC_LIB, RTLD_LAZY);
|
|
+ if(err = dlerror()) {
|
|
+ av_log(avctx, AV_LOG_FATAL, "%s\n%s is missing, libfdk-aac support will be disabled\n", err, FDKAAC_LIB);
|
|
+ if(libfdkaac)
|
|
+ dlclose(libfdkaac);
|
|
+ return 1;
|
|
+ }
|
|
+ dl_sym(aacEncOpen, (AACENC_ERROR (*)(HANDLE_AACENCODER*, const UINT, const UINT)), libfdkaac);
|
|
+ dl_sym(aacEncoder_SetParam, (AACENC_ERROR (*)(const HANDLE_AACENCODER, const AACENC_PARAM, const UINT)), libfdkaac);
|
|
+ dl_sym(aacEncEncode, (AACENC_ERROR (*)(const HANDLE_AACENCODER, const AACENC_BufDesc*, const AACENC_BufDesc*, const AACENC_InArgs*, AACENC_OutArgs*)), libfdkaac);
|
|
+ dl_sym(aacEncInfo, (AACENC_ERROR (*)(const HANDLE_AACENCODER, AACENC_InfoStruct*)), libfdkaac);
|
|
+ dl_sym(aacEncClose, (AACENC_ERROR (*)(HANDLE_AACENCODER*)), libfdkaac);
|
|
+ return 0;
|
|
+error:
|
|
+ av_log(avctx, AV_LOG_FATAL, "libfdk-aac: Missing symbols in %s: %s\n"
|
|
+ "libfdk-aac support disabled\n", FDKAAC_LIB, err);
|
|
+ dlclose(libfdkaac);
|
|
+ return 1;
|
|
+}
|
|
+#endif
|
|
+
|
|
typedef struct AACContext {
|
|
const AVClass *class;
|
|
HANDLE_AACENCODER handle;
|
|
@@ -182,6 +224,11 @@ static av_cold int aac_encode_init(AVCod
|
|
int aot = AV_PROFILE_AAC_LOW + 1;
|
|
int sce = 0, cpe = 0;
|
|
|
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
|
+ if (loadLibFdkAac(avctx))
|
|
+ return -1;
|
|
+#endif
|
|
+
|
|
if ((err = aacEncOpen(&s->handle, 0, avctx->ch_layout.nb_channels)) != AACENC_OK) {
|
|
av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n",
|
|
aac_get_error(err));
|