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_INPUT_ITEM_H
00026 #define VLC_INPUT_ITEM_H 1
00027
00028
00029
00030
00031
00032
00033 #include <vlc_meta.h>
00034 #include <vlc_epg.h>
00035 #include <vlc_events.h>
00036
00037 #include <string.h>
00038
00039
00040
00041
00042 struct info_t
00043 {
00044 char *psz_name;
00045 char *psz_value;
00046 };
00047
00048 struct info_category_t
00049 {
00050 char *psz_name;
00051 int i_infos;
00052 struct info_t **pp_infos;
00053 };
00054
00055 struct input_item_t
00056 {
00057 VLC_GC_MEMBERS
00058 int i_id;
00059
00060 char *psz_name;
00061 char *psz_uri;
00062
00063 int i_options;
00064 char **ppsz_options;
00065 uint8_t *optflagv;
00066 unsigned optflagc;
00067
00068 mtime_t i_duration;
00069
00070
00071 int i_categories;
00072 info_category_t **pp_categories;
00073
00074 int i_es;
00075 es_format_t **es;
00076
00077 input_stats_t *p_stats;
00078 int i_nb_played;
00079
00080 vlc_meta_t *p_meta;
00081
00082 int i_epg;
00083 vlc_epg_t **pp_epg;
00084
00085 vlc_event_manager_t event_manager;
00086
00087 vlc_mutex_t lock;
00088
00089 uint8_t i_type;
00090 bool b_fixed_name;
00091 bool b_error_when_reading;
00092 };
00093
00094 enum input_item_type_e
00095 {
00096 ITEM_TYPE_UNKNOWN,
00097 ITEM_TYPE_FILE,
00098 ITEM_TYPE_DIRECTORY,
00099 ITEM_TYPE_DISC,
00100 ITEM_TYPE_CDDA,
00101 ITEM_TYPE_CARD,
00102 ITEM_TYPE_NET,
00103 ITEM_TYPE_PLAYLIST,
00104 ITEM_TYPE_NODE,
00105
00106
00107 ITEM_TYPE_NUMBER
00108 };
00109
00110 struct input_item_node_t
00111 {
00112 input_item_t * p_item;
00113 int i_children;
00114 input_item_node_t **pp_children;
00115 input_item_node_t *p_parent;
00116 };
00117
00118 VLC_API void input_item_CopyOptions( input_item_t *p_parent, input_item_t *p_child );
00119 VLC_API void input_item_SetName( input_item_t *p_item, const char *psz_name );
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 VLC_API void input_item_PostSubItem( input_item_t *p_parent, input_item_t *p_child );
00132
00133
00134
00135
00136
00137
00138 VLC_API input_item_node_t * input_item_node_Create( input_item_t *p_input ) VLC_USED;
00139
00140
00141
00142
00143 VLC_API input_item_node_t * input_item_node_AppendItem( input_item_node_t *p_node, input_item_t *p_item );
00144
00145
00146
00147
00148 VLC_API void input_item_node_AppendNode( input_item_node_t *p_parent, input_item_node_t *p_child );
00149
00150
00151
00152
00153 VLC_API void input_item_node_Delete( input_item_node_t *p_node );
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 VLC_API void input_item_node_PostAndDelete( input_item_node_t *p_node );
00167
00168
00169
00170
00171
00172 enum input_item_option_e
00173 {
00174
00175
00176 VLC_INPUT_OPTION_TRUSTED = 0x2,
00177
00178
00179
00180 VLC_INPUT_OPTION_UNIQUE = 0x100,
00181 };
00182
00183
00184
00185
00186 VLC_API int input_item_AddOption(input_item_t *, const char *, unsigned i_flags );
00187
00188
00189 VLC_API bool input_item_HasErrorWhenReading( input_item_t * );
00190 VLC_API void input_item_SetMeta( input_item_t *, vlc_meta_type_t meta_type, const char *psz_val );
00191 VLC_API bool input_item_MetaMatch( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz );
00192 VLC_API char * input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type ) VLC_USED;
00193 VLC_API char * input_item_GetName( input_item_t * p_i ) VLC_USED;
00194 VLC_API char * input_item_GetTitleFbName( input_item_t * p_i ) VLC_USED;
00195 VLC_API char * input_item_GetURI( input_item_t * p_i ) VLC_USED;
00196 VLC_API void input_item_SetURI( input_item_t * p_i, const char *psz_uri );
00197 VLC_API mtime_t input_item_GetDuration( input_item_t * p_i );
00198 VLC_API void input_item_SetDuration( input_item_t * p_i, mtime_t i_duration );
00199 VLC_API bool input_item_IsPreparsed( input_item_t *p_i );
00200 VLC_API bool input_item_IsArtFetched( input_item_t *p_i );
00201
00202 #define INPUT_META( name ) \
00203 static inline \
00204 void input_item_Set ## name (input_item_t *p_input, const char *val) \
00205 { \
00206 input_item_SetMeta (p_input, vlc_meta_ ## name, val); \
00207 } \
00208 static inline \
00209 char *input_item_Get ## name (input_item_t *p_input) \
00210 { \
00211 return input_item_GetMeta (p_input, vlc_meta_ ## name); \
00212 }
00213
00214 INPUT_META(Title)
00215 INPUT_META(Artist)
00216 INPUT_META(Genre)
00217 INPUT_META(Copyright)
00218 INPUT_META(Album)
00219 INPUT_META(TrackNumber)
00220 INPUT_META(Description)
00221 INPUT_META(Rating)
00222 INPUT_META(Date)
00223 INPUT_META(Setting)
00224 INPUT_META(URL)
00225 INPUT_META(Language)
00226 INPUT_META(NowPlaying)
00227 INPUT_META(Publisher)
00228 INPUT_META(EncodedBy)
00229 INPUT_META(ArtworkURL)
00230 INPUT_META(TrackID)
00231
00232 #define input_item_SetTrackNum input_item_SetTrackNumber
00233 #define input_item_GetTrackNum input_item_GetTrackNumber
00234 #define input_item_SetArtURL input_item_SetArtworkURL
00235 #define input_item_GetArtURL input_item_GetArtworkURL
00236
00237 VLC_API char * input_item_GetInfo( input_item_t *p_i, const char *psz_cat,const char *psz_name ) VLC_USED;
00238 VLC_API int input_item_AddInfo( input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, ... ) VLC_FORMAT( 4, 5 );
00239 VLC_API int input_item_DelInfo( input_item_t *p_i, const char *psz_cat, const char *psz_name );
00240 VLC_API void input_item_ReplaceInfos( input_item_t *, info_category_t * );
00241 VLC_API void input_item_MergeInfos( input_item_t *, info_category_t * );
00242
00243
00244
00245
00246
00247
00248
00249 VLC_API input_item_t * input_item_NewWithType( const char *psz_uri, const char *psz_name, int i_options, const char *const *ppsz_options, unsigned i_option_flags, mtime_t i_duration, int i_type ) VLC_USED;
00250
00251
00252
00253
00254
00255
00256 VLC_API input_item_t * input_item_NewExt( const char *psz_uri, const char *psz_name, int i_options, const char *const *ppsz_options, unsigned i_option_flags, mtime_t i_duration ) VLC_USED;
00257
00258
00259
00260
00261
00262
00263 #define input_item_New( a,b ) input_item_NewExt( a, b, 0, NULL, 0, -1 )
00264
00265
00266
00267
00268 VLC_API input_item_t * input_item_Copy(input_item_t * ) VLC_USED;
00269
00270
00271
00272
00273
00274 struct input_stats_t
00275 {
00276 vlc_mutex_t lock;
00277
00278
00279 int64_t i_read_packets;
00280 int64_t i_read_bytes;
00281 float f_input_bitrate;
00282 float f_average_input_bitrate;
00283
00284
00285 int64_t i_demux_read_packets;
00286 int64_t i_demux_read_bytes;
00287 float f_demux_bitrate;
00288 float f_average_demux_bitrate;
00289 int64_t i_demux_corrupted;
00290 int64_t i_demux_discontinuity;
00291
00292
00293 int64_t i_decoded_audio;
00294 int64_t i_decoded_video;
00295
00296
00297 int64_t i_displayed_pictures;
00298 int64_t i_lost_pictures;
00299
00300
00301 int64_t i_sent_packets;
00302 int64_t i_sent_bytes;
00303 float f_send_bitrate;
00304
00305
00306 int64_t i_played_abuffers;
00307 int64_t i_lost_abuffers;
00308 };
00309
00310 #endif