]> git.sesse.net Git - vlc/blob - test/libvlc/meta.c
prune is too strong ...
[vlc] / test / libvlc / meta.c
1 /*
2  * meta.c - libvlc smoke test
3  *
4  * $Id$
5  */
6
7 /**********************************************************************
8  *  Copyright (C) 2008 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  **********************************************************************/
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     catch ();
40
41     /* Tell that we are interested in this precise meta data */
42     artist = libvlc_media_get_meta (media, libvlc_meta_Artist, &ex);
43     catch ();
44
45     free (artist);
46
47     /* Wait for the meta */
48     while (!libvlc_media_is_preparsed (media, &ex)) { catch (); msleep (10000); }
49
50     artist = libvlc_media_get_meta (media, libvlc_meta_Artist, &ex);
51     catch ();
52
53     assert (artist && !strncmp (artist, "mike"), 4);
54
55     log ("+ got '%s' as Artist\n", artist);
56
57     free (artist);
58     libvlc_media_release (media);
59     libvlc_release (vlc);
60 }
61
62
63 int main (void)
64 {
65     test_init();
66
67     test_meta (test_defaults_args, test_defaults_nargs);
68
69     return 0;
70 }