]> git.sesse.net Git - vlc/blob - include/vlc_vlm.h
Export vlm_MessageNew and vlm_MessageAdd.
[vlc] / include / vlc_vlm.h
1 /*****************************************************************************
2  * vlc_vlm.h: VLM core structures
3  *****************************************************************************
4  * Copyright (C) 2000, 2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Simon Latapie <garf@videolan.org>
8  *          Laurent Aimar <fenrir@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #if !defined( __LIBVLC__ )
26   #error You are not libvlc or one of its plugins. You cannot include this file
27 #endif
28
29 #ifndef _VLC_VLM_H
30 #define _VLC_VLM_H 1
31
32 #ifdef __cpluplus
33 extern "C" {
34 #endif
35
36 #include <vlc_input.h>
37
38 /* VLM specific - structures and functions */
39 enum
40 {
41     VOD_TYPE = 0,
42     BROADCAST_TYPE,
43     SCHEDULE_TYPE,
44 };
45
46 typedef struct
47 {
48     /* instance name */
49     char *psz_name;
50
51     /* "playlist" index */
52     int i_index;
53
54     input_item_t   item;
55     input_thread_t *p_input;
56
57 } vlm_media_instance_t;
58
59 struct vlm_media_t
60 {
61     vlc_bool_t b_enabled;
62     int      i_type;
63
64     /* name "media" is reserved */
65     char    *psz_name;
66     input_item_t item;
67
68     /* "playlist" */
69     int     i_input;
70     char    **input;
71
72     int     i_option;
73     char    **option;
74
75     char    *psz_output;
76
77     /* only for broadcast */
78     vlc_bool_t b_loop;
79
80     /* only for vod */
81     vod_media_t *vod_media;
82     char *psz_vod_output;
83     char *psz_mux;
84
85     /* actual input instances */
86     int                  i_instance;
87     vlm_media_instance_t **instance;
88
89 };
90
91 struct vlm_schedule_t
92 {
93     /* names "schedule" is reserved */
94     char    *psz_name;
95     vlc_bool_t b_enabled;
96     /* list of commands to execute on date */
97     int i_command;
98     char **command;
99
100     /* the date of 1st execution */
101     mtime_t i_date;
102
103     /* if != 0 repeat schedule every (period) */
104     mtime_t i_period;
105     /* number of times you have to repeat
106        i_repeat < 0 : endless repeat     */
107     int i_repeat;
108
109 };
110
111 /* ok, here is the structure of a vlm_message:
112    The parent node is ( name_of_the_command , NULL ), or
113    ( name_of_the_command , message_error ) on error.
114    If a node has children, it should not have a value (=NULL).*/
115 struct vlm_message_t
116 {
117     char *psz_name;
118     char *psz_value;
119
120     int           i_child;
121     vlm_message_t **child;
122 };
123
124
125 struct vlm_t
126 {
127     VLC_COMMON_MEMBERS
128
129     vlc_mutex_t lock;
130
131     int            i_media;
132     vlm_media_t    **media;
133
134     int            i_vod;
135     vod_t          *vod;
136
137     int            i_schedule;
138     vlm_schedule_t **schedule;
139 };
140
141
142 #define vlm_New( a ) __vlm_New( VLC_OBJECT(a) )
143 VLC_EXPORT( vlm_t *, __vlm_New, ( vlc_object_t * ) );
144 VLC_EXPORT( void, vlm_Delete, ( vlm_t * ) );
145 VLC_EXPORT( int, vlm_ExecuteCommand, ( vlm_t *, const char *, vlm_message_t ** ) );
146 VLC_EXPORT( void, vlm_MessageDelete, ( vlm_message_t * ) );
147 VLC_EXPORT( vlm_media_t *, vlm_MediaNew, ( vlm_t *, const char *, int ) );
148 VLC_EXPORT( void, vlm_MediaDelete, ( vlm_t *, vlm_media_t *, const char * ) );
149 VLC_EXPORT( int, vlm_MediaSetup, ( vlm_t *, vlm_media_t *, const char *, const char * ) );
150 VLC_EXPORT( int, vlm_MediaControl, ( vlm_t *, vlm_media_t *, const char *, const char *, const char * ) );
151 VLC_EXPORT( vlm_media_t* , vlm_MediaSearch,( vlm_t *, const char *) );
152 VLC_EXPORT( vlm_schedule_t *, vlm_ScheduleNew, ( vlm_t *, const char * ) );
153 VLC_EXPORT( void, vlm_ScheduleDelete, ( vlm_t *, vlm_schedule_t *, const char * ) );
154 VLC_EXPORT( int, vlm_ScheduleSetup, ( vlm_schedule_t *, const char *, const char * ) );
155 VLC_EXPORT( int, vlm_MediaVodControl, ( void *, vod_media_t *, const char *, int, va_list ) );
156 VLC_EXPORT( int, vlm_Save, ( vlm_t *, const char * ) );
157 VLC_EXPORT( int, vlm_Load, ( vlm_t *, const char * ) );
158
159 VLC_EXPORT( vlm_message_t *, vlm_MessageNew, ( const char *, const char *, ... ) );
160 VLC_EXPORT( vlm_message_t *, vlm_MessageAdd, ( vlm_message_t *, vlm_message_t * ) );
161
162 #ifdef __cpluplus
163 }
164 #endif
165
166 #endif