ffmpeg: update to 7.0.1
This commit is contained in:
parent
230eebe0b6
commit
c76a4a0d8c
@ -1,4 +1,4 @@
|
|||||||
From be059eaeefdc49e93066a8b618d5635e9a2c696a Mon Sep 17 00:00:00 2001
|
From 35bc2299c7eebb302b5db359fed1f01bc1beea73 Mon Sep 17 00:00:00 2001
|
||||||
From: Jing Sun <jing.a.sun@intel.com>
|
From: Jing Sun <jing.a.sun@intel.com>
|
||||||
Date: Wed, 21 Nov 2018 11:33:04 +0800
|
Date: Wed, 21 Nov 2018 11:33:04 +0800
|
||||||
Subject: [PATCH] lavc/svt_hevc: add libsvt hevc encoder wrapper
|
Subject: [PATCH] lavc/svt_hevc: add libsvt hevc encoder wrapper
|
||||||
@ -14,15 +14,15 @@ Signed-off-by: Guo Jiansheng <jiansheng.guo@intel.com>
|
|||||||
configure | 4 +
|
configure | 4 +
|
||||||
libavcodec/Makefile | 1 +
|
libavcodec/Makefile | 1 +
|
||||||
libavcodec/allcodecs.c | 1 +
|
libavcodec/allcodecs.c | 1 +
|
||||||
libavcodec/libsvt_hevc.c | 585 +++++++++++++++++++++++++++++++++++++++
|
libavcodec/libsvt_hevc.c | 586 +++++++++++++++++++++++++++++++++++++++
|
||||||
4 files changed, 591 insertions(+)
|
4 files changed, 592 insertions(+)
|
||||||
create mode 100644 libavcodec/libsvt_hevc.c
|
create mode 100644 libavcodec/libsvt_hevc.c
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
diff --git a/configure b/configure
|
||||||
index c8ae0a061d..9cc741d2a7 100755
|
index 2d46ef0b9c..cc6d5891ec 100755
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -330,6 +330,7 @@ External library support:
|
@@ -333,6 +333,7 @@ External library support:
|
||||||
--enable-vapoursynth enable VapourSynth demuxer [no]
|
--enable-vapoursynth enable VapourSynth demuxer [no]
|
||||||
--disable-xlib disable xlib [autodetect]
|
--disable-xlib disable xlib [autodetect]
|
||||||
--disable-zlib disable zlib [autodetect]
|
--disable-zlib disable zlib [autodetect]
|
||||||
@ -30,7 +30,7 @@ index c8ae0a061d..9cc741d2a7 100755
|
|||||||
|
|
||||||
The following libraries provide various hardware acceleration features:
|
The following libraries provide various hardware acceleration features:
|
||||||
--disable-amf disable AMF video encoding code [autodetect]
|
--disable-amf disable AMF video encoding code [autodetect]
|
||||||
@@ -1898,6 +1899,7 @@ EXTERNAL_LIBRARY_LIST="
|
@@ -1953,6 +1954,7 @@ EXTERNAL_LIBRARY_LIST="
|
||||||
libsrt
|
libsrt
|
||||||
libssh
|
libssh
|
||||||
libsvtav1
|
libsvtav1
|
||||||
@ -38,7 +38,7 @@ index c8ae0a061d..9cc741d2a7 100755
|
|||||||
libtensorflow
|
libtensorflow
|
||||||
libtesseract
|
libtesseract
|
||||||
libtheora
|
libtheora
|
||||||
@@ -3495,6 +3497,7 @@ vapoursynth_demuxer_deps="vapoursynth"
|
@@ -3552,6 +3554,7 @@ vapoursynth_demuxer_deps="vapoursynth"
|
||||||
videotoolbox_suggest="coreservices"
|
videotoolbox_suggest="coreservices"
|
||||||
videotoolbox_deps="corefoundation coremedia corevideo"
|
videotoolbox_deps="corefoundation coremedia corevideo"
|
||||||
videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
|
videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
|
||||||
@ -46,7 +46,7 @@ index c8ae0a061d..9cc741d2a7 100755
|
|||||||
|
|
||||||
# demuxers / muxers
|
# demuxers / muxers
|
||||||
ac3_demuxer_select="ac3_parser"
|
ac3_demuxer_select="ac3_parser"
|
||||||
@@ -6868,6 +6871,7 @@ enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/
|
@@ -6951,6 +6954,7 @@ enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/
|
||||||
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
|
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
|
||||||
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
|
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
|
||||||
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
||||||
@ -55,22 +55,22 @@ index c8ae0a061d..9cc741d2a7 100755
|
|||||||
enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
|
enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
|
||||||
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
|
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
|
||||||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
|
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
|
||||||
index bb42095165..08ebc58d7d 100644
|
index eef936944d..76c42fe35e 100644
|
||||||
--- a/libavcodec/Makefile
|
--- a/libavcodec/Makefile
|
||||||
+++ b/libavcodec/Makefile
|
+++ b/libavcodec/Makefile
|
||||||
@@ -1143,6 +1143,7 @@
|
@@ -1154,6 +1154,7 @@ OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER) += libwebpenc_common.o libwebpenc_anim
|
||||||
OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o
|
OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o
|
||||||
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
|
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
|
||||||
OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o
|
OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o
|
||||||
+OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER) += libsvt_hevc.o
|
+OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER) += libsvt_hevc.o
|
||||||
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
|
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
|
||||||
OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o
|
OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o
|
||||||
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
|
OBJS-$(CONFIG_LIBXEVD_DECODER) += libxevd.o
|
||||||
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
|
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
|
||||||
index 93ce8e3224..b709c7d551 100644
|
index 2386b450a6..5dad6ff74e 100644
|
||||||
--- a/libavcodec/allcodecs.c
|
--- a/libavcodec/allcodecs.c
|
||||||
+++ b/libavcodec/allcodecs.c
|
+++ b/libavcodec/allcodecs.c
|
||||||
@@ -829,6 +829,7 @@ extern const FFCodec ff_libxavs_encoder;
|
@@ -820,6 +820,7 @@ extern const FFCodec ff_libxavs_encoder;
|
||||||
extern const FFCodec ff_libxavs2_encoder;
|
extern const FFCodec ff_libxavs2_encoder;
|
||||||
extern const FFCodec ff_libxvid_encoder;
|
extern const FFCodec ff_libxvid_encoder;
|
||||||
extern const FFCodec ff_libzvbi_teletext_decoder;
|
extern const FFCodec ff_libzvbi_teletext_decoder;
|
||||||
@ -80,10 +80,10 @@ index 93ce8e3224..b709c7d551 100644
|
|||||||
extern const FFCodec ff_bintext_decoder;
|
extern const FFCodec ff_bintext_decoder;
|
||||||
diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c
|
diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..80b53a2157
|
index 0000000000..cb7bc93472
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/libavcodec/libsvt_hevc.c
|
+++ b/libavcodec/libsvt_hevc.c
|
||||||
@@ -0,0 +1,585 @@
|
@@ -0,0 +1,586 @@
|
||||||
+/*
|
+/*
|
||||||
+* Scalable Video Technology for HEVC encoder library plugin
|
+* Scalable Video Technology for HEVC encoder library plugin
|
||||||
+*
|
+*
|
||||||
@ -110,6 +110,7 @@ index 0000000000..80b53a2157
|
|||||||
+
|
+
|
||||||
+#include "libavutil/common.h"
|
+#include "libavutil/common.h"
|
||||||
+#include "libavutil/frame.h"
|
+#include "libavutil/frame.h"
|
||||||
|
+#include "libavutil/mem.h"
|
||||||
+#include "libavutil/opt.h"
|
+#include "libavutil/opt.h"
|
||||||
+
|
+
|
||||||
+#include "codec_internal.h"
|
+#include "codec_internal.h"
|
||||||
@ -670,5 +671,5 @@ index 0000000000..80b53a2157
|
|||||||
+ .p.wrapper_name = "libsvt_hevc",
|
+ .p.wrapper_name = "libsvt_hevc",
|
||||||
+};
|
+};
|
||||||
--
|
--
|
||||||
2.43.0
|
2.44.0
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
--- a/libavformat/avformat.h
|
diff -Naur a/libavformat/avformat.h b/libavformat/avformat.h
|
||||||
+++ b/libavformat/avformat.h
|
--- a/libavformat/avformat.h 2024-04-05 05:23:00.000000000 +0600
|
||||||
@@ -1020,6 +1020,10 @@ attribute_deprecated
|
+++ b/libavformat/avformat.h 2024-07-17 17:51:20.156314168 +0600
|
||||||
int64_t av_stream_get_end_pts(const AVStream *st);
|
@@ -1170,6 +1170,10 @@
|
||||||
#endif
|
|
||||||
|
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
|
||||||
|
|
||||||
+// 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);
|
||||||
@ -11,19 +12,20 @@
|
|||||||
#define AV_PROGRAM_RUNNING 1
|
#define AV_PROGRAM_RUNNING 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
--- a/libavformat/utils.c
|
diff -Naur a/libavformat/mux_utils.c b/libavformat/mux_utils.c
|
||||||
+++ b/libavformat/utils.c
|
--- a/libavformat/mux_utils.c 2024-04-05 05:23:00.000000000 +0600
|
||||||
@@ -56,6 +56,13 @@ int ff_unlock_avformat(void)
|
+++ b/libavformat/mux_utils.c 2024-07-17 17:52:26.337981552 +0600
|
||||||
return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
|
@@ -30,6 +30,13 @@
|
||||||
}
|
#include "internal.h"
|
||||||
|
#include "mux.h"
|
||||||
|
|
||||||
+// 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 ffstream(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 */
|
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
|
||||||
#define SANE_CHUNK_SIZE (50000000)
|
int std_compliance)
|
||||||
|
{
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
From: Andreas Schneider <asn@cryptomilk.org>
|
diff -Naur a/configure b/configure
|
||||||
|
--- a/configure 2024-04-05 05:22:59.000000000 +0600
|
||||||
fdk-aac-free-devel is GPL compatible
|
+++ b/configure 2024-07-17 17:59:24.141881751 +0600
|
||||||
|
@@ -1872,7 +1872,6 @@
|
||||||
See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112
|
|
||||||
|
|
||||||
Index: ffmpeg-5.0/configure
|
|
||||||
===================================================================
|
|
||||||
--- ffmpeg-5.0.orig/configure 2022-02-09 20:07:49.490888877 +0100
|
|
||||||
+++ ffmpeg-5.0/configure 2022-02-09 20:08:30.102854308 +0100
|
|
||||||
@@ -1783,7 +1783,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
|
||||||
|
|
||||||
EXTERNAL_LIBRARY_NONFREE_LIST="
|
EXTERNAL_LIBRARY_NONFREE_LIST="
|
||||||
decklink
|
decklink
|
||||||
@ -16,10 +9,10 @@ Index: ffmpeg-5.0/configure
|
|||||||
libtls
|
libtls
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -1822,6 +1821,7 @@ EXTERNAL_LIBRARY_LIST="
|
@@ -1912,6 +1911,7 @@
|
||||||
|
libcodec2
|
||||||
libdav1d
|
libdav1d
|
||||||
libdc1394
|
libdc1394
|
||||||
libdrm
|
|
||||||
+ libfdk_aac
|
+ libfdk_aac
|
||||||
libflite
|
libflite
|
||||||
libfontconfig
|
libfontconfig
|
||||||
|
@ -11,11 +11,11 @@ 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-6.0/libavformat/matroskaenc.c
|
Index: ffmpeg-6.1.1/libavformat/matroskaenc.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- ffmpeg-6.0.orig/libavformat/matroskaenc.c
|
--- ffmpeg-6.1.1.orig/libavformat/matroskaenc.c
|
||||||
+++ ffmpeg-6.0/libavformat/matroskaenc.c
|
+++ ffmpeg-6.1.1/libavformat/matroskaenc.c
|
||||||
@@ -3321,16 +3321,25 @@ static int mkv_query_codec(enum AVCodecI
|
@@ -3538,16 +3538,25 @@ static int mkv_query_codec(enum AVCodecI
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ Index: ffmpeg-6.0/libavformat/matroskaenc.c
|
|||||||
.init = mkv_init,
|
.init = mkv_init,
|
||||||
.deinit = mkv_deinit,
|
.deinit = mkv_deinit,
|
||||||
.write_header = mkv_write_header,
|
.write_header = mkv_write_header,
|
||||||
@@ -3388,8 +3397,7 @@ const FFOutputFormat ff_matroska_audio_m
|
@@ -3615,8 +3624,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),
|
||||||
|
@ -1,363 +1,195 @@
|
|||||||
From 3daa49cae0bfc3de434dd28c3a23ae877f0639db Mon Sep 17 00:00:00 2001
|
From: Ismail Dönmez <ismail@i10z.com>
|
||||||
From: Neal Gompa <ngompa@fedoraproject.org>
|
Date: 2019-06-11 11:21:23
|
||||||
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
|
This is ffmpeg-4.1-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
|
||||||
and gracefully expose the capability.
|
from OpenMandriva to optionally enable runtime enabling of
|
||||||
|
fdkaac/lame/x264/x265.
|
||||||
|
|
||||||
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 +
|
configure | 3 ++
|
||||||
libavcodec/Makefile | 1 +
|
libavcodec/dlopen.h | 12 ++++++++++
|
||||||
libavcodec/libopenh264.c | 5 ++
|
libavcodec/libfdk-aacdec.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
|
||||||
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
|
libavcodec/libfdk-aacenc.c | 47 +++++++++++++++++++++++++++++++++++++++
|
||||||
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
|
4 files changed, 115 insertions(+)
|
||||||
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: ffmpeg-7.0/configure
|
||||||
index 1f0b9497cb..97fa4a5d6a 100755
|
===================================================================
|
||||||
--- a/configure
|
--- ffmpeg-7.0.orig/configure
|
||||||
+++ b/configure
|
+++ ffmpeg-7.0/configure
|
||||||
@@ -249,6 +249,7 @@ External library support:
|
@@ -230,6 +230,7 @@ External library support:
|
||||||
--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
|
--enable-libdvdnav enable libdvdnav, needed for DVD demuxing [no]
|
||||||
--enable-libopencv enable video filtering via libopencv [no]
|
--enable-libdvdread enable libdvdread, needed for DVD demuxing [no]
|
||||||
--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
|
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
|
||||||
+ --enable-libopenh264-dlopen enable H.264 encoding via dlopen()'ed OpenH264 [no]
|
+ --enable-libfdk-aac-dlopen enable AAC de/encoding via dlopen()'ed libfdk-aac [no]
|
||||||
--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
|
--enable-libflite enable flite (voice synthesis) support via libflite [no]
|
||||||
--enable-libopenmpt enable decoding tracked files via libopenmpt [no]
|
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
|
||||||
--enable-libopenvino enable OpenVINO as a DNN module backend
|
--enable-libfreetype enable libfreetype, needed for drawtext filter [no]
|
||||||
@@ -1871,6 +1872,7 @@ EXTERNAL_LIBRARY_LIST="
|
@@ -1873,6 +1874,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
||||||
libmysofa
|
EXTERNAL_LIBRARY_NONFREE_LIST="
|
||||||
libopencv
|
decklink
|
||||||
libopenh264
|
libfdk_aac
|
||||||
+ libopenh264_dlopen
|
+ libfdk_aac_dlopen
|
||||||
libopenjpeg
|
libtls
|
||||||
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>
|
@@ -6847,6 +6849,7 @@ enabled libdvdread && require_pkg
|
||||||
+
|
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
|
||||||
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
|
||||||
+#include "libopenh264_dlopen.h"
|
warn "using libfdk without pkg-config"; } }
|
||||||
+#else
|
+enabled libfdk_aac_dlopen && enable libfdk_aac && add_cppflags "-I/usr/include/fdk-aac"
|
||||||
#include <wels/codec_api.h>
|
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"
|
||||||
#include <wels/codec_ver.h>
|
enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
|
||||||
+#endif
|
enabled fontconfig && enable libfontconfig
|
||||||
|
Index: ffmpeg-7.0/libavcodec/dlopen.h
|
||||||
#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
|
--- /dev/null
|
||||||
+++ b/libavcodec/libopenh264_dlopen.c
|
+++ ffmpeg-7.0/libavcodec/dlopen.h
|
||||||
@@ -0,0 +1,147 @@
|
@@ -0,0 +1,12 @@
|
||||||
+/*
|
+#ifndef LOCALINC_DLOPEN_H
|
||||||
+ * OpenH264 dlopen code
|
+#define LOCALINC_DLOPEN_H
|
||||||
+ *
|
|
||||||
+ * 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 <dlfcn.h>
|
||||||
|
+#define num2str(x) str(x)
|
||||||
|
+#define str(x) #x
|
||||||
+
|
+
|
||||||
+#include "libopenh264_dlopen.h"
|
+#define dl_sym(func, args, lib) \
|
||||||
|
+ dl_##func = args dlsym(lib, #func); \
|
||||||
|
+ if ((err = dlerror())) \
|
||||||
|
+ goto error;
|
||||||
+
|
+
|
||||||
+/*
|
+#endif
|
||||||
+ * The symbol binding makes sure we do not run into strict aliasing issues which
|
Index: ffmpeg-7.0/libavcodec/libfdk-aacdec.c
|
||||||
+ * can lead into segfaults.
|
===================================================================
|
||||||
+ */
|
--- ffmpeg-7.0.orig/libavcodec/libfdk-aacdec.c
|
||||||
+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **);
|
+++ ffmpeg-7.0/libavcodec/libfdk-aacdec.c
|
||||||
+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *);
|
@@ -38,6 +38,54 @@
|
||||||
+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *);
|
#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
|
||||||
+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **);
|
#endif
|
||||||
+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *);
|
|
||||||
+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void);
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
||||||
+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *);
|
+#include "dlopen.h"
|
||||||
+
|
+AAC_DECODER_ERROR (*dl_aacDecoder_AncDataInit)(HANDLE_AACDECODER, UCHAR*, int);
|
||||||
+#define OH264_SYMBOL_ENTRY(i) \
|
+HANDLE_AACDECODER (*dl_aacDecoder_Open)(TRANSPORT_TYPE, UINT);
|
||||||
+ union { \
|
+AAC_DECODER_ERROR (*dl_aacDecoder_Fill)(HANDLE_AACDECODER, UCHAR**, const UINT*, UINT*);
|
||||||
+ __oh264_##i f; \
|
+AAC_DECODER_ERROR (*dl_aacDecoder_ConfigRaw)(HANDLE_AACDECODER, UCHAR **, const UINT*);
|
||||||
+ void *obj; \
|
+AAC_DECODER_ERROR (*dl_aacDecoder_SetParam)(const HANDLE_AACDECODER, const AACDEC_PARAM, const INT);
|
||||||
+ } _oh264_##i
|
+AAC_DECODER_ERROR (*dl_aacDecoder_DecodeFrame)(HANDLE_AACDECODER, INT_PCM*, const INT, const UINT);
|
||||||
+
|
+CStreamInfo* (*dl_aacDecoder_GetStreamInfo)(HANDLE_AACDECODER);
|
||||||
+struct oh264_symbols {
|
+void (*dl_aacDecoder_Close)(HANDLE_AACDECODER);
|
||||||
+ OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder);
|
+#define aacDecoder_AncDataInit dl_aacDecoder_AncDataInit
|
||||||
+ OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder);
|
+#define aacDecoder_Open dl_aacDecoder_Open
|
||||||
+ OH264_SYMBOL_ENTRY(WelsGetDecoderCapability);
|
+#define aacDecoder_Fill dl_aacDecoder_Fill
|
||||||
+ OH264_SYMBOL_ENTRY(WelsCreateDecoder);
|
+#define aacDecoder_ConfigRaw dl_aacDecoder_ConfigRaw
|
||||||
+ OH264_SYMBOL_ENTRY(WelsDestroyDecoder);
|
+#define aacDecoder_SetParam dl_aacDecoder_SetParam
|
||||||
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersion);
|
+#define aacDecoder_DecodeFrame dl_aacDecoder_DecodeFrame
|
||||||
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx);
|
+#define aacDecoder_GetStreamInfo dl_aacDecoder_GetStreamInfo
|
||||||
+};
|
+#define aacDecoder_Close dl_aacDecoder_Close
|
||||||
+
|
+#define FDKAAC_LIB "libfdk-aac.so.2"
|
||||||
+/* Symbols are bound by loadLibOpenH264() */
|
+static int loadLibFdkAac(AVCodecContext *avctx);
|
||||||
+static struct oh264_symbols openh264_symbols;
|
+static int loadLibFdkAac(AVCodecContext *avctx) {
|
||||||
+
|
+ void *libfdkaac = NULL;
|
||||||
+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;
|
+ const char *err = NULL;
|
||||||
+
|
+
|
||||||
+ if (initialized) {
|
+ libfdkaac = dlopen(FDKAAC_LIB, RTLD_LAZY);
|
||||||
+ return 0;
|
+ 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)
|
||||||
+#define OPENH264_LIB "libopenh264.so.7"
|
+ dlclose(libfdkaac);
|
||||||
+ 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;
|
+ return 1;
|
||||||
+ }
|
+ }
|
||||||
+
|
+ dl_sym(aacDecoder_AncDataInit, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR*, int)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateSVCEncoder);
|
+ dl_sym(aacDecoder_Open, (HANDLE_AACDECODER (*)(TRANSPORT_TYPE, UINT)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroySVCEncoder);
|
+ dl_sym(aacDecoder_Fill, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR**, const UINT*, UINT*)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsGetDecoderCapability);
|
+ dl_sym(aacDecoder_ConfigRaw, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, UCHAR**, const UINT*)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateDecoder);
|
+ dl_sym(aacDecoder_SetParam, (AAC_DECODER_ERROR (*)(const HANDLE_AACDECODER, const AACDEC_PARAM, const INT)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroyDecoder);
|
+ dl_sym(aacDecoder_DecodeFrame, (AAC_DECODER_ERROR (*)(HANDLE_AACDECODER, INT_PCM*, const INT, const UINT)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersion);
|
+ dl_sym(aacDecoder_GetStreamInfo, (CStreamInfo* (*)(HANDLE_AACDECODER)), libfdkaac);
|
||||||
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersionEx);
|
+ dl_sym(aacDecoder_Close, (void (*)(HANDLE_AACDECODER)), libfdkaac);
|
||||||
+
|
|
||||||
+ initialized = true;
|
|
||||||
+
|
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+error:
|
||||||
diff --git a/libavcodec/libopenh264_dlopen.h b/libavcodec/libopenh264_dlopen.h
|
+ av_log(avctx, AV_LOG_FATAL, "libfdk-aac: Missing symbols in %s: %s\n"
|
||||||
new file mode 100644
|
+ "libfdk-aac support disabled\n", FDKAAC_LIB, err);
|
||||||
index 0000000000..d7d8bb7cad
|
+ dlclose(libfdkaac);
|
||||||
--- /dev/null
|
+ return 1;
|
||||||
+++ 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
|
+#endif
|
||||||
+
|
+
|
||||||
if (WelsCreateDecoder(&s->decoder)) {
|
enum ConcealMethod {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
|
CONCEAL_METHOD_SPECTRAL_MUTING = 0,
|
||||||
return AVERROR_UNKNOWN;
|
CONCEAL_METHOD_NOISE_SUBSTITUTION = 1,
|
||||||
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
|
@@ -244,6 +292,11 @@ static av_cold int fdk_aac_decode_init(A
|
||||||
index 6f231d22b2..3f0e990d80 100644
|
FDKAACDecContext *s = avctx->priv_data;
|
||||||
--- a/libavcodec/libopenh264enc.c
|
AAC_DECODER_ERROR err;
|
||||||
+++ b/libavcodec/libopenh264enc.c
|
|
||||||
@@ -19,8 +19,12 @@
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
||||||
+#include "libopenh264_dlopen.h"
|
+ if (loadLibFdkAac(avctx))
|
||||||
+#else
|
+ return -1;
|
||||||
#include <wels/codec_api.h>
|
|
||||||
#include <wels/codec_ver.h>
|
|
||||||
+#endif
|
+#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-7.0/libavcodec/libfdk-aacenc.c
|
||||||
|
===================================================================
|
||||||
|
--- ffmpeg-7.0.orig/libavcodec/libfdk-aacenc.c
|
||||||
|
+++ ffmpeg-7.0/libavcodec/libfdk-aacenc.c
|
||||||
|
@@ -37,6 +37,48 @@
|
||||||
|
#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
|
||||||
#include "libavutil/common.h"
|
+#include "dlopen.h"
|
||||||
@@ -114,6 +118,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
+#include <fdk-aac/aacdecoder_lib.h>
|
||||||
WelsTraceCallback callback_function;
|
+AACENC_ERROR (*dl_aacEncOpen)(HANDLE_AACENCODER*, const UINT, const UINT);
|
||||||
AVCPBProperties *props;
|
+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*);
|
||||||
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
+AACENC_ERROR (*dl_aacEncInfo)(const HANDLE_AACENCODER, AACENC_InfoStruct*);
|
||||||
+ if (loadLibOpenH264(avctx)) {
|
+AACENC_ERROR (*dl_aacEncClose)(HANDLE_AACENCODER*);
|
||||||
+ return AVERROR_ENCODER_NOT_FOUND;
|
+
|
||||||
|
+#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
|
+#endif
|
||||||
+
|
+
|
||||||
if (WelsCreateSVCEncoder(&s->encoder)) {
|
typedef struct AACContext {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
|
const AVClass *class;
|
||||||
return AVERROR_UNKNOWN;
|
HANDLE_AACENCODER handle;
|
||||||
--
|
@@ -182,6 +224,11 @@ static av_cold int aac_encode_init(AVCod
|
||||||
2.43.0
|
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));
|
||||||
|
@ -124,8 +124,8 @@ ExclusiveArch: armv7hnl
|
|||||||
|
|
||||||
Summary: Digital VCR and streaming server
|
Summary: Digital VCR and streaming server
|
||||||
Name: ffmpeg%{?flavor}
|
Name: ffmpeg%{?flavor}
|
||||||
Version: 6.1.1
|
Version: 7.0.1
|
||||||
Release: 2%{?date:.%{?date}%{?date:git}%{?rel}}%{?dist}
|
Release: 1%{?date:.%{?date}%{?date:git}%{?rel}}%{?dist}
|
||||||
License: %{ffmpeg_license}
|
License: %{ffmpeg_license}
|
||||||
URL: https://ffmpeg.org/
|
URL: https://ffmpeg.org/
|
||||||
%if 0%{?date}
|
%if 0%{?date}
|
||||||
@ -147,9 +147,7 @@ Patch3: 030-ffmpeg-add-svt-vp9.patch
|
|||||||
Patch4: 040-ffmpeg-add-av_stream_get_first_dts-for-chromium.patch
|
Patch4: 040-ffmpeg-add-av_stream_get_first_dts-for-chromium.patch
|
||||||
|
|
||||||
# Fedora patches
|
# Fedora patches
|
||||||
Patch5: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch
|
|
||||||
Patch6: ffmpeg-allow-fdk-aac-free.patch
|
Patch6: ffmpeg-allow-fdk-aac-free.patch
|
||||||
Patch7: ffmpeg-c99.patch
|
|
||||||
Patch8: ffmpeg-codec-choice.patch
|
Patch8: ffmpeg-codec-choice.patch
|
||||||
%{!?_with_openh264:Patch9: ffmpeg-dlopen-openh264.patch}
|
%{!?_with_openh264:Patch9: ffmpeg-dlopen-openh264.patch}
|
||||||
|
|
||||||
@ -185,7 +183,6 @@ BuildRequires: lame-devel >= 3.98.3
|
|||||||
%{?_with_caca:BuildRequires: libcaca-devel}
|
%{?_with_caca:BuildRequires: libcaca-devel}
|
||||||
%{!?_without_cdio:BuildRequires: libcdio-paranoia-devel}
|
%{!?_without_cdio:BuildRequires: libcdio-paranoia-devel}
|
||||||
%{?_with_chromaprint:BuildRequires: libchromaprint-devel}
|
%{?_with_chromaprint:BuildRequires: libchromaprint-devel}
|
||||||
%{?_with_crystalhd:BuildRequires: libcrystalhd-devel}
|
|
||||||
%{!?_without_lensfun:BuildRequires: lensfun-devel}
|
%{!?_without_lensfun:BuildRequires: lensfun-devel}
|
||||||
%if 0%{?_with_ieee1394}
|
%if 0%{?_with_ieee1394}
|
||||||
BuildRequires: libavc1394-devel
|
BuildRequires: libavc1394-devel
|
||||||
@ -253,7 +250,7 @@ BuildRequires: texinfo
|
|||||||
%{?_with_vpl:BuildRequires: pkgconfig(vpl) >= 2.6}
|
%{?_with_vpl:BuildRequires: pkgconfig(vpl) >= 2.6}
|
||||||
%{?_with_wavpack:BuildRequires: wavpack-devel}
|
%{?_with_wavpack:BuildRequires: wavpack-devel}
|
||||||
%{!?_without_vidstab:BuildRequires: vid.stab-devel}
|
%{!?_without_vidstab:BuildRequires: vid.stab-devel}
|
||||||
%{!?_without_vulkan:BuildRequires: vulkan-loader-devel >= 1.3.255, pkgconfig(shaderc)}
|
%{!?_without_vulkan:BuildRequires: vulkan-headers, vulkan-loader-devel >= 1.3.277, pkgconfig(shaderc)}
|
||||||
%{!?_without_x264:BuildRequires: x264-devel >= 0.0.0-0.31}
|
%{!?_without_x264:BuildRequires: x264-devel >= 0.0.0-0.31}
|
||||||
%{!?_without_x265:BuildRequires: x265-devel}
|
%{!?_without_x265:BuildRequires: x265-devel}
|
||||||
%{!?_without_xvid:BuildRequires: xvidcore-devel}
|
%{!?_without_xvid:BuildRequires: xvidcore-devel}
|
||||||
@ -277,6 +274,7 @@ Conflicts: libavutil-free
|
|||||||
Conflicts: libpostproc-free
|
Conflicts: libpostproc-free
|
||||||
Conflicts: libswresample-free
|
Conflicts: libswresample-free
|
||||||
Conflicts: libswscale-free
|
Conflicts: libswscale-free
|
||||||
|
%{!?_without_vulkan:Requires: vulkan-headers >= 1.3.277}
|
||||||
%{?_with_vmaf:Recommends: vmaf-models}
|
%{?_with_vmaf:Recommends: vmaf-models}
|
||||||
%{!?_with_openh264:Recommends: openh264}
|
%{!?_with_openh264:Recommends: openh264}
|
||||||
|
|
||||||
@ -342,7 +340,6 @@ Freeworld libavcodec to complement the distro counterparts
|
|||||||
%{!?_without_amr:--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3} \\\
|
%{!?_without_amr:--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3} \\\
|
||||||
--enable-bzlib \\\
|
--enable-bzlib \\\
|
||||||
%{?_with_chromaprint:--enable-chromaprint} \\\
|
%{?_with_chromaprint:--enable-chromaprint} \\\
|
||||||
%{!?_with_crystalhd:--disable-crystalhd} \\\
|
|
||||||
--enable-fontconfig \\\
|
--enable-fontconfig \\\
|
||||||
%{!?_without_frei0r:--enable-frei0r} \\\
|
%{!?_without_frei0r:--enable-frei0r} \\\
|
||||||
--enable-gcrypt \\\
|
--enable-gcrypt \\\
|
||||||
@ -566,6 +563,9 @@ strip %{buildroot}%{_libdir}/%{name}/libavcodec.so.*
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 20 2024 Raven <raven@sysadmins.ws> - 7.0.1-1
|
||||||
|
- Update to 7.0.1 release
|
||||||
|
|
||||||
* Wed Mar 6 2024 Raven <raven@sysadmins.ws> - 6.1.1-2
|
* Wed Mar 6 2024 Raven <raven@sysadmins.ws> - 6.1.1-2
|
||||||
- fix for chromium
|
- fix for chromium
|
||||||
- add openh264 support
|
- add openh264 support
|
||||||
|
Loading…
x
Reference in New Issue
Block a user