2 * media_player.c - libvlc smoke test
7 /**********************************************************************
8 * Copyright (C) 2010 Pierre d'Herbemont. *
9 * This program is free software; you can redistribute and/or modify *
10 * it under the terms of the GNU General Public License as published *
11 * by the Free Software Foundation; version 2 of the license, or (at *
12 * your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
17 * See the GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, you can get it from: *
21 * http://www.gnu.org/copyleft/gpl.html *
22 **********************************************************************/
26 static void preparsed_changed(const libvlc_event_t *event, void *user_data)
30 int *received = user_data;
34 static void test_media_preparsed(const char** argv, int argc)
36 const char * file = test_default_sample;
38 log ("Testing set_media\n");
40 libvlc_instance_t *vlc = libvlc_new (argc, argv);
43 libvlc_media_t *media = libvlc_media_new_path (vlc, file);
44 assert (media != NULL);
46 volatile int received = false;
48 // Check to see if we are properly receiving the event.
49 libvlc_event_manager_t *em = libvlc_media_event_manager (media);
50 libvlc_event_attach (em, libvlc_MediaPreparsedChanged, preparsed_changed, &received);
52 // Parse the media. This is synchronous.
53 libvlc_media_parse(media);
55 // Wait to see if we properly receive preparsed.
58 // We are good, now check Elementary Stream info.
59 libvlc_media_es_t *es;
60 int num = libvlc_media_get_es(media, &es);
64 libvlc_media_release (media);
72 test_media_preparsed (test_defaults_args, test_defaults_nargs);