00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef VLC_VLM_H
00026 #define VLC_VLM_H 1
00027
00028
00029
00030
00031
00032
00033 #include <vlc_input.h>
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 typedef struct
00045 {
00046 int64_t id;
00047 bool b_enabled;
00048
00049 char *psz_name;
00050
00051 int i_input;
00052 char **ppsz_input;
00053
00054 int i_option;
00055 char **ppsz_option;
00056
00057 char *psz_output;
00058
00059 bool b_vod;
00060 struct
00061 {
00062 bool b_loop;
00063 } broadcast;
00064 struct
00065 {
00066 char *psz_mux;
00067 } vod;
00068
00069 } vlm_media_t;
00070
00071
00072 typedef struct
00073 {
00074 char *psz_name;
00075
00076 int64_t i_time;
00077 int64_t i_length;
00078 double d_position;
00079 bool b_paused;
00080 int i_rate;
00081 } vlm_media_instance_t;
00082
00083 #if 0
00084 typedef struct
00085 {
00086
00087 } vlm_schedule_t
00088 #endif
00089
00090
00091
00092
00093
00094
00095 enum vlm_event_type_e
00096 {
00097
00098 VLM_EVENT_MEDIA_ADDED = 0x100,
00099 VLM_EVENT_MEDIA_REMOVED,
00100 VLM_EVENT_MEDIA_CHANGED,
00101
00102
00103 VLM_EVENT_MEDIA_INSTANCE_STARTED = 0x200,
00104 VLM_EVENT_MEDIA_INSTANCE_STOPPED,
00105 VLM_EVENT_MEDIA_INSTANCE_STATE,
00106 };
00107
00108 typedef struct
00109 {
00110 int i_type;
00111 int64_t id;
00112 const char *psz_name;
00113 const char *psz_instance_name;
00114 input_state_e input_state;
00115 } vlm_event_t;
00116
00117
00118 enum vlm_query_e
00119 {
00120
00121
00122 VLM_GET_MEDIAS,
00123
00124 VLM_CLEAR_MEDIAS,
00125
00126
00127 VLM_ADD_MEDIA,
00128
00129 VLM_DEL_MEDIA,
00130
00131 VLM_CHANGE_MEDIA,
00132
00133 VLM_GET_MEDIA,
00134
00135 VLM_GET_MEDIA_ID,
00136
00137
00138
00139 VLM_GET_MEDIA_INSTANCES,
00140
00141 VLM_CLEAR_MEDIA_INSTANCES,
00142
00143 VLM_START_MEDIA_BROADCAST_INSTANCE,
00144
00145 VLM_START_MEDIA_VOD_INSTANCE,
00146
00147 VLM_STOP_MEDIA_INSTANCE,
00148
00149 VLM_PAUSE_MEDIA_INSTANCE,
00150
00151 VLM_GET_MEDIA_INSTANCE_TIME,
00152
00153 VLM_SET_MEDIA_INSTANCE_TIME,
00154
00155 VLM_GET_MEDIA_INSTANCE_POSITION,
00156
00157 VLM_SET_MEDIA_INSTANCE_POSITION,
00158
00159
00160 VLM_CLEAR_SCHEDULES,
00161
00162
00163
00164 };
00165
00166
00167
00168
00169
00170
00171
00172
00173 struct vlm_message_t
00174 {
00175 char *psz_name;
00176 char *psz_value;
00177
00178 int i_child;
00179 vlm_message_t **child;
00180 };
00181
00182
00183 #ifdef __cpluplus
00184 extern "C" {
00185 #endif
00186
00187 VLC_API vlm_t * vlm_New( vlc_object_t * );
00188 #define vlm_New( a ) vlm_New( VLC_OBJECT(a) )
00189 VLC_API void vlm_Delete( vlm_t * );
00190 VLC_API int vlm_ExecuteCommand( vlm_t *, const char *, vlm_message_t ** );
00191 VLC_API int vlm_Control( vlm_t *p_vlm, int i_query, ... );
00192
00193 VLC_API vlm_message_t * vlm_MessageSimpleNew( const char * );
00194 VLC_API vlm_message_t * vlm_MessageNew( const char *, const char *, ... ) VLC_FORMAT( 2, 3 );
00195 VLC_API vlm_message_t * vlm_MessageAdd( vlm_message_t *, vlm_message_t * );
00196 VLC_API void vlm_MessageDelete( vlm_message_t * );
00197
00198
00199
00200
00201
00202
00203
00204 static inline void vlm_media_Init( vlm_media_t *p_media )
00205 {
00206 memset( p_media, 0, sizeof(vlm_media_t) );
00207 p_media->id = 0;
00208 p_media->psz_name = NULL;
00209 TAB_INIT( p_media->i_input, p_media->ppsz_input );
00210 TAB_INIT( p_media->i_option, p_media->ppsz_option );
00211 p_media->psz_output = NULL;
00212 p_media->b_vod = false;
00213
00214 p_media->vod.psz_mux = NULL;
00215 p_media->broadcast.b_loop = false;
00216 }
00217
00218
00219
00220
00221
00222
00223 static inline void
00224 #ifndef __cplusplus
00225 vlm_media_Copy( vlm_media_t *restrict p_dst, const vlm_media_t *restrict p_src )
00226 #else
00227 vlm_media_Copy( vlm_media_t *p_dst, const vlm_media_t *p_src )
00228 #endif
00229 {
00230 int i;
00231
00232 memset( p_dst, 0, sizeof(vlm_media_t) );
00233 p_dst->id = p_src->id;
00234 p_dst->b_enabled = p_src->b_enabled;
00235 if( p_src->psz_name )
00236 p_dst->psz_name = strdup( p_src->psz_name );
00237
00238 for( i = 0; i < p_src->i_input; i++ )
00239 TAB_APPEND_CAST( (char**), p_dst->i_input, p_dst->ppsz_input, strdup(p_src->ppsz_input[i]) );
00240 for( i = 0; i < p_src->i_option; i++ )
00241 TAB_APPEND_CAST( (char**), p_dst->i_option, p_dst->ppsz_option, strdup(p_src->ppsz_option[i]) );
00242
00243 if( p_src->psz_output )
00244 p_dst->psz_output = strdup( p_src->psz_output );
00245
00246 p_dst->b_vod = p_src->b_vod;
00247 if( p_src->b_vod )
00248 {
00249 if( p_src->vod.psz_mux )
00250 p_dst->vod.psz_mux = strdup( p_src->vod.psz_mux );
00251 }
00252 else
00253 {
00254 p_dst->broadcast.b_loop = p_src->broadcast.b_loop;
00255 }
00256 }
00257
00258
00259
00260
00261
00262
00263 static inline void vlm_media_Clean( vlm_media_t *p_media )
00264 {
00265 int i;
00266 free( p_media->psz_name );
00267
00268 for( i = 0; i < p_media->i_input; i++ )
00269 free( p_media->ppsz_input[i]);
00270 TAB_CLEAN(p_media->i_input, p_media->ppsz_input );
00271
00272 for( i = 0; i < p_media->i_option; i++ )
00273 free( p_media->ppsz_option[i]);
00274 TAB_CLEAN(p_media->i_option, p_media->ppsz_option );
00275
00276 free( p_media->psz_output );
00277 if( p_media->b_vod )
00278 free( p_media->vod.psz_mux );
00279 }
00280
00281
00282
00283
00284
00285 static inline vlm_media_t *vlm_media_New(void)
00286 {
00287 vlm_media_t *p_media = (vlm_media_t *)malloc( sizeof(vlm_media_t) );
00288 if( p_media )
00289 vlm_media_Init( p_media );
00290 return p_media;
00291 }
00292
00293
00294
00295
00296
00297 static inline void vlm_media_Delete( vlm_media_t *p_media )
00298 {
00299 vlm_media_Clean( p_media );
00300 free( p_media );
00301 }
00302
00303
00304
00305
00306
00307
00308 static inline vlm_media_t *vlm_media_Duplicate( vlm_media_t *p_src )
00309 {
00310 vlm_media_t *p_dst = vlm_media_New();
00311 if( p_dst )
00312 vlm_media_Copy( p_dst, p_src );
00313 return p_dst;
00314 }
00315
00316
00317
00318
00319
00320
00321 static inline void vlm_media_instance_Init( vlm_media_instance_t *p_instance )
00322 {
00323 memset( p_instance, 0, sizeof(vlm_media_instance_t) );
00324 p_instance->psz_name = NULL;
00325 p_instance->i_time = 0;
00326 p_instance->i_length = 0;
00327 p_instance->d_position = 0.0;
00328 p_instance->b_paused = false;
00329 p_instance->i_rate = INPUT_RATE_DEFAULT;
00330 }
00331
00332
00333
00334
00335
00336 static inline void vlm_media_instance_Clean( vlm_media_instance_t *p_instance )
00337 {
00338 free( p_instance->psz_name );
00339 }
00340
00341
00342
00343
00344
00345 static inline vlm_media_instance_t *vlm_media_instance_New(void)
00346 {
00347 vlm_media_instance_t *p_instance = (vlm_media_instance_t *) malloc( sizeof(vlm_media_instance_t) );
00348 if( p_instance )
00349 vlm_media_instance_Init( p_instance );
00350 return p_instance;
00351 }
00352
00353
00354
00355
00356
00357 static inline void vlm_media_instance_Delete( vlm_media_instance_t *p_instance )
00358 {
00359 vlm_media_instance_Clean( p_instance );
00360 free( p_instance );
00361 }
00362
00363 #ifdef __cpluplus
00364 }
00365 #endif
00366
00367
00368
00369 #endif