From abb525a1d3c6f60a37446145de74c15d66a660b7 Mon Sep 17 00:00:00 2001 From: Daniel Stankewitz Date: Wed, 23 Mar 2022 11:19:37 +0100 Subject: [PATCH] Update 0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch --- ...oading-of-shared-fdk-aac-library-5.0.patch | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/patches/0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch b/patches/0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch index f41d542..1f454ab 100644 --- a/patches/0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch +++ b/patches/0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch @@ -1,8 +1,21 @@ +From 1d2c98204a4609dfc4c41fe522fe89d0a51b37a4 Mon Sep 17 00:00:00 2001 +From: Daniel Stankewitz +Date: Wed, 16 Mar 2022 16:34:11 +0100 +Subject: [PATCH] libfdk patch + +--- + configure | 6 +-- + libavcodec/libfdk-aac_internal.h | 84 ++++++++++++++++++++++++++++++++ + libavcodec/libfdk-aacdec.c | 33 +++++++++++-- + libavcodec/libfdk-aacenc.c | 24 ++++++++- + 4 files changed, 138 insertions(+), 9 deletions(-) + create mode 100644 libavcodec/libfdk-aac_internal.h + diff --git a/configure b/configure -index 6b5ef6332e..19554a7572 100755 +index 82642deabe..63ec645b74 100755 --- a/configure +++ b/configure -@@ -1783,7 +1783,6 @@ EXTERNAL_LIBRARY_GPL_LIST=" +@@ -1784,7 +1784,6 @@ EXTERNAL_LIBRARY_GPL_LIST=" EXTERNAL_LIBRARY_NONFREE_LIST=" decklink @@ -10,7 +23,7 @@ index 6b5ef6332e..19554a7572 100755 libtls " -@@ -1880,6 +1879,7 @@ EXTERNAL_LIBRARY_LIST=" +@@ -1881,6 +1880,7 @@ EXTERNAL_LIBRARY_LIST=" openssl pocketsphinx vapoursynth @@ -18,7 +31,7 @@ index 6b5ef6332e..19554a7572 100755 " HWACCEL_AUTODETECT_LIBRARY_LIST=" -@@ -6525,9 +6525,7 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d +@@ -6518,9 +6518,7 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion @@ -31,7 +44,7 @@ index 6b5ef6332e..19554a7572 100755 enabled fontconfig && enable libfontconfig diff --git a/libavcodec/libfdk-aac_internal.h b/libavcodec/libfdk-aac_internal.h new file mode 100644 -index 0000000000..cd1e6e3340 +index 0000000000..9bcfdb9aba --- /dev/null +++ b/libavcodec/libfdk-aac_internal.h @@ -0,0 +1,84 @@ @@ -119,8 +132,9 @@ index 0000000000..cd1e6e3340 +} aacDecLib; + +#endif /* AVCODEC_LIBFDK_AAC_INTERNAL_H */ +\ No newline at end of file diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c -index ffa1fdcce3..b3ee1248ed 100644 +index d7b84015be..b9ef581250 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -24,6 +24,7 @@ @@ -140,7 +154,7 @@ index ffa1fdcce3..b3ee1248ed 100644 uint8_t *decoder_buffer; int decoder_buffer_size; uint8_t *anc_buffer; -@@ -101,7 +104,7 @@ static const AVClass fdk_aac_dec_class = { +@@ -112,7 +115,7 @@ static const AVClass fdk_aac_dec_class = { static int get_stream_info(AVCodecContext *avctx) { FDKAACDecContext *s = avctx->priv_data; @@ -149,7 +163,7 @@ index ffa1fdcce3..b3ee1248ed 100644 int channel_counts[0x24] = { 0 }; int i, ch_error = 0; uint64_t ch_layout = 0; -@@ -216,8 +219,10 @@ static av_cold int fdk_aac_decode_close(AVCodecContext *avctx) +@@ -230,8 +233,10 @@ static av_cold int fdk_aac_decode_close(AVCodecContext *avctx) { FDKAACDecContext *s = avctx->priv_data; @@ -162,11 +176,11 @@ index ffa1fdcce3..b3ee1248ed 100644 av_freep(&s->decoder_buffer); av_freep(&s->anc_buffer); -@@ -229,6 +234,27 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) +@@ -243,6 +248,28 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) FDKAACDecContext *s = avctx->priv_data; AAC_DECODER_ERROR err; -+ if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { ++ if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { + av_log(avctx, AV_LOG_ERROR, "Unable to load " LIBNAME "\n"); + return -1; + } @@ -186,12 +200,13 @@ index ffa1fdcce3..b3ee1248ed 100644 +#define aacDecoder_SetParam s->pfn.aacDecoder_SetParam + DLSYM(aacDecoder_AncDataInit); +#define aacDecoder_AncDataInit s->pfn.aacDecoder_AncDataInit ++ + 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"); diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c -index 7ee2f13ac7..2a91d02c7f 100644 +index 936049f12b..36f73af933 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -26,6 +26,7 @@ @@ -228,7 +243,7 @@ index 7ee2f13ac7..2a91d02c7f 100644 int aot = FF_PROFILE_AAC_LOW + 1; int sce = 0, cpe = 0; -+ if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { ++ if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { + av_log(avctx, AV_LOG_ERROR, "Unable to load " LIBNAME "\n"); + return -1; + } @@ -243,6 +258,8 @@ index 7ee2f13ac7..2a91d02c7f 100644 + DLSYM(aacEncoder_SetParam); +#define aacEncoder_SetParam s->pfn.aacEncoder_SetParam + - if ((err = aacEncOpen(&s->handle, 0, avctx->channels)) != AACENC_OK) { + 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)); +-- +2.29.2