diff mbox series

[FFmpeg-devel] avcodec, avformat/ffjni: fix duplicate JNI symbols

Message ID 20240324051741.79725-1-leo.izen@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec, avformat/ffjni: fix duplicate JNI symbols | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Leo Izen March 24, 2024, 5:17 a.m. UTC
Use SHLIBOBJS and STLIBOBJS in the Makefiles for avcodec and avformat,
and add a stub ffjni.c to libavformat, which allows the symbols to be
duplicated for shared builds but not static builds.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 libavcodec/Makefile  |  1 +
 libavformat/Makefile |  1 +
 libavformat/ffjni.c  | 23 +++++++++++++++++++++++
 libavformat/file.c   |  2 +-
 4 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/ffjni.c

Comments

Matthieu Bouron March 24, 2024, 1:19 p.m. UTC | #1
On Sun, Mar 24, 2024 at 01:17:41AM -0400, Leo Izen wrote:
> Use SHLIBOBJS and STLIBOBJS in the Makefiles for avcodec and avformat,
> and add a stub ffjni.c to libavformat, which allows the symbols to be
> duplicated for shared builds but not static builds.
> 
> Signed-off-by: Leo Izen <leo.izen@gmail.com>
> ---
>  libavcodec/Makefile  |  1 +
>  libavformat/Makefile |  1 +
>  libavformat/ffjni.c  | 23 +++++++++++++++++++++++
>  libavformat/file.c   |  2 +-
>  4 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/ffjni.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 7ef2e03ca6..2446db51fd 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1068,6 +1068,7 @@ STLIBOBJS-$(CONFIG_ISO_MEDIA)          += mpegaudiotabs.o
>  STLIBOBJS-$(CONFIG_FLV_MUXER)          += mpeg4audio_sample_rates.o
>  STLIBOBJS-$(CONFIG_HLS_DEMUXER)        += ac3_channel_layout_tab.o
>  STLIBOBJS-$(CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER) += jpegxl_parse.o
> +STLIBOBJS-$(CONFIG_JNI)                += ffjni.o
>  STLIBOBJS-$(CONFIG_JPEGXL_ANIM_DEMUXER)       += jpegxl_parse.o
>  STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER)   += mpeg4audio_sample_rates.o
>  STLIBOBJS-$(CONFIG_MOV_DEMUXER)        += ac3_channel_layout_tab.o
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 44aa485029..a89df7e9a3 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -728,6 +728,7 @@ SHLIBOBJS-$(CONFIG_ISO_MEDIA)            += mpegaudiotabs.o
>  SHLIBOBJS-$(CONFIG_FLV_MUXER)            += mpeg4audio_sample_rates.o
>  SHLIBOBJS-$(CONFIG_HLS_DEMUXER)          += ac3_channel_layout_tab.o
>  SHLIBOBJS-$(CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER)    += jpegxl_parse.o
> +SHLIBOBJS-$(CONFIG_JNI)                  += ffjni.o
>  SHLIBOBJS-$(CONFIG_JPEGXL_ANIM_DEMUXER)  += jpegxl_parse.o
>  SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER)     += mpeg4audio_sample_rates.o
>  SHLIBOBJS-$(CONFIG_MOV_DEMUXER)          += ac3_channel_layout_tab.o
> diff --git a/libavformat/ffjni.c b/libavformat/ffjni.c
> new file mode 100644
> index 0000000000..2b1483cf42
> --- /dev/null
> +++ b/libavformat/ffjni.c
> @@ -0,0 +1,23 @@
> +/*
> + * JNI utility functions - included stub
> + *
> + * Copyright (c) 2024 Leo Izen <leo.izen@gmail.com>
> + *
> + * 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 "libavcodec/ffjni.c"
> diff --git a/libavformat/file.c b/libavformat/file.c
> index dd5819c06f..fa13ae9a6c 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -43,7 +43,7 @@
>  #if CONFIG_ANDROID_CONTENT_PROTOCOL
>  #include <jni.h>
>  #include "libavcodec/jni.h"
> -#include "libavcodec/ffjni.c"
> +#include "libavcodec/ffjni.h"
>  #endif
>  
>  
> -- 
> 2.44.0

LGTM. Sorry for the regression.
diff mbox series

Patch

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7ef2e03ca6..2446db51fd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1068,6 +1068,7 @@  STLIBOBJS-$(CONFIG_ISO_MEDIA)          += mpegaudiotabs.o
 STLIBOBJS-$(CONFIG_FLV_MUXER)          += mpeg4audio_sample_rates.o
 STLIBOBJS-$(CONFIG_HLS_DEMUXER)        += ac3_channel_layout_tab.o
 STLIBOBJS-$(CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER) += jpegxl_parse.o
+STLIBOBJS-$(CONFIG_JNI)                += ffjni.o
 STLIBOBJS-$(CONFIG_JPEGXL_ANIM_DEMUXER)       += jpegxl_parse.o
 STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER)   += mpeg4audio_sample_rates.o
 STLIBOBJS-$(CONFIG_MOV_DEMUXER)        += ac3_channel_layout_tab.o
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 44aa485029..a89df7e9a3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -728,6 +728,7 @@  SHLIBOBJS-$(CONFIG_ISO_MEDIA)            += mpegaudiotabs.o
 SHLIBOBJS-$(CONFIG_FLV_MUXER)            += mpeg4audio_sample_rates.o
 SHLIBOBJS-$(CONFIG_HLS_DEMUXER)          += ac3_channel_layout_tab.o
 SHLIBOBJS-$(CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER)    += jpegxl_parse.o
+SHLIBOBJS-$(CONFIG_JNI)                  += ffjni.o
 SHLIBOBJS-$(CONFIG_JPEGXL_ANIM_DEMUXER)  += jpegxl_parse.o
 SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER)     += mpeg4audio_sample_rates.o
 SHLIBOBJS-$(CONFIG_MOV_DEMUXER)          += ac3_channel_layout_tab.o
diff --git a/libavformat/ffjni.c b/libavformat/ffjni.c
new file mode 100644
index 0000000000..2b1483cf42
--- /dev/null
+++ b/libavformat/ffjni.c
@@ -0,0 +1,23 @@ 
+/*
+ * JNI utility functions - included stub
+ *
+ * Copyright (c) 2024 Leo Izen <leo.izen@gmail.com>
+ *
+ * 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 "libavcodec/ffjni.c"
diff --git a/libavformat/file.c b/libavformat/file.c
index dd5819c06f..fa13ae9a6c 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -43,7 +43,7 @@ 
 #if CONFIG_ANDROID_CONTENT_PROTOCOL
 #include <jni.h>
 #include "libavcodec/jni.h"
-#include "libavcodec/ffjni.c"
+#include "libavcodec/ffjni.h"
 #endif