]> git.sesse.net Git - vlc/blob - test/libvlc/libvlc_additions.h
4c8fb4cbc4f76e097808c790b47c435564fc2cc5
[vlc] / test / libvlc / libvlc_additions.h
1 /*
2  * libvlc_additions.c - Some helper method that should probably go into libvlc
3  */
4
5 /**********************************************************************
6  *  Copyright (C) 2007 RĂ©mi Denis-Courmont.                           *
7  *  This program is free software; you can redistribute and/or modify *
8  *  it under the terms of the GNU General Public License as published *
9  *  by the Free Software Foundation; version 2 of the license, or (at *
10  *  your option) any later version.                                   *
11  *                                                                    *
12  *  This program is distributed in the hope that it will be useful,   *
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
15  *  See the GNU General Public License for more details.              *
16  *                                                                    *
17  *  You should have received a copy of the GNU General Public License *
18  *  along with this program; if not, you can get it from:             *
19  *  http://www.gnu.org/copyleft/gpl.html                              *
20  **********************************************************************/
21
22 static void* media_list_add_file_path(libvlc_instance_t *vlc, libvlc_media_list_t *ml, const char * file_path)
23 {
24     libvlc_media_t *md = libvlc_media_new (vlc, file_path, &ex);
25     catch ();
26     
27     libvlc_media_list_add_media (ml, md, &ex);
28     catch ();
29     
30     libvlc_media_release (md);
31     return md;
32 }
33
34 static libvlc_media_list_player_t *media_list_player_with_root_media(libvlc_instance_t *vlc, libvlc_media_t *m)
35 {
36     libvlc_media_list_t *ml;
37     libvlc_media_list_player_t *mlp;
38     
39     libvlc_exception_init (&ex);
40     
41     ml = libvlc_media_list_new (vlc, &ex);
42     catch ();
43     
44     mlp = libvlc_media_list_player_new (vlc, &ex);
45     
46     libvlc_media_list_add_media(ml, m, &ex);
47     catch ();
48     
49     libvlc_media_list_player_set_media_list(mlp, ml, &ex);
50     catch ();
51     
52     return mlp;
53 }
54