Thomas Guillem pushed to branch master at VideoLAN / VLC
Commits: 7325d5af by Thomas Guillem at 2021-05-07T09:39:44+00:00 test: meta: fix wrong path The path is valid from the CIs but not from my local machine. - - - - - 3d6dd130 by Thomas Guillem at 2021-05-07T09:39:44+00:00 test: expose libvlc_media_parse_sync internally In order to use it from other tests. - - - - - 33d6d8de by Thomas Guillem at 2021-05-07T09:39:44+00:00 test: meta: use the libvlc_media_parse_sync helper Fixes deprecated usage of libvlc_media_parse. - - - - - 4 changed files: - test/Makefile.am - test/libvlc/meta.c - test/libvlc/slaves.c - test/libvlc/test.h Changes: ===================================== test/Makefile.am ===================================== @@ -98,7 +98,7 @@ test_libvlc_renderer_discoverer_LDADD = $(LIBVLC) test_libvlc_slaves_SOURCES = libvlc/slaves.c test_libvlc_slaves_LDADD = $(LIBVLCCORE) $(LIBVLC) test_libvlc_meta_SOURCES = libvlc/meta.c -test_libvlc_meta_LDADD = $(LIBVLC) +test_libvlc_meta_LDADD = $(LIBVLCCORE) $(LIBVLC) test_src_misc_variables_SOURCES = src/misc/variables.c test_src_misc_variables_LDADD = $(LIBVLCCORE) $(LIBVLC) test_src_config_chain_SOURCES = src/config/chain.c ===================================== test/libvlc/meta.c ===================================== @@ -36,10 +36,10 @@ static void test_meta (const char ** argv, int argc) vlc = libvlc_new (argc, argv); assert (vlc != NULL); - media = libvlc_media_new_path (vlc, "samples/meta.mp3"); + media = libvlc_media_new_path (vlc, SRCDIR "/samples/meta.mp3"); assert( media ); - libvlc_media_parse (media); + libvlc_media_parse_sync (media, libvlc_media_parse_local, -1); artist = libvlc_media_get_meta (media, libvlc_meta_Artist); ===================================== test/libvlc/slaves.c ===================================== @@ -20,36 +20,8 @@ #include "test.h" -#include <vlc_common.h> -#include <vlc_threads.h> - #define SLAVES_DIR SRCDIR "/samples/slaves" -static void -finished_event(const libvlc_event_t *p_ev, void *p_data) -{ - (void) p_ev; - vlc_sem_t *p_sem = p_data; - vlc_sem_post(p_sem); -} - -static void -media_parse_sync(libvlc_media_t *p_m) -{ - vlc_sem_t sem; - vlc_sem_init(&sem, 0); - - libvlc_event_manager_t *p_em = libvlc_media_event_manager(p_m); - libvlc_event_attach(p_em, libvlc_MediaParsedChanged, finished_event, &sem); - - int i_ret = libvlc_media_parse_with_options(p_m, libvlc_media_parse_local, -1); - assert(i_ret == 0); - - vlc_sem_wait (&sem); - - libvlc_event_detach(p_em, libvlc_MediaParsedChanged, finished_event, &sem); -} - static char * path_to_mrl(libvlc_instance_t *p_vlc, const char *psz_path) { @@ -111,7 +83,7 @@ test_media_has_slaves_from_parent(libvlc_instance_t *p_vlc, assert(p_m != NULL); printf("Parse media dir to get subitems\n"); - media_parse_sync(p_m); + libvlc_media_parse_sync(p_m, libvlc_media_parse_local, -1); char *psz_main_media_mrl = path_to_mrl(p_vlc, psz_main_media); assert(psz_main_media_mrl != NULL); ===================================== test/libvlc/test.h ===================================== @@ -32,6 +32,8 @@ # include "config.h" #endif #include <vlc/vlc.h> +#include <vlc_common.h> +#include <vlc_threads.h> #undef NDEBUG #include <assert.h> @@ -97,4 +99,32 @@ static inline void test_init (void) setenv( "VLC_PLUGIN_PATH", "../modules", 1 ); } +static void +libvlc_media_parse_finished_event(const libvlc_event_t *p_ev, void *p_data) +{ + (void) p_ev; + vlc_sem_t *p_sem = p_data; + vlc_sem_post(p_sem); +} + +static inline void +libvlc_media_parse_sync(libvlc_media_t *p_m, libvlc_media_parse_flag_t parse_flag, + int timeout) +{ + vlc_sem_t sem; + vlc_sem_init(&sem, 0); + + libvlc_event_manager_t *p_em = libvlc_media_event_manager(p_m); + libvlc_event_attach(p_em, libvlc_MediaParsedChanged, + libvlc_media_parse_finished_event, &sem); + + int i_ret = libvlc_media_parse_with_options(p_m, parse_flag, timeout); + assert(i_ret == 0); + + vlc_sem_wait (&sem); + + libvlc_event_detach(p_em, libvlc_MediaParsedChanged, + libvlc_media_parse_finished_event, &sem); +} + #endif /* TEST_H */ View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/58ba03262380d4ce7e1f2aa72caa6f3bf024db8a...33d6d8deed5e6d0288540c0d2fb7a0f569424832 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/58ba03262380d4ce7e1f2aa72caa6f3bf024db8a...33d6d8deed5e6d0288540c0d2fb7a0f569424832 You're receiving this email because of your account on code.videolan.org.
_______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits