[vlc-commits] test: add back media_discoverer test

Thomas Guillem git at videolan.org
Mon Jun 13 10:58:09 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jun 13 10:07:31 2016 +0200| [641f3d741fe8e64c6ae5711048845004079082f1] | committer: Thomas Guillem

test: add back media_discoverer test

This doesn't test network services anymore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=641f3d741fe8e64c6ae5711048845004079082f1
---

 test/Makefile.am               |    5 +++--
 test/libvlc/media_discoverer.c |   14 ++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 62bd67c..d8759c4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,6 +18,7 @@ check_PROGRAMS = \
 	test_libvlc_media \
 	test_libvlc_media_list \
 	test_libvlc_media_player \
+	test_libvlc_media_discoverer \
 	test_libvlc_slaves \
 	test_src_config_chain \
 	test_src_misc_variables \
@@ -81,8 +82,8 @@ test_libvlc_media_list_SOURCES = libvlc/media_list.c
 test_libvlc_media_list_LDADD = $(LIBVLC)
 test_libvlc_media_player_SOURCES = libvlc/media_player.c
 test_libvlc_media_player_LDADD = $(LIBVLC)
-#test_libvlc_media_discoverer_SOURCES = libvlc/media_discoverer.c
-#test_libvlc_media_discoverer_LDADD = $(LIBVLCCORE) $(LIBVLC)
+test_libvlc_media_discoverer_SOURCES = libvlc/media_discoverer.c
+test_libvlc_media_discoverer_LDADD = $(LIBVLC)
 test_libvlc_slaves_SOURCES = libvlc/slaves.c
 test_libvlc_slaves_LDADD = $(LIBVLCCORE) $(LIBVLC)
 test_libvlc_meta_SOURCES = libvlc/meta.c
diff --git a/test/libvlc/media_discoverer.c b/test/libvlc/media_discoverer.c
index 44114d7..c3bf7f2 100644
--- a/test/libvlc/media_discoverer.c
+++ b/test/libvlc/media_discoverer.c
@@ -20,8 +20,7 @@
 
 #include "test.h"
 
-#include <vlc_common.h>
-#include <vlc_mtime.h> /* for msleep */
+#include <string.h>
 
 static void
 ml_item_event(const struct libvlc_event_t *p_ev, const char *psz_event)
@@ -29,7 +28,8 @@ ml_item_event(const struct libvlc_event_t *p_ev, const char *psz_event)
     char *psz_mrl = libvlc_media_get_mrl(p_ev->u.media_list_item_added.item);
     assert(psz_mrl);
 
-    log("item added(%d): '%s'\n", p_ev->u.media_list_item_added.index, psz_mrl);
+    log("item %s(%d): '%s'\n", psz_event, p_ev->u.media_list_item_added.index,
+        psz_mrl);
     free(psz_mrl);
 }
 
@@ -50,6 +50,8 @@ ml_item_deleted(const struct libvlc_event_t *p_ev, void *p_data)
 static void
 test_discoverer(libvlc_instance_t *p_vlc, const char *psz_name)
 {
+    log("creating and starting discoverer %s\n", psz_name);
+
     libvlc_media_discoverer_t *p_md =
         libvlc_media_discoverer_new(p_vlc, psz_name);
     assert(p_md != NULL);
@@ -75,7 +77,6 @@ test_discoverer(libvlc_instance_t *p_vlc, const char *psz_name)
     else
     {
         assert(libvlc_media_discoverer_is_running(p_md));
-        msleep(20000);
         libvlc_media_discoverer_stop(p_md);
     }
 
@@ -117,10 +118,11 @@ main (void)
             libvlc_media_discoverer_description *p_service = pp_services[i];
 
             assert(i_cat == p_service->i_cat);
-            log("= creating and start discoverer: name: '%s', longname: '%s' =\n",
+            log("= discoverer: name: '%s', longname: '%s' =\n",
                 p_service->psz_name, p_service->psz_longname);
 
-            if( !strncasecmp( p_service->psz_name, "podcast", 7 ) )
+            if (!strncasecmp(p_service->psz_name, "podcast", 7)
+             || i_cat == libvlc_media_discoverer_lan)
             {
                 /* see comment in libvlc_media_discoverer_new() */
                 continue;



More information about the vlc-commits mailing list