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 // We use this image file because "empty.voc" has no track.
37 const char * file
= SRCDIR
"/samples/image.jpg";
39 log ("Testing set_media\n");
41 libvlc_instance_t
*vlc
= libvlc_new (argc
, argv
);
44 libvlc_media_t
*media
= libvlc_media_new_path (vlc
, file
);
45 assert (media
!= NULL
);
47 volatile int received
= false;
49 // Check to see if we are properly receiving the event.
50 libvlc_event_manager_t
*em
= libvlc_media_event_manager (media
);
51 libvlc_event_attach (em
, libvlc_MediaParsedChanged
, preparsed_changed
, (void*)&received
);
53 // Parse the media. This is synchronous.
54 libvlc_media_parse(media
);
56 // Wait to see if we properly receive preparsed.
59 // We are good, now check Elementary Stream info.
60 libvlc_media_track_info_t
*tracks
= NULL
;
61 int num
= libvlc_media_get_tracks_info(media
, &tracks
);
63 #warning libvlc_media_get_tracks_info is a broken function.
67 printf("WARNING: libvlc_media_get_tracks_info is not working.");
72 libvlc_media_release (media
);
80 test_media_preparsed (test_defaults_args
, test_defaults_nargs
);