diff --git a/test/Makefile.am b/test/Makefile.am index da99f73b7c023631784eb6a7b408dd585fd89ee3..847be09c1548bb03b0b4024d756094f12f190b9d 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 0000000000000000000000000000000000000000..bf972ba06f60bfe5a5e6db1dceccaf34e5365baa --- /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; +}