[vlc-devel] commit: test: Test meta data support. (Pierre d'Herbemont )

git version control git at videolan.org
Sat Apr 19 03:22:05 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Apr 19 02:51:42 2008 +0200| [b66dfd1b9f7587822fd5c8ad7b6d153d72b889c5]

test: Test meta data support.

Note, this is done even if no meta data module is compiled. A future commit should fix that.

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

 test/Makefile.am   |   14 +++++++++-
 test/libvlc/meta.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index da99f73..847be09 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -13,12 +13,13 @@ check_PROGRAMS = \
 	test_libvlc_media_list \
 	test_libvlc_media_list_player \
 	test_libvlc_media_player \
+	test_libvlc_meta \
 	$(NULL)
-check_DATA = samples/test.sample
+check_DATA = samples/test.sample samples/meta.sample
 
 TESTS = $(check_PROGRAMS)
 
-DISTCLEANFILES = samples/test.sample
+DISTCLEANFILES = samples/test.sample samples/meta.sample
 
 # Samples server
 SAMPLES_SERVER=http://streams.videolan.org/streams-videolan/reference
@@ -27,6 +28,10 @@ samples/test.sample:
 	mkdir -p `dirname $@`
 	curl $(SAMPLES_SERVER)/avi/Hero-Div3.avi > $@
 
+samples/meta.sample:
+	mkdir -p `dirname $@`
+	curl $(SAMPLES_SERVER)/metadata/id3tag/Wesh-Bonneville.mp3 > $@
+
 CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc`
 
 test_libvlc_core_SOURCES = libvlc/core.c
@@ -49,6 +54,11 @@ test_libvlc_media_player_SOURCES = libvlc/media_player.c
 test_libvlc_media_player_LDADD = $(top_builddir)/src/libvlc-control.la
 test_libvlc_media_player_CFLAGS = $(CFLAGS_tests)
 
+test_libvlc_meta_SOURCES = libvlc/meta.c
+test_libvlc_meta_LDADD = $(top_builddir)/src/libvlc-control.la
+test_libvlc_meta_CFLAGS = $(CFLAGS_tests)
+
+
 FORCE:
 	@echo "Generated source cannot be phony. Go away." >&2
 	@exit 1
diff --git a/test/libvlc/meta.c b/test/libvlc/meta.c
new file mode 100644
index 0000000..bf972ba
--- /dev/null
+++ b/test/libvlc/meta.c
@@ -0,0 +1,66 @@
+/*
+ * meta.c - libvlc smoke test
+ *
+ * $Id$
+ */
+
+/**********************************************************************
+ *  Copyright (C) 2007 Rémi Denis-Courmont.                           *
+ *  This program is free software; you can redistribute and/or modify *
+ *  it under the terms of the GNU General Public License as published *
+ *  by the Free Software Foundation; version 2 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 General Public License for more details.              *
+ *                                                                    *
+ *  You should have received a copy of the GNU General Public License *
+ *  along with this program; if not, you can get it from:             *
+ *  http://www.gnu.org/copyleft/gpl.html                              *
+ **********************************************************************/
+
+#include "test.h"
+
+static void test_meta (const char ** argv, int argc)
+{
+    libvlc_instance_t *vlc;
+    libvlc_media_t *media;
+    char * artist;
+
+    log ("Testing meta\n");
+
+    libvlc_exception_init (&ex);
+    vlc = libvlc_new (argc, argv, &ex);
+    catch ();
+
+    media = libvlc_media_new ( vlc, "samples/meta.sample", &ex);
+
+    /* Tell that we are interested in this precise meta data */
+    artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex );
+    catch ();
+
+    free (artist);
+
+    /* Wait for the meta */
+    while (!libvlc_media_is_preparsed(media, &ex)) { catch (); msleep (10000); }
+
+    artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex );
+    catch ();
+
+    assert (artist);
+
+    free (artist);
+    libvlc_release (vlc);
+}
+
+
+int main (void)
+{
+    test_init();
+
+    test_meta (test_defaults_args, test_defaults_nargs);
+
+    return 0;
+}




More information about the vlc-devel mailing list