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 #define vlm_New( a ) __vlm_New( VLC_OBJECT(a) )
00188 VLC_EXPORT( vlm_t *, __vlm_New, ( vlc_object_t * ) );
00189 VLC_EXPORT( void, vlm_Delete, ( vlm_t * ) );
00190 VLC_EXPORT( int, vlm_ExecuteCommand, ( vlm_t *, const char *, vlm_message_t ** ) );
00191 VLC_EXPORT( int, vlm_Control, ( vlm_t *p_vlm, int i_query, ... ) );
00192
00193 VLC_EXPORT( vlm_message_t *, vlm_MessageSimpleNew, ( const char * ) );
00194 VLC_EXPORT( vlm_message_t *, vlm_MessageNew, ( const char *, const char *, ... ) LIBVLC_FORMAT( 2, 3 ) );
00195 VLC_EXPORT( vlm_message_t *, vlm_MessageAdd, ( vlm_message_t *, vlm_message_t * ) );
00196 VLC_EXPORT( 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 vlm_media_Copy( vlm_media_t *p_dst, vlm_media_t *p_src )
00224 {
00225 int i;
00226
00227 memset( p_dst, 0, sizeof(vlm_media_t) );
00228 p_dst->id = p_src->id;
00229 p_dst->b_enabled = p_src->b_enabled;
00230 if( p_src->psz_name )
00231 p_dst->psz_name = strdup( p_src->psz_name );
00232
00233 for( i = 0; i < p_src->i_input; i++ )
00234 TAB_APPEND_CPP( char, p_dst->i_input, p_dst->ppsz_input, strdup(p_src->ppsz_input[i]) );
00235 for( i = 0; i < p_src->i_option; i++ )
00236 TAB_APPEND_CPP( char, p_dst->i_option, p_dst->ppsz_option, strdup(p_src->ppsz_option[i]) );
00237
00238 if( p_src->psz_output )
00239 p_dst->psz_output = strdup( p_src->psz_output );
00240
00241 p_dst->b_vod = p_src->b_vod;
00242 if( p_src->b_vod )
00243 {
00244 if( p_src->vod.psz_mux )
00245 p_dst->vod.psz_mux = strdup( p_src->vod.psz_mux );
00246 }
00247 else
00248 {
00249 p_dst->broadcast.b_loop = p_src->broadcast.b_loop;
00250 }
00251 }
00252
00253
00254
00255
00256
00257
00258 static inline void vlm_media_Clean( vlm_media_t *p_media )
00259 {
00260 int i;
00261 free( p_media->psz_name );
00262
00263 for( i = 0; i < p_media->i_input; i++ )
00264 free( p_media->ppsz_input[i]) ;
00265 TAB_CLEAN(p_media->i_input, p_media->ppsz_input );
00266
00267 for( i = 0; i < p_media->i_option; i++ )
00268 free( p_media->ppsz_option[i]) ;
00269 TAB_CLEAN(p_media->i_option, p_media->ppsz_option );
00270
00271 free( p_media->psz_output );
00272 if( p_media->b_vod )
00273 free( p_media->vod.psz_mux );
00274 }
00275
00276
00277
00278
00279
00280 static inline vlm_media_t *vlm_media_New(void)
00281 {
00282 vlm_media_t *p_media = (vlm_media_t *)malloc( sizeof(vlm_media_t) );
00283 if( p_media )
00284 vlm_media_Init( p_media );
00285 return p_media;
00286 }
00287
00288
00289
00290
00291
00292 static inline void vlm_media_Delete( vlm_media_t *p_media )
00293 {
00294 vlm_media_Clean( p_media );
00295 free( p_media );
00296 }
00297
00298
00299
00300
00301
00302
00303 static inline vlm_media_t *vlm_media_Duplicate( vlm_media_t *p_src )
00304 {
00305 vlm_media_t *p_dst = vlm_media_New();
00306 if( p_dst )
00307 vlm_media_Copy( p_dst, p_src );
00308 return p_dst;
00309 }
00310
00311
00312
00313
00314
00315
00316 static inline void vlm_media_instance_Init( vlm_media_instance_t *p_instance )
00317 {
00318 memset( p_instance, 0, sizeof(vlm_media_instance_t) );
00319 p_instance->psz_name = NULL;
00320 p_instance->i_time = 0;
00321 p_instance->i_length = 0;
00322 p_instance->d_position = 0.0;
00323 p_instance->b_paused = false;
00324 p_instance->i_rate = INPUT_RATE_DEFAULT;
00325 }
00326
00327
00328
00329
00330
00331 static inline void vlm_media_instance_Clean( vlm_media_instance_t *p_instance )
00332 {
00333 free( p_instance->psz_name );
00334 }
00335
00336
00337
00338
00339
00340 static inline vlm_media_instance_t *vlm_media_instance_New(void)
00341 {
00342 vlm_media_instance_t *p_instance = (vlm_media_instance_t *) malloc( sizeof(vlm_media_instance_t) );
00343 if( p_instance )
00344 vlm_media_instance_Init( p_instance );
00345 return p_instance;
00346 }
00347
00348
00349
00350
00351
00352 static inline void vlm_media_instance_Delete( vlm_media_instance_t *p_instance )
00353 {
00354 vlm_media_instance_Clean( p_instance );
00355 free( p_instance );
00356 }
00357
00358 #ifdef __cpluplus
00359 }
00360 #endif
00361
00362
00363
00364 #endif