QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vlc_input_item.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_input_item.h: Core input item
3  *****************************************************************************
4  * Copyright (C) 1999-2009 VLC authors and VideoLAN
5  * $Id: 0f9800da4dd2cd7febdca74b4787054d6baa5dee $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  * Laurent Aimar <fenrir@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24 
25 #ifndef VLC_INPUT_ITEM_H
26 #define VLC_INPUT_ITEM_H 1
27 
33 #include <vlc_meta.h>
34 #include <vlc_epg.h>
35 #include <vlc_events.h>
36 
37 #include <string.h>
38 
39 /*****************************************************************************
40  * input_item_t: Describes an input and is used to spawn input_thread_t objects
41  *****************************************************************************/
42 struct info_t
43 {
44  char *psz_name;
45  char *psz_value;
46 };
47 
49 {
50  char *psz_name;
51  int i_infos;
52  struct info_t **pp_infos;
53 };
54 
56 {
57  int i_id;
59  char *psz_name;
60  char *psz_uri;
62  int i_options;
63  char **ppsz_options;
64  uint8_t *optflagv;
65  unsigned optflagc;
66 
73  int i_es;
79  vlc_meta_t *p_meta;
80 
81  int i_epg;
84  vlc_event_manager_t event_manager;
85 
86  vlc_mutex_t lock;
88  uint8_t i_type;
89  bool b_fixed_name;
91 };
92 
93 enum input_item_type_e
94 {
95  ITEM_TYPE_UNKNOWN,
96  ITEM_TYPE_FILE,
97  ITEM_TYPE_DIRECTORY,
98  ITEM_TYPE_DISC,
99  ITEM_TYPE_CDDA,
100  ITEM_TYPE_CARD,
101  ITEM_TYPE_NET,
102  ITEM_TYPE_PLAYLIST,
103  ITEM_TYPE_NODE,
104 
105  /* This one is not a real type but the number of input_item types. */
106  ITEM_TYPE_NUMBER
107 };
108 
110 {
111  input_item_t * p_item;
112  int i_children;
113  input_item_node_t **pp_children;
114  input_item_node_t *p_parent;
115 };
116 
117 VLC_API void input_item_CopyOptions( input_item_t *p_parent, input_item_t *p_child );
118 VLC_API void input_item_SetName( input_item_t *p_item, const char *psz_name );
119 
130 VLC_API void input_item_PostSubItem( input_item_t *p_parent, input_item_t *p_child );
131 
137 VLC_API input_item_node_t * input_item_node_Create( input_item_t *p_input ) VLC_USED;
138 
143 
147 VLC_API void input_item_node_AppendNode( input_item_node_t *p_parent, input_item_node_t *p_child );
148 
152 VLC_API void input_item_node_Delete( input_item_node_t *p_node );
153 
165 VLC_API void input_item_node_PostAndDelete( input_item_node_t *p_node );
166 
167 
172 {
173  /* Allow VLC to trust the given option.
174  * By default options are untrusted */
175  VLC_INPUT_OPTION_TRUSTED = 0x2,
176 
177  /* Change the value associated to an option if already present, otherwise
178  * add the option */
179  VLC_INPUT_OPTION_UNIQUE = 0x100,
180 };
181 
185 VLC_API int input_item_AddOption(input_item_t *, const char *, unsigned i_flags );
186 
187 /* */
188 VLC_API bool input_item_HasErrorWhenReading( input_item_t * );
189 VLC_API void input_item_SetMeta( input_item_t *, vlc_meta_type_t meta_type, const char *psz_val );
190 VLC_API bool input_item_MetaMatch( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz );
191 VLC_API char * input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type ) VLC_USED;
192 VLC_API char * input_item_GetName( input_item_t * p_i ) VLC_USED;
193 VLC_API char * input_item_GetTitleFbName( input_item_t * p_i ) VLC_USED;
194 VLC_API char * input_item_GetURI( input_item_t * p_i ) VLC_USED;
195 VLC_API void input_item_SetURI( input_item_t * p_i, const char *psz_uri );
196 VLC_API mtime_t input_item_GetDuration( input_item_t * p_i );
197 VLC_API void input_item_SetDuration( input_item_t * p_i, mtime_t i_duration );
198 VLC_API bool input_item_IsPreparsed( input_item_t *p_i );
199 VLC_API bool input_item_IsArtFetched( input_item_t *p_i );
200 
201 #define INPUT_META( name ) \
202 static inline \
203 void input_item_Set ## name (input_item_t *p_input, const char *val) \
204 { \
205  input_item_SetMeta (p_input, vlc_meta_ ## name, val); \
206 } \
207 static inline \
208 char *input_item_Get ## name (input_item_t *p_input) \
209 { \
210  return input_item_GetMeta (p_input, vlc_meta_ ## name); \
211 }
212 
213 INPUT_META(Title)
214 INPUT_META(Artist)
215 INPUT_META(Genre)
216 INPUT_META(Copyright)
217 INPUT_META(Album)
218 INPUT_META(TrackNumber)
219 INPUT_META(Description)
220 INPUT_META(Rating)
221 INPUT_META(Date)
222 INPUT_META(Setting)
223 INPUT_META(URL)
224 INPUT_META(Language)
225 INPUT_META(NowPlaying)
226 INPUT_META(Publisher)
227 INPUT_META(EncodedBy)
228 INPUT_META(ArtworkURL)
229 INPUT_META(TrackID)
230 INPUT_META(TrackTotal)
231 
232 #define input_item_SetTrackNum input_item_SetTrackNumber
233 #define input_item_GetTrackNum input_item_GetTrackNumber
234 #define input_item_SetArtURL input_item_SetArtworkURL
235 #define input_item_GetArtURL input_item_GetArtworkURL
236 
237 VLC_API char * input_item_GetInfo( input_item_t *p_i, const char *psz_cat,const char *psz_name ) VLC_USED;
238 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 );
239 VLC_API int input_item_DelInfo( input_item_t *p_i, const char *psz_cat, const char *psz_name );
240 VLC_API void input_item_ReplaceInfos( input_item_t *, info_category_t * );
241 VLC_API void input_item_MergeInfos( input_item_t *, info_category_t * );
242 
249 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;
250 
256 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;
257 
263 #define input_item_New( a,b ) input_item_NewExt( a, b, 0, NULL, 0, -1 )
264 
268 VLC_API input_item_t * input_item_Copy(input_item_t * ) VLC_USED;
269 
271 VLC_API input_item_t *input_item_Hold(input_item_t *);
272 
274 VLC_API void input_item_Release(input_item_t *);
275 
276 /* Historical hack... */
277 #define vlc_gc_incref(i) input_item_Hold(i)
278 #define vlc_gc_decref(i) input_item_Release(i)
279 
280 /******************
281  * Input stats
282  ******************/
284 {
285  vlc_mutex_t lock;
286 
287  /* Input */
288  int64_t i_read_packets;
289  int64_t i_read_bytes;
290  float f_input_bitrate;
291  float f_average_input_bitrate;
292 
293  /* Demux */
294  int64_t i_demux_read_packets;
295  int64_t i_demux_read_bytes;
296  float f_demux_bitrate;
297  float f_average_demux_bitrate;
298  int64_t i_demux_corrupted;
299  int64_t i_demux_discontinuity;
300 
301  /* Decoders */
302  int64_t i_decoded_audio;
303  int64_t i_decoded_video;
304 
305  /* Vout */
306  int64_t i_displayed_pictures;
307  int64_t i_lost_pictures;
308 
309  /* Sout */
310  int64_t i_sent_packets;
311  int64_t i_sent_bytes;
312  float f_send_bitrate;
313 
314  /* Aout */
315  int64_t i_played_abuffers;
316  int64_t i_lost_abuffers;
317 };
318 
319 #endif
char * psz_name
Definition: vlc_input_item.h:44
vlc_mutex_t lock
Definition: vlc_input_item.h:86
VLC_API void input_item_node_PostAndDelete(input_item_node_t *p_node)
input_stats_t * p_stats
Definition: vlc_input_item.h:76
info_category_t ** pp_categories
Definition: vlc_input_item.h:71
Definition: vlc_input_item.h:55
int i_id
Definition: vlc_input_item.h:57
char * psz_name
Definition: vlc_input_item.h:59
uint8_t i_type
Definition: vlc_input_item.h:88
Definition: vlc_input_item.h:109
vlc_epg_t ** pp_epg
Definition: vlc_input_item.h:82
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
VLC_API void input_item_node_Delete(input_item_node_t *p_node)
Definition: vlc_events.h:103
VLC_API input_item_t * input_item_Hold(input_item_t *)
VLC_API int input_item_AddOption(input_item_t *, const char *, unsigned i_flags)
char * psz_value
Definition: vlc_input_item.h:45
int i_es
Definition: vlc_input_item.h:73
int i_epg
Definition: vlc_input_item.h:81
char * psz_name
Definition: vlc_input_item.h:50
Definition: vlc_es.h:323
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
bool b_error_when_reading
Definition: vlc_input_item.h:90
Definition: vlc_input_item.h:48
input_item_option_e
Definition: vlc_input_item.h:171
struct info_t ** pp_infos
Definition: vlc_input_item.h:52
VLC_API input_item_node_t * input_item_node_Create(input_item_t *p_input) VLC_USED
char ** ppsz_options
Definition: vlc_input_item.h:63
es_format_t ** es
Definition: vlc_input_item.h:74
Definition: vlc_epg.h:44
Definition: vlc_input_item.h:42
VLC_API input_item_t * input_item_Copy(input_item_t *) VLC_USED
VLC_API input_item_node_t * input_item_node_AppendItem(input_item_node_t *p_node, input_item_t *p_item)
int64_t mtime_t
Definition: vlc_common.h:153
int i_infos
Definition: vlc_input_item.h:51
int i_categories
Definition: vlc_input_item.h:70
bool b_fixed_name
Definition: vlc_input_item.h:89
VLC_API void input_item_node_AppendNode(input_item_node_t *p_parent, input_item_node_t *p_child)
char * psz_uri
Definition: vlc_input_item.h:60
Definition: vlc_input_item.h:283
int i_options
Definition: vlc_input_item.h:62
uint8_t * optflagv
Definition: vlc_input_item.h:64
mtime_t i_duration
Definition: vlc_input_item.h:67
int i_nb_played
Definition: vlc_input_item.h:77
VLC_API void input_item_Release(input_item_t *)
VLC_API void input_item_PostSubItem(input_item_t *p_parent, input_item_t *p_child)