[vlc-commits] [Git][videolan/vlc][master] 8 commits: video_output: Makefile.am: fix link for android_display

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Feb 23 10:45:16 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
593f8811 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
video_output: Makefile.am: fix link for android_display

- - - - -
3c23f063 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: detect android from host_os

This patch consider linux-android as a separate target than linux,
removing the need to check for __ANDROID__ at preprocessor time to
detect that we're building for android.

It will also be used later to include autoconf fixes for Android and
handle the system target version from the --host parameter.

- - - - -
2ea16045 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: parse android API level

The --host used to configure the VLC buildsystem can also contains a
version number, referencing the minimum API level supported for the
build.

For armv7, the target name will end with androideabi$(API_VERSION),
so eabi needs to be stripped out.

- - - - -
7603dbf2 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: supply GLES/EGL libs on Android

Android provides GLESv2 and EGL from the SDK, but doesn't provide a
pkg-config file, so expose it directly from configure.ac.

- - - - -
371372cf by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: simplify EGL check

On Android, EGL is provided from the system without pkg-config
definition file, but we provide EGL_CFLAGS and EGL_LIBS.

- - - - -
06f92cd5 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: simplify GLES2 check

... and enable gles2 by default.

On Android, GLESv2 is provided from the system without pkg-config
definition file, but we provide GLES2_CFLAGS and GLES2_LIBS.

- - - - -
14deabb1 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
configure.ac: disable unsupported android headers/functions

Android doesn't have a working sys/shm.h (but still has the file) until
ANDROID_API==26. The other headers were not functional too, and
disabling them fallback to vlc_fixups.h.

- - - - -
75b62f44 by Alexandre Janniaux at 2024-02-23T10:12:45+00:00
opengl: Makefile.am: generalize HAVE_GLES2

HAVE_GLES2 can be used for tvOS, iOS, android and Linux without OpenGL,
removing the endless duplication of Makefile code for each platform.

Since the refactoring of the OpenGL infrastructure, the OpenGL filter
and display modules are not linking the OpenGL implementation
themselves, so only the CFLAGS are needed to find the correct OpenGL/ES
headers, and once compiled, the modules can work for both OpenGL and
OpenGL ES.

This patch prioritize compiling against OpenGL headers rather than
OpenGL ES headers. No gain right now since iOS and tvOS are still using
their own defines, but futures patches will be able to refactor down to
the single case of !HAVE_GL && HAVE_GLES2.

In the future, they would ideally be compiled against the same header,
so we can ditch HAVE_GLES2 completely.

- - - - -


4 changed files:

- configure.ac
- modules/video_filter/Makefile.am
- modules/video_output/Makefile.am
- modules/video_output/opengl/Makefile.am


Changes:

=====================================
configure.ac
=====================================
@@ -396,6 +396,32 @@ int foo() { return my_array[0]; }
     ;;
 esac
 
+ANDROID_API=17
+dnl Vendor-specific configuration
+case "${host_os}" in
+  linux-android*)
+    VENDOR=android
+    AC_MSG_CHECKING([Check Android API version])
+    ANDROID_API="`echo ${host_os} | tr -c -d '[[:digit:]]'`"
+    AC_MSG_RESULT([${ANDROID_API}])
+
+    dnl GLESv2 and EGL are provided by android NDK without .pc files
+    GLES2_LIBS="-lGLESv2"
+    GLES2_CFLAGS=" "
+    EGL_LIBS="-lEGL"
+    EGL_CFLAGS=" "
+
+    AS_IF([test -n "$ANDROID_API" -a "$ANDROID_API" -lt "26"],[
+        ac_cv_header_sys_shm_h=no
+    ])
+
+    dnl Those functions and headers are not functional on android, use vlc_fixups instead
+    ac_cv_header_search_h=no
+    ac_cv_func_tdestroy=no
+    ac_cv_func_tfind=no
+    ;;
+esac
+
 dnl WinRT
 AC_ARG_ENABLE([winstore_app],
      AS_HELP_STRING([--enable-winstore-app],
@@ -439,6 +465,7 @@ AS_IF([test "${SYS}" = "mingw32"],[
 
 AM_CONDITIONAL([HAVE_FREEBSD], [test "${SYS}" = "freebsd"])
 AM_CONDITIONAL([HAVE_LINUX],   [test "${SYS}" = "linux"])
+AM_CONDITIONAL([HAVE_ANDROID], [test "${VENDOR}" = "android"])
 AM_CONDITIONAL([HAVE_OS2],     [test "${SYS}" = "os2"])
 
 AM_CONDITIONAL([HAVE_DARWIN],  [test "${SYS}" = "darwin"])
@@ -487,23 +514,6 @@ case "${build_os}" in
 esac
 AC_SUBST([BUILDEXEEXT])
 
-dnl Android is linux, but a bit different
-AS_IF([test "$SYS" = linux],[
-    AC_MSG_CHECKING([for an Android system])
-    AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
-        [[#ifndef __ANDROID__
-         # error Not Android
-         #endif
-        ]],[[;]])
-    ],[
-      HAVE_ANDROID="1"
-      AC_MSG_RESULT([yes])
-    ],[
-      AC_MSG_RESULT([no])
-    ])
-])
-AM_CONDITIONAL([HAVE_ANDROID], [test "${HAVE_ANDROID}" = "1"])
-
 dnl
 dnl  Check for the contrib directory
 dnl
@@ -3235,12 +3245,7 @@ AM_CONDITIONAL([HAVE_LIBPLACEBO_GL], [test "$have_libplacebo_gl" = "yes"])
 dnl
 dnl  OpenGL
 dnl
-PKG_CHECK_MODULES([EGL], [egl], [
-  have_egl="yes"
-], [
-  have_egl="no"
-])
-AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
+PKG_HAVE_WITH_MODULES([EGL], [egl])
 
 have_gl="no"
 PKG_CHECK_MODULES([GL], [gl], [
@@ -3282,14 +3287,7 @@ AS_IF([test "${have_gl}" = "yes"], [
 ])
 
 dnl OpenGL ES 2: depends on EGL 1.1
-have_gles2="no"
-AC_ARG_ENABLE(gles2,
-  [AS_HELP_STRING([--enable-gles2],
-      [enable GLES2 support (default disabled)])])
-AS_IF([test "$enable_gles2" = "yes"], [
-  PKG_CHECK_MODULES([GLES2], [glesv2], [have_gles2="yes"], [])
-  ])
-AM_CONDITIONAL([HAVE_GLES2], [test "${have_gles2}" = "yes"])
+PKG_HAVE_WITH_MODULES([GLES2], [glesv2], [enable GLES2 support (default auto)])
 
 dnl
 dnl Vulkan
@@ -3845,13 +3843,11 @@ dnl  OpenSLES Android
 dnl
 AC_ARG_ENABLE([opensles],
   AS_HELP_STRING([--enable-opensles], [Android OpenSL ES audio module (default disabled)]))
-if test "${HAVE_ANDROID}" = "1"; then
-  if test "${enable_opensles}" = "yes"; then
-      AC_CHECK_HEADERS([SLES/OpenSLES.h],
-        [ VLC_ADD_PLUGIN([opensles_android]) ],
-        [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
-  fi
-fi
+AS_IF([test "${VENDOR}" = "android" -a "${enable_opensles}" = "yes"],[
+  AC_CHECK_HEADERS([SLES/OpenSLES.h],
+    [ VLC_ADD_PLUGIN([opensles_android]) ],
+    [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
+])
 
 dnl
 dnl libsamplerate plugin
@@ -4570,7 +4566,7 @@ AC_ARG_WITH(kde-solid,
   AS_HELP_STRING([--with-kde-solid=PATH],
                  [KDE Solid actions directory (auto)]),, [
 
-if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${HAVE_ANDROID}" != "1" ; then
+if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${VENDOR}" != "android" ; then
   with_kde_solid="yes"
 fi
 ])


=====================================
modules/video_filter/Makefile.am
=====================================
@@ -202,11 +202,13 @@ libglblend_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
 endif
 endif
 
-if HAVE_ANDROID
+if !HAVE_GL
+if HAVE_GLES2
 libglblend_plugin_la_LIBADD = libvlc_opengles.la
 libglblend_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
 video_filter_LTLIBRARIES += libglblend_plugin.la
 endif
+endif
 
 libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.c
 libopencv_wrapper_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)


=====================================
modules/video_output/Makefile.am
=====================================
@@ -333,9 +333,11 @@ libandroid_window_plugin_la_SOURCES = video_output/android/window.c \
 libandroid_window_plugin_la_LIBADD = \
 	libandroid_env.la libandroid_utils.la $(LIBDL) $(EGL_LIBS) $(GLES2_LIBS)
 
-libandroid_display_plugin_la_SOURCES = video_output/android/display.c
+libandroid_display_plugin_la_SOURCES = video_output/android/display.c \
+	video_output/opengl/sub_renderer.c \
+	video_output/opengl/sub_renderer.h
 libandroid_display_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2
-libandroid_display_plugin_la_LIBADD = libvlc_opengles.la $(EGL_LIBS) $(GLES2_LIBS)
+libandroid_display_plugin_la_LIBADD = libvlc_opengles.la $(EGL_LIBS) $(GLES2_LIBS) libandroid_utils.la libandroid_env.la
 
 libglinterop_android_plugin_la_SOURCES = video_output/opengl/interop_android.c \
 	video_output/opengl/interop.h


=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -122,11 +122,13 @@ libglfilter_draw_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
 endif
 endif
 
-if HAVE_ANDROID
+if !HAVE_GL
+if HAVE_GLES2
 libglfilter_draw_plugin_la_LIBADD = libvlc_opengles.la $(GLES2_LIBS)
 libglfilter_draw_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
 vout_LTLIBRARIES += libglfilter_draw_plugin.la
 endif
+endif
 
 libglfilter_mock_plugin_la_SOURCES = video_output/opengl/filter_mock.c
 libglfilter_mock_plugin_la_LIBADD = $(LIBM)
@@ -153,11 +155,13 @@ libglfilter_mock_plugin_la_LIBADD += libvlc_opengl.la
 noinst_LTLIBRARIES += libglfilter_mock_plugin.la
 endif
 
-if HAVE_ANDROID
+if !HAVE_GL
+if HAVE_GLES2
 libglfilter_mock_plugin_la_LIBADD += libvlc_opengles.la $(GLES2_LIBS)
 libglfilter_mock_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
 noinst_LTLIBRARIES += libglfilter_mock_plugin.la
 endif
+endif
 
 if HAVE_LIBPLACEBO
 if HAVE_LIBPLACEBO_GL
@@ -180,11 +184,13 @@ libpl_scale_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
 endif
 endif
 
-if HAVE_ANDROID
+if !HAVE_GL
+if HAVE_GLES2
 libpl_scale_plugin_la_LIBADD += libvlc_opengles.la
 libpl_scale_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
 video_filter_LTLIBRARIES += libpl_scale_plugin.la
 endif
+endif
 
 endif
 endif
@@ -218,13 +224,14 @@ if HAVE_EGL
 if HAVE_GL
 libegl_pbuffer_filter_plugin_la_LIBADD += libvlc_opengl.la $(GL_LIBS)
 vout_LTLIBRARIES += libegl_pbuffer_filter_plugin.la
-endif
-if HAVE_ANDROID
+else
+if HAVE_GLES2
 libegl_pbuffer_filter_plugin_la_LIBADD += libvlc_opengles.la $(GLES2_LIBS)
 libegl_pbuffer_filter_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
 vout_LTLIBRARIES += libegl_pbuffer_filter_plugin.la
 endif
 endif
+endif
 
 libegl_surfacetexture_plugin_la_SOURCES = video_filter/egl_surfacetexture.c
 libegl_surfacetexture_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_OPENGL_ES2



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/88208c99875afbca91d864fb995b82315ff3b923...75b62f44d8d08aac581e67dea4b4658b3736ce9f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/88208c99875afbca91d864fb995b82315ff3b923...75b62f44d8d08aac581e67dea4b4658b3736ce9f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list