[vlc-commits] [Git][videolan/vlc][master] 5 commits: src: meson: fix link with -Dvideolan_manager=false
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Aug 12 14:16:14 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
ebefe42a by Alexandre Janniaux at 2023-08-12T13:57:08+00:00
src: meson: fix link with -Dvideolan_manager=false
The VLM sources shouldn't be included if VLM has been disabled.
- - - - -
aef1d512 by Alexandre Janniaux at 2023-08-12T13:57:08+00:00
demux: Makefile.am: set module name to demux_mock
The module_name is parsed from $@ but the target will only include the
module name if CPPFLAGS or CFLAGS-like are present for the target.
Since we'll use demux_mock in meson to not confuse with another module,
also set it in Makefile.am.
- - - - -
41bd22f7 by Alexandre Janniaux at 2023-08-12T13:57:08+00:00
libvlc: media_thumbnail: add ARGB/Png/Jpg tests
The test checks that the libvlc thumbnailing API from libvlc_media works
correctly with png, jpeg and avcodec/avformat(raw RGB) image encoders.
- - - - -
851fb1c4 by Alexandre Janniaux at 2023-08-12T13:57:08+00:00
libvlc: media_thumbnail: add test for WebP
The test checks that the libvlc thumbnailing API from libvlc_media works
correctly with VPX image encoder.
- - - - -
dbefe455 by Alexandre Janniaux at 2023-08-12T13:57:08+00:00
test: libvlc/media: fix typo in test header
- - - - -
6 changed files:
- modules/demux/Makefile.am
- src/meson.build
- test/Makefile.am
- test/libvlc/media.c
- + test/libvlc/media_thumbnail.c
- test/libvlc/meson.build
Changes:
=====================================
modules/demux/Makefile.am
=====================================
@@ -532,6 +532,7 @@ libnoseek_plugin_la_SOURCES = demux/filter/noseek.c
demux_LTLIBRARIES += libnoseek_plugin.la
libdemux_mock_plugin_la_SOURCES = demux/mock.c
+libdemux_mock_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
libdemux_mock_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(demuxdir)'
libdemux_mock_plugin_la_LIBADD = $(LIBM)
noinst_LTLIBRARIES += libdemux_mock_plugin.la
=====================================
src/meson.build
=====================================
@@ -291,9 +291,12 @@ libvlccore_vlm_sources = [
libvlccore_sources = [
libvlccore_sources_base,
libvlccore_sout_sources,
- libvlccore_vlm_sources
]
+if get_option('videolan_manager')
+ libvlccore_sources += libvlccore_vlm_sources
+endif
+
libvlccore_link_args = []
if host_system == 'darwin'
=====================================
test/Makefile.am
=====================================
@@ -17,6 +17,10 @@ check_PROGRAMS = \
test_libvlc_core \
test_libvlc_equalizer \
test_libvlc_media \
+ test_libvlc_media_thumbnail_argb \
+ test_libvlc_media_thumbnail_jpeg \
+ test_libvlc_media_thumbnail_png \
+ test_libvlc_media_thumbnail_webp \
test_libvlc_media_list \
test_libvlc_media_player \
test_libvlc_media_player_record \
@@ -115,6 +119,18 @@ test_libvlc_equalizer_SOURCES = libvlc/equalizer.c
test_libvlc_equalizer_LDADD = $(LIBVLC)
test_libvlc_media_SOURCES = libvlc/media.c
test_libvlc_media_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_thumbnail_argb_SOURCES = libvlc/media_thumbnail.c
+test_libvlc_media_thumbnail_argb_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_thumbnail_argb_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_THUMB_TYPE=libvlc_picture_Argb -DTEST_REQUIRED_MODULES=\"avcodec\"
+test_libvlc_media_thumbnail_png_SOURCES = libvlc/media_thumbnail.c
+test_libvlc_media_thumbnail_png_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_thumbnail_png_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_THUMB_TYPE=libvlc_picture_Png -DTEST_REQUIRED_MODULES=\"png\"
+test_libvlc_media_thumbnail_jpeg_SOURCES = libvlc/media_thumbnail.c
+test_libvlc_media_thumbnail_jpeg_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_thumbnail_jpeg_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_THUMB_TYPE=libvlc_picture_Jpg -DTEST_REQUIRED_MODULES=\"jpeg\"
+test_libvlc_media_thumbnail_webp_SOURCES = libvlc/media_thumbnail.c
+test_libvlc_media_thumbnail_webp_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_thumbnail_webp_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_THUMB_TYPE=libvlc_picture_WebP -DTEST_REQUIRED_MODULES=\"vpx\"
test_libvlc_media_list_player_SOURCES = libvlc/media_list_player.c
test_libvlc_media_list_player_LDADD = $(LIBVLC)
test_libvlc_media_list_SOURCES = libvlc/media_list.c
=====================================
test/libvlc/media.c
=====================================
@@ -1,5 +1,5 @@
/*
- * media_player.c - libvlc smoke test
+ * media.c - libvlc media smoke test
*
*/
=====================================
test/libvlc/media_thumbnail.c
=====================================
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * media_thumbnail.c - libvlc thumbnailing smoke test
+ *****************************************************************************
+ * Copyright (C) 2023 VideoLabs
+ *
+ * Authors: Alexandre Janniaux <ajanni at videolabs.io>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "test.h"
+#include "../lib/libvlc_internal.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <vlc_common.h>
+#include <vlc_threads.h>
+#include <vlc_modules.h>
+
+#include <vlc/vlc.h>
+
+#ifndef TEST_THUMB_TYPE
+# error Define TEST_THUMB_TYPE to a libvlc_picture_type_t value
+#endif
+
+static void thumbnail_generated(const libvlc_event_t *event, void *user_data)
+{
+ (void)event;
+ assert(event->u.media_thumbnail_generated.p_thumbnail != NULL);
+ vlc_sem_t *sem = user_data;
+ vlc_sem_post(sem);
+}
+
+static void test_media_thumbnail(libvlc_instance_t *vlc, const char *location,
+ unsigned width, unsigned height,
+ enum libvlc_picture_type_t picture_type)
+{
+#define STRINGIFY_(x) #x
+#define STRINGIFY(x) STRINGIFY_(x)
+ test_log ("Testing media_thumbnail: width=%u height=%u type=" STRINGIFY(TEST_THUMB_TYPE) "'\n", width, height);
+ libvlc_media_t *media = libvlc_media_new_location(location);
+ assert (media != NULL);
+
+ vlc_sem_t sem;
+ vlc_sem_init (&sem, 0);
+
+ libvlc_event_manager_t *em = libvlc_media_event_manager(media);
+ libvlc_event_attach(em, libvlc_MediaThumbnailGenerated, thumbnail_generated, &sem);
+
+ libvlc_media_thumbnail_request_t *request =
+ libvlc_media_thumbnail_request_by_pos(
+ vlc, media, 0.f, libvlc_media_thumbnail_seek_precise,
+ width, height, false, picture_type, 0);
+
+ vlc_sem_wait(&sem);
+ libvlc_media_thumbnail_request_destroy(request);
+
+ libvlc_event_detach(em, libvlc_MediaThumbnailGenerated, thumbnail_generated, &sem);
+ libvlc_media_release(media);
+}
+
+int main(int argc, char *argv[])
+{
+ (void)argc; (void)argv;
+ test_init();
+
+#ifndef ENABLE_SOUT
+ (void)thumbnail_generated;
+ (void)test_media_thumbnail;
+ test_log("Stream output has been disabled (see ENABLE_SOUT), skipping...")
+ return 77;
+#else
+
+ libvlc_instance_t *vlc = libvlc_new (test_defaults_nargs,
+ test_defaults_args);
+ assert (vlc != NULL);
+
+ const char *module_deps[] = {
+ "demux_mock", "swscale",
+ TEST_REQUIRED_MODULES
+ };
+
+ for (size_t i=0; i<ARRAY_SIZE(module_deps); ++i)
+ {
+ test_log(" - Checking that module %s exists...\n", module_deps[i]);
+ /* Skip test if one of the dependencies doesn't exist */
+ if (!module_exists(module_deps[i]))
+ {
+ test_log(" Module %s is required and wasn't found, skipping...\n", module_deps[i]);
+ libvlc_release(vlc);
+ exit(77);
+ }
+ }
+
+ /* Check that thumbnails are correctly generated. */
+ const char *mock_addr =
+ "mock://video_track_count=1;length=100000000;"
+ "video_width=800;video_height=600";
+
+ test_media_thumbnail(vlc, mock_addr, 800, 600, TEST_THUMB_TYPE);
+ test_media_thumbnail(vlc, mock_addr, 400, 300, TEST_THUMB_TYPE);
+
+ libvlc_release (vlc);
+
+ return 0;
+#endif
+}
=====================================
test/libvlc/meson.build
=====================================
@@ -20,6 +20,71 @@ vlc_tests += {
'module_depends': vlc_plugins_targets.keys()
}
+test_libvlc_media_thumbnail_modules = ['demux_mock']
+if avcodec_dep.found()
+ test_libvlc_media_thumbnail_modules += ['avcodec']
+endif
+if swscale_dep.found()
+ test_libvlc_media_thumbnail_modules += ['swscale']
+endif
+if jpeg_dep.found()
+ test_libvlc_media_thumbnail_modules += ['jpeg']
+endif
+if png_dep.found()
+ test_libvlc_media_thumbnail_modules += ['png']
+endif
+if vpx_dep.found()
+ test_libvlc_media_thumbnail_modules += ['vpx']
+endif
+
+vlc_tests += {
+ 'name' : 'test_libvlc_media_thumbnail_argb',
+ 'sources' : files('media_thumbnail.c'),
+ 'link_with' : [libvlc, libvlccore],
+ 'suite' : ['libvlc', 'test_libvlc_media_thumbnail'],
+ 'c_args' : [
+ '-DTEST_THUMB_TYPE=libvlc_picture_Argb',
+ '-DTEST_REQUIRED_MODULES="avcodec"',
+ ],
+ 'module_depends': test_libvlc_media_thumbnail_modules,
+}
+
+vlc_tests += {
+ 'name' : 'test_libvlc_media_thumbnail_jpeg',
+ 'sources' : files('media_thumbnail.c'),
+ 'link_with' : [libvlc, libvlccore],
+ 'suite' : ['libvlc', 'test_libvlc_media_thumbnail'],
+ 'c_args' : [
+ '-DTEST_THUMB_TYPE=libvlc_picture_Jpg',
+ '-DTEST_REQUIRED_MODULES="jpeg"',
+ ],
+ 'module_depends': test_libvlc_media_thumbnail_modules,
+}
+
+vlc_tests += {
+ 'name' : 'test_libvlc_media_thumbnail_png',
+ 'sources' : files('media_thumbnail.c'),
+ 'link_with' : [libvlc, libvlccore],
+ 'suite' : ['libvlc', 'test_libvlc_media_thumbnail'],
+ 'c_args' : [
+ '-DTEST_THUMB_TYPE=libvlc_picture_Png',
+ '-DTEST_REQUIRED_MODULES="png"',
+ ],
+ 'module_depends': test_libvlc_media_thumbnail_modules,
+}
+
+vlc_tests += {
+ 'name' : 'test_libvlc_media_thumbnail_webp',
+ 'sources' : files('media_thumbnail.c'),
+ 'link_with' : [libvlc, libvlccore],
+ 'suite' : ['libvlc', 'test_libvlc_media_thumbnail'],
+ 'c_args' : [
+ '-DTEST_THUMB_TYPE=libvlc_picture_WebP',
+ '-DTEST_REQUIRED_MODULES="vpx"',
+ ],
+ 'module_depends': test_libvlc_media_thumbnail_modules,
+}
+
# vlc_tests += {
# 'name' : 'test_libvlc_media_list_player',
# 'sources' : files('libvlc/media_list_player.c'),
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7aeea12aadc36ad84b57a83119aeba1acfabebe8...dbefe455bc08cd17f3cb6c7c9992ff4e74fc03d6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7aeea12aadc36ad84b57a83119aeba1acfabebe8...dbefe455bc08cd17f3cb6c7c9992ff4e74fc03d6
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