X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=test%2Flibvlc%2Fmeta.c;h=690578d7ae33b485392a594534320aa773ea788b;hb=fcd847ecef19c10fec38ab510f3133af9bf0aee9;hp=882a57ff5ff5654c8509bd4eb073ea4f56ac0d69;hpb=d549f9b30d2749e2a5ba7e0479d7642f3f42d031;p=vlc diff --git a/test/libvlc/meta.c b/test/libvlc/meta.c index 882a57ff5f..690578d7ae 100644 --- a/test/libvlc/meta.c +++ b/test/libvlc/meta.c @@ -6,6 +6,7 @@ /********************************************************************** * Copyright (C) 2007 Rémi Denis-Courmont. * + * Copyright (C) 2008 Pierre d'Herbemont. * * 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 * @@ -21,6 +22,8 @@ * http://www.gnu.org/copyleft/gpl.html * **********************************************************************/ +#include + #include "test.h" static void test_meta (const char ** argv, int argc) @@ -31,25 +34,34 @@ static void test_meta (const char ** argv, int argc) log ("Testing meta\n"); - libvlc_exception_init (&ex); - vlc = libvlc_new (argc, argv, &ex); - catch (); + vlc = libvlc_new (argc, argv); + assert (vlc != NULL); - media = libvlc_media_new ( vlc, "samples/meta.sample", &ex); + media = libvlc_media_new_path (vlc, "samples/meta.sample"); + assert( media ); - /* Tell that we are interested in this precise meta data */ - artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex ); - catch (); + /* Tell that we are interested in this precise meta data + * This is needed to trigger meta data reading + * (the first calls return NULL) */ + artist = libvlc_media_get_meta (media, libvlc_meta_Artist); free (artist); /* Wait for the meta */ - while (!libvlc_media_is_preparsed(media, &ex)) { catch (); msleep (10000); } + while (!libvlc_media_is_preparsed (media)) + { + usleep (10000); + } + + artist = libvlc_media_get_meta (media, libvlc_meta_Artist); - artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex ); - catch (); + const char *expected_artist = "mike"; assert (artist); + log ("+ got '%s' as Artist, expecting %s\n", artist, expected_artist); + + int string_compare = strcmp (artist, expected_artist); + assert (!string_compare); free (artist); libvlc_media_release (media);