diff --git a/packages/vlc/build.sh b/packages/vlc/build.sh new file mode 100644 index 000000000..f26a9114f --- /dev/null +++ b/packages/vlc/build.sh @@ -0,0 +1,86 @@ +TERMUX_PKG_HOMEPAGE=https://www.videolan.org/ +TERMUX_PKG_DESCRIPTION="A popular libre and open source media player and multimedia engine" +TERMUX_PKG_LICENSE="GPL-2.0, LGPL-2.1" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=3.0.17.3 +TERMUX_PKG_SRCURL=https://download.videolan.org/pub/videolan/vlc/${TERMUX_PKG_VERSION}/vlc-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=6f7e90ef8973d31d96de64db817173e345150829717a94084b1bb8321cde2014 +TERMUX_PKG_DEPENDS="avahi, chromaprint, dbus, ffmpeg, fluidsynth, fontconfig, freetype, fribidi, gdk-pixbuf, glib, gst-plugins-base, harfbuzz, liba52, libandroid-shmem, libandroid-spawn, libaom, libarchive, libass, libbluray, libc++, libcaca, libcairo, libcddb, libdav1d, libdvdread, libflac, libgcrypt, libgnutls, libiconv, libidn, libjpeg-turbo, libmad, libnfs, libogg, libopus, libpng, librsvg, libsecret, libsoxr, libssh2, libtheora, libtwolame, libvorbis, libvpx, libx11, libx264, libx265, libxcb, libxml2, mpg123, ncurses, pulseaudio, samba, taglib, zlib" +TERMUX_PKG_BUILD_DEPENDS="libebml, libmatroska, xorgproto" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-static +--disable-lua +--disable-live555 +--disable-dc1394 +--disable-dv1394 +--disable-linsys +--disable-dvdnav +--disable-opencv +--disable-dsm +--disable-v4l2 +--disable-decklink +--disable-vnc +--disable-freerdp +--disable-asdcp +--disable-dvbpsi +--disable-gme +--disable-sid +--disable-shout +--disable-mod +--disable-mpc +--disable-shine +--disable-crystalhd +--disable-libva +--disable-dxva2 +--disable-d3d11va +--disable-faad +--disable-dca +--disable-libmpeg2 +--disable-speex +--disable-spatialaudio +--disable-schroedinger +--disable-mfx +--disable-fluidlite +--disable-zvbi +--disable-aribsub +--disable-aribb25 +--disable-kate +--disable-tiger +--disable-vdpau +--disable-sdl-image +--disable-kva +--disable-mmal +--disable-alsa +--disable-oss +--disable-sndio +--disable-wasapi +--disable-jack +--disable-samplerate +--disable-kai +--disable-chromecast +--disable-qt +--disable-skins2 +--disable-srt +--disable-goom +--disable-projectm +--disable-vsxu +--disable-udev +--disable-mtp +--disable-upnp +--disable-microdns +--disable-notify +--disable-libplacebo +ac_cv_func_ffsll=yes +ac_cv_func_swab=yes +" + +termux_step_pre_configure() { + autoreconf -fi + + CFLAGS+=" -fcommon" + LDFLAGS+=" -landroid-shmem -landroid-spawn -lm" + LDFLAGS+=" -Wl,-rpath=$TERMUX_PREFIX/lib/vlc" + + local _libgcc="$($CC -print-libgcc-file-name)" + LDFLAGS+=" -L$(dirname $_libgcc) -l:$(basename $_libgcc)" +} diff --git a/packages/vlc/configure.ac.patch b/packages/vlc/configure.ac.patch new file mode 100644 index 000000000..6bb50dcfa --- /dev/null +++ b/packages/vlc/configure.ac.patch @@ -0,0 +1,10 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -410,6 +410,7 @@ + ]) + ]) + AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1") ++AM_CONDITIONAL(HAVE_ANDROID_NO_TERMUX, false) + + dnl Tizen (minimum SDK version: 2.3) + AS_IF([test "$SYS" = linux],[ diff --git a/packages/vlc/modules-audio_output-Makefile.am.patch b/packages/vlc/modules-audio_output-Makefile.am.patch new file mode 100644 index 000000000..4125bd02c --- /dev/null +++ b/packages/vlc/modules-audio_output-Makefile.am.patch @@ -0,0 +1,11 @@ +--- a/modules/audio_output/Makefile.am ++++ b/modules/audio_output/Makefile.am +@@ -8,7 +8,7 @@ + video_output/android/utils.c video_output/android/utils.h + libandroid_audiotrack_plugin_la_CFLAGS = $(AM_CFLAGS) + +-if HAVE_ANDROID ++if HAVE_ANDROID_NO_TERMUX + aout_LTLIBRARIES += libandroid_audiotrack_plugin.la libopensles_android_plugin.la + endif + diff --git a/packages/vlc/modules-codec-Makefile.am.patch b/packages/vlc/modules-codec-Makefile.am.patch new file mode 100644 index 000000000..b43d9a311 --- /dev/null +++ b/packages/vlc/modules-codec-Makefile.am.patch @@ -0,0 +1,20 @@ +--- a/modules/codec/Makefile.am ++++ b/modules/codec/Makefile.am +@@ -477,7 +477,7 @@ + packetizer/hevc_nal.c packetizer/hevc_nal.h \ + codec/omxil/qcom.c codec/omxil/qcom.h \ + codec/omxil/omxil.c codec/omxil/omxil.h codec/omxil/omxil_core.c codec/omxil/omxil_core.h +-if HAVE_ANDROID ++if HAVE_ANDROID_NO_TERMUX + libomxil_plugin_la_SOURCES += video_output/android/utils.c video_output/android/utils.h \ + video_output/android/display.h + endif +@@ -506,7 +506,7 @@ + libmediacodec_plugin_la_LIBADD = libchroma_copy.la + codec_LTLIBRARIES += $(LTLIBomxil) $(LTLIBomxil_vout) + EXTRA_LTLIBRARIES += libomxil_plugin.la libomxil_vout_plugin.la +-if HAVE_ANDROID ++if HAVE_ANDROID_NO_TERMUX + codec_LTLIBRARIES += libiomx_plugin.la libmediacodec_plugin.la + endif + diff --git a/packages/vlc/modules-demux-Makefile.am.patch b/packages/vlc/modules-demux-Makefile.am.patch new file mode 100644 index 000000000..f83ae4408 --- /dev/null +++ b/packages/vlc/modules-demux-Makefile.am.patch @@ -0,0 +1,13 @@ +--- a/modules/demux/Makefile.am ++++ b/modules/demux/Makefile.am +@@ -479,8 +479,10 @@ + libvlc_adaptive_la_LIBADD = $(SOCKET_LIBS) $(LIBM) + libvlc_adaptive_la_LDFLAGS = -static + if !HAVE_WIN32 ++if !HAVE_ANDROID + libvlc_adaptive_la_LDFLAGS += -lpthread + endif ++endif + libvlc_adaptive_la_LIBADD += libvlc_http.la + if HAVE_ZLIB + libvlc_adaptive_la_LIBADD += -lz diff --git a/packages/vlc/modules-keystore-Makefile.am.patch b/packages/vlc/modules-keystore-Makefile.am.patch new file mode 100644 index 000000000..1936418d6 --- /dev/null +++ b/packages/vlc/modules-keystore-Makefile.am.patch @@ -0,0 +1,11 @@ +--- a/modules/keystore/Makefile.am ++++ b/modules/keystore/Makefile.am +@@ -7,7 +7,7 @@ + libfile_keystore_plugin_la_SOURCES = keystore/file.c \ + keystore/file_crypt.h \ + keystore/list_util.c keystore/list_util.h +-if HAVE_ANDROID ++if HAVE_ANDROID_NO_TERMUX + libfile_keystore_plugin_la_SOURCES += keystore/file_crypt_android.c + endif + if HAVE_WIN32 diff --git a/packages/vlc/modules-keystore-file_crypt.h.patch b/packages/vlc/modules-keystore-file_crypt.h.patch new file mode 100644 index 000000000..9450b6007 --- /dev/null +++ b/packages/vlc/modules-keystore-file_crypt.h.patch @@ -0,0 +1,11 @@ +--- a/modules/keystore/file_crypt.h ++++ b/modules/keystore/file_crypt.h +@@ -18,7 +18,7 @@ + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +-#if defined(__ANDROID__) || defined(_WIN32) ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) || defined(_WIN32) + # define CRYPTFILE + + struct crypt diff --git a/packages/vlc/modules-video_output-Makefile.am.patch b/packages/vlc/modules-video_output-Makefile.am.patch new file mode 100644 index 000000000..519ebd769 --- /dev/null +++ b/packages/vlc/modules-video_output-Makefile.am.patch @@ -0,0 +1,11 @@ +--- a/modules/video_output/Makefile.am ++++ b/modules/video_output/Makefile.am +@@ -389,7 +389,7 @@ + video_output/opengl/converter.h + libglconv_android_plugin_la_CFLAGS = $(AM_CFLAGS) -DUSE_OPENGL_ES2 + +-if HAVE_ANDROID ++if HAVE_ANDROID_NO_TERMUX + vout_LTLIBRARIES += libandroid_window_plugin.la libandroid_display_plugin.la + if HAVE_EGL + vout_LTLIBRARIES += libegl_android_plugin.la libglconv_android_plugin.la diff --git a/packages/vlc/src-Makefile.am.patch b/packages/vlc/src-Makefile.am.patch new file mode 100644 index 000000000..7ed682938 --- /dev/null +++ b/packages/vlc/src-Makefile.am.patch @@ -0,0 +1,24 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -405,11 +405,20 @@ + if HAVE_ANDROID + libvlccore_la_SOURCES += \ + android/error.c \ +- android/specific.c \ + android/thread.c \ + linux/cpu.c \ + linux/dirs.c \ + linux/thread.c ++if HAVE_ANDROID_NO_TERMUX ++libvlccore_la_SOURCES += \ ++ android/specific.c ++else ++libvlccore_la_SOURCES += \ ++ posix/dirs.c \ ++ posix/getaddrinfo.c \ ++ posix/netconf.c \ ++ posix/specific.c ++endif + else + if HAVE_DARWIN + libvlccore_la_SOURCES += \ diff --git a/packages/vlc/src-network-getaddrinfo.c.patch b/packages/vlc/src-network-getaddrinfo.c.patch new file mode 100644 index 000000000..670bde6e5 --- /dev/null +++ b/packages/vlc/src-network-getaddrinfo.c.patch @@ -0,0 +1,11 @@ +--- a/src/network/getaddrinfo.c ++++ b/src/network/getaddrinfo.c +@@ -121,7 +121,7 @@ + } + + #if defined (_WIN32) || defined (__OS2__) \ +- || defined (__ANDROID__) || defined (__APPLE__) \ ++ || (defined (__ANDROID__) && !defined (__TERMUX__)) || defined (__APPLE__) \ + || defined (__native_client__) + #warning vlc_getaddr_info_i11e() not implemented! + int vlc_getaddrinfo_i11e(const char *node, unsigned port, diff --git a/packages/vlc/src-posix-filesystem.c.patch b/packages/vlc/src-posix-filesystem.c.patch new file mode 100644 index 000000000..7d4b5b2ba --- /dev/null +++ b/packages/vlc/src-posix-filesystem.c.patch @@ -0,0 +1,20 @@ +--- a/src/posix/filesystem.c ++++ b/src/posix/filesystem.c +@@ -113,7 +113,7 @@ + { + int fd; + #if O_TMPFILE +- fd = vlc_open ("/tmp", O_RDWR|O_TMPFILE, S_IRUSR|S_IWUSR); ++ fd = vlc_open ("@TERMUX_PREFIX@/tmp", O_RDWR|O_TMPFILE, S_IRUSR|S_IWUSR); + if (fd != -1) + return fd; + /* ENOENT means either /tmp is missing (!) or the kernel does not support +@@ -124,7 +124,7 @@ + return -1; + #endif + +- char bufpath[] = "/tmp/"PACKAGE_NAME"XXXXXX"; ++ char bufpath[] = "@TERMUX_PREFIX@/tmp/"PACKAGE_NAME"XXXXXX"; + + fd = vlc_mkstemp (bufpath); + if (fd != -1) diff --git a/packages/vlc/vlc-3.0.17.3-dav1d-1.0.patch b/packages/vlc/vlc-3.0.17.3-dav1d-1.0.patch new file mode 100644 index 000000000..e34f2ba6a --- /dev/null +++ b/packages/vlc/vlc-3.0.17.3-dav1d-1.0.patch @@ -0,0 +1,85 @@ +https://code.videolan.org/videolan/vlc/-/merge_requests/1618 + +From 0efdfe8799b0100f41c5b8d6e1b43451001386cb Mon Sep 17 00:00:00 2001 +From: Steve Lhomme +Date: Fri, 18 Mar 2022 11:42:49 +0100 +Subject: [PATCH 1/2] dav1d: fix compilation with (upcoming) dav1d 1.0 + +(cherry picked from commit dbf45cea2a8abdfbef897b8a71f3eb782bb1b712) (edited) +edited: +- 3.0 has the 128 pixels padding elsewhere +- 3.0 has an extra parameter for add_integer_with_range() +- 3.0 was setting i_extra_picture_buffers further down in the code +- 3.0 uses 16 threads max + +Signed-off-by: Steve Lhomme +--- + modules/codec/dav1d.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c +index 039165f52ec..cfabbc27cb3 100644 +--- a/modules/codec/dav1d.c ++++ b/modules/codec/dav1d.c +@@ -63,10 +63,16 @@ vlc_module_begin () + set_category(CAT_INPUT) + set_subcategory(SUBCAT_INPUT_VCODEC) + ++#if DAV1D_API_VERSION_MAJOR >= 6 ++ add_integer_with_range("dav1d-thread-frames", 0, 0, DAV1D_MAX_THREADS, ++ THREAD_FRAMES_TEXT, THREAD_FRAMES_LONGTEXT, false) ++ add_obsolete_string("dav1d-thread-tiles") // unused with dav1d 1.0 ++#else + add_integer_with_range("dav1d-thread-frames", 0, 0, DAV1D_MAX_FRAME_THREADS, + THREAD_FRAMES_TEXT, THREAD_FRAMES_LONGTEXT, false) + add_integer_with_range("dav1d-thread-tiles", 0, 0, DAV1D_MAX_TILE_THREADS, + THREAD_TILES_TEXT, THREAD_TILES_LONGTEXT, false) ++#endif + vlc_module_end () + + /***************************************************************************** +@@ -294,6 +300,11 @@ static int OpenDecoder(vlc_object_t *p_this) + return VLC_ENOMEM; + + dav1d_default_settings(&p_sys->s); ++#if DAV1D_API_VERSION_MAJOR >= 6 ++ p_sys->s.n_threads = var_InheritInteger(p_this, "dav1d-thread-frames"); ++ if (p_sys->s.n_threads == 0) ++ p_sys->s.n_threads = (i_core_count < 16) ? i_core_count : 16; ++#else + p_sys->s.n_tile_threads = var_InheritInteger(p_this, "dav1d-thread-tiles"); + if (p_sys->s.n_tile_threads == 0) + p_sys->s.n_tile_threads = +@@ -303,6 +314,7 @@ static int OpenDecoder(vlc_object_t *p_this) + p_sys->s.n_frame_threads = var_InheritInteger(p_this, "dav1d-thread-frames"); + if (p_sys->s.n_frame_threads == 0) + p_sys->s.n_frame_threads = (i_core_count < 16) ? i_core_count : 16; ++#endif + p_sys->s.allocator.cookie = dec; + p_sys->s.allocator.alloc_picture_callback = NewPicture; + p_sys->s.allocator.release_picture_callback = FreePicture; +@@ -313,12 +325,20 @@ static int OpenDecoder(vlc_object_t *p_this) + return VLC_EGENERIC; + } + ++#if DAV1D_API_VERSION_MAJOR >= 6 ++ msg_Dbg(p_this, "Using dav1d version %s with %d threads", ++ dav1d_version(), p_sys->s.n_threads); ++ ++ dec->i_extra_picture_buffers = (p_sys->s.n_threads - 1); ++#else + msg_Dbg(p_this, "Using dav1d version %s with %d/%d frame/tile threads", + dav1d_version(), p_sys->s.n_frame_threads, p_sys->s.n_tile_threads); + ++ dec->i_extra_picture_buffers = (p_sys->s.n_frame_threads - 1); ++#endif ++ + dec->pf_decode = Decode; + dec->pf_flush = FlushDecoder; +- dec->i_extra_picture_buffers = (p_sys->s.n_frame_threads - 1); + + dec->fmt_out.video.i_width = dec->fmt_in.video.i_width; + dec->fmt_out.video.i_height = dec->fmt_in.video.i_height; +-- +GitLab +