]> git.sesse.net Git - vlc/commitdiff
test: Update libvlc_media test.
authorPierre d'Herbemont <pdherbemont@free.fr>
Mon, 22 Feb 2010 16:37:39 +0000 (17:37 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Mon, 22 Feb 2010 17:19:30 +0000 (18:19 +0100)
test/libvlc/media.c

index 19d14025dd5d1662390cb358072a37210cf03551..5ac5ec6a90fd0d61e58a051ff24905e0db307ffc 100644 (file)
@@ -43,21 +43,21 @@ static void test_media_preparsed(const char** argv, int argc)
     libvlc_media_t *media = libvlc_media_new_path (vlc, file);
     assert (media != NULL);
 
-    int received = false;
-
-    // Force preparsing. FIXME - Expose a better API for that.
-    libvlc_media_es_t *es;
-    int num = libvlc_media_get_es(media, &es);
-    free(es);
+    volatile int received = false;
 
+    // Check to see if we are properly receiving the event.
     libvlc_event_manager_t *em = libvlc_media_event_manager (media);
     libvlc_event_attach (em, libvlc_MediaPreparsedChanged, preparsed_changed, &received);
 
+    // Parse the media. This is synchronous.
+    libvlc_media_parse(media);
+
     // Wait to see if we properly receive preparsed.
     while (!received);
 
     // We are good, now check Elementary Stream info.
-    num = libvlc_media_get_es(media, &es);
+    libvlc_media_es_t *es;
+    int num = libvlc_media_get_es(media, &es);
     assert(num > 0);
     free(es);