]> git.sesse.net Git - vlc/blobdiff - test/libvlc/meta.c
Qt: extended panels, code simplification and spatializer slider naming
[vlc] / test / libvlc / meta.c
index edbd1800bd414be53abfd36110f12c7e42499657..aa29c98406f8444de7a3c6d3a59b621fd9e4ed1a 100644 (file)
@@ -5,6 +5,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 *
@@ -21,6 +22,8 @@
  *  http://www.gnu.org/copyleft/gpl.html                              *
  **********************************************************************/
 
+#include <string.h>
+
 #include "test.h"
 
 static void test_meta (const char ** argv, int argc)
@@ -31,28 +34,23 @@ static void test_meta (const char ** argv, int argc)
 
     log ("Testing meta\n");
 
-    libvlc_exception_init (&ex);
-    vlc = libvlc_new (argc, argv, &ex);
-    catch ();
-
-    media = libvlc_media_new (vlc, "samples/meta.sample", &ex);
-    catch ();
+    vlc = libvlc_new (argc, argv);
+    assert (vlc != NULL);
 
-    /* Tell that we are interested in this precise meta data */
-    artist = libvlc_media_get_meta (media, libvlc_meta_Artist, &ex);
-    catch ();
+    media = libvlc_media_new_path (vlc, "samples/meta.sample");
+    assert( media );
 
-    free (artist);
+    libvlc_media_parse (media);
 
-    /* Wait for the meta */
-    while (!libvlc_media_is_preparsed (media, &ex)) { catch (); msleep (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 && !strncmp (artist, "mike"));
+    assert (artist);
+    log ("+ got '%s' as Artist, expecting %s\n", artist, expected_artist);
 
-    log ("+ got '%s' as Artist\n", artist);
+    int string_compare = strcmp (artist, expected_artist);
+    assert (!string_compare);
 
     free (artist);
     libvlc_media_release (media);