]> git.sesse.net Git - vlc/blob - test/libvlc/meta.c
test: Test meta data support.
[vlc] / test / libvlc / meta.c
1 /*
2  * meta.c - libvlc smoke test
3  *
4  * $Id$
5  */
6
7 /**********************************************************************
8  *  Copyright (C) 2007 RĂ©mi Denis-Courmont.                           *
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  **********************************************************************/
23
24 #include "test.h"
25
26 static void test_meta (const char ** argv, int argc)
27 {
28     libvlc_instance_t *vlc;
29     libvlc_media_t *media;
30     char * artist;
31
32     log ("Testing meta\n");
33
34     libvlc_exception_init (&ex);
35     vlc = libvlc_new (argc, argv, &ex);
36     catch ();
37
38     media = libvlc_media_new ( vlc, "samples/meta.sample", &ex);
39
40     /* Tell that we are interested in this precise meta data */
41     artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex );
42     catch ();
43
44     free (artist);
45
46     /* Wait for the meta */
47     while (!libvlc_media_is_preparsed(media, &ex)) { catch (); msleep (10000); }
48
49     artist = libvlc_media_get_meta( media, libvlc_meta_Artist, &ex );
50     catch ();
51
52     assert (artist);
53
54     free (artist);
55     libvlc_release (vlc);
56 }
57
58
59 int main (void)
60 {
61     test_init();
62
63     test_meta (test_defaults_args, test_defaults_nargs);
64
65     return 0;
66 }