avcodec: dxtory support arrived a bit later in ffmpeg than in libav...
[vlc/solaris.git] / test / libvlc / media.c
blobe66095e52b02bfadc80037eb3305c3df073bcd62
1 /*
2 * media_player.c - libvlc smoke test
4 * $Id$
5 */
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. *
13 * *
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. *
18 * *
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 **********************************************************************/
24 #include "test.h"
26 static void preparsed_changed(const libvlc_event_t *event, void *user_data)
28 (void)event;
30 int *received = user_data;
31 *received = true;
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);
42 assert (vlc != NULL);
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.
57 while (!received);
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.
64 // This is broken.
65 // assert(num == 1);
66 if (num != 1)
67 printf("WARNING: libvlc_media_get_tracks_info is not working.");
69 if (num > 0)
70 free(tracks);
72 libvlc_media_release (media);
73 libvlc_release (vlc);
76 int main (void)
78 test_init();
80 test_media_preparsed (test_defaults_args, test_defaults_nargs);
82 return 0;