Refresh OpenH264 dlopen patch
This commit is contained in:
parent
5b62d5dd33
commit
316babd019
@ -1,6 +1,6 @@
|
|||||||
From e831c68c93ed2d155178aa89b06901558298ce30 Mon Sep 17 00:00:00 2001
|
From 5f72b7ea6a214f3c32e4089486ece8f1ad3d07a7 Mon Sep 17 00:00:00 2001
|
||||||
From: Neal Gompa <ngompa@fedoraproject.org>
|
From: Neal Gompa <ngompa@fedoraproject.org>
|
||||||
Date: Fri, 18 Feb 2022 07:42:05 -0500
|
Date: Fri, 18 Feb 2022 08:12:54 -0500
|
||||||
Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264
|
Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264
|
||||||
|
|
||||||
We can't directly depend on OpenH264, but we can weakly link to it
|
We can't directly depend on OpenH264, but we can weakly link to it
|
||||||
@ -17,14 +17,14 @@ Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
|
|||||||
libavcodec/libopenh264.c | 15 +++-
|
libavcodec/libopenh264.c | 15 +++-
|
||||||
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
|
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
|
||||||
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
|
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
|
||||||
libavcodec/libopenh264dec.c | 9 ++
|
libavcodec/libopenh264dec.c | 10 +++
|
||||||
libavcodec/libopenh264enc.c | 9 ++
|
libavcodec/libopenh264enc.c | 10 +++
|
||||||
7 files changed, 241 insertions(+), 1 deletion(-)
|
7 files changed, 243 insertions(+), 1 deletion(-)
|
||||||
create mode 100644 libavcodec/libopenh264_dlopen.c
|
create mode 100644 libavcodec/libopenh264_dlopen.c
|
||||||
create mode 100644 libavcodec/libopenh264_dlopen.h
|
create mode 100644 libavcodec/libopenh264_dlopen.h
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
diff --git a/configure b/configure
|
||||||
index 6b5ef6332e..f08e566e98 100755
|
index 6b5ef6332e..0a7ccc7dc4 100755
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -250,6 +250,7 @@ External library support:
|
@@ -250,6 +250,7 @@ External library support:
|
||||||
@ -47,7 +47,7 @@ index 6b5ef6332e..f08e566e98 100755
|
|||||||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
|
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
|
||||||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
|
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
|
||||||
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
|
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 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 ||
|
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; } }
|
{ 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++"
|
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
|
||||||
@ -316,7 +316,7 @@ index 0000000000..d7d8bb7cad
|
|||||||
+
|
+
|
||||||
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
|
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
|
||||||
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
|
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
|
||||||
index 7f5e85402a..34b238519e 100644
|
index 97d3630df6..feb0a0927e 100644
|
||||||
--- a/libavcodec/libopenh264dec.c
|
--- a/libavcodec/libopenh264dec.c
|
||||||
+++ b/libavcodec/libopenh264dec.c
|
+++ b/libavcodec/libopenh264dec.c
|
||||||
@@ -19,8 +19,12 @@
|
@@ -19,8 +19,12 @@
|
||||||
@ -332,20 +332,21 @@ index 7f5e85402a..34b238519e 100644
|
|||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/fifo.h"
|
#include "libavutil/fifo.h"
|
||||||
@@ -55,6 +59,11 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
|
@@ -55,6 +59,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
|
||||||
int log_level;
|
int log_level;
|
||||||
WelsTraceCallback callback_function;
|
WelsTraceCallback callback_function;
|
||||||
|
|
||||||
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
+ if (loadLibOpenH264(avctx))
|
+ if (loadLibOpenH264(avctx)) {
|
||||||
+ return AVERROR_DECODER_NOT_FOUND;
|
+ return AVERROR_DECODER_NOT_FOUND;
|
||||||
|
+ }
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
||||||
return err;
|
return AVERROR_DECODER_NOT_FOUND;
|
||||||
|
|
||||||
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
|
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
|
||||||
index de4b85c411..644458a5bb 100644
|
index 2001dc22b4..c8b1348df2 100644
|
||||||
--- a/libavcodec/libopenh264enc.c
|
--- a/libavcodec/libopenh264enc.c
|
||||||
+++ b/libavcodec/libopenh264enc.c
|
+++ b/libavcodec/libopenh264enc.c
|
||||||
@@ -19,8 +19,12 @@
|
@@ -19,8 +19,12 @@
|
||||||
@ -361,17 +362,18 @@ index de4b85c411..644458a5bb 100644
|
|||||||
|
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
@@ -136,6 +140,11 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
@@ -136,6 +140,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
||||||
WelsTraceCallback callback_function;
|
WelsTraceCallback callback_function;
|
||||||
AVCPBProperties *props;
|
AVCPBProperties *props;
|
||||||
|
|
||||||
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
+#ifdef CONFIG_LIBOPENH264_DLOPEN
|
||||||
+ if (loadLibOpenH264(avctx))
|
+ if (loadLibOpenH264(avctx)) {
|
||||||
+ return AVERROR_ENCODER_NOT_FOUND;
|
+ return AVERROR_ENCODER_NOT_FOUND;
|
||||||
|
+ }
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
if ((err = ff_libopenh264_check_version(avctx)) < 0)
|
||||||
return err;
|
return AVERROR_ENCODER_NOT_FOUND;
|
||||||
|
|
||||||
--
|
--
|
||||||
2.34.1
|
2.34.1
|
||||||
|
Loading…
Reference in New Issue
Block a user