Commit b66dfd1b authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

test: Test meta data support.

Note, this is done even if no meta data module is compiled. A future commit should fix that.
parent 520ee292
......@@ -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
......
/*
* 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment