QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
libvlc_media.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * libvlc_media.h: libvlc external API
3  *****************************************************************************
4  * Copyright (C) 1998-2009 VLC authors and VideoLAN
5  * $Id: eaa41f01890d6921f81af3fc4fe4a33aa8905635 $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  * Jean-Paul Saman <jpsaman@videolan.org>
9  * Pierre d'Herbemont <pdherbemont@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25 
31 #ifndef VLC_LIBVLC_MEDIA_H
32 #define VLC_LIBVLC_MEDIA_H 1
33 
34 # ifdef __cplusplus
35 extern "C" {
36 # endif
37 
45 typedef struct libvlc_media_t libvlc_media_t;
46 
53 typedef enum libvlc_meta_t {
54  libvlc_meta_Title,
55  libvlc_meta_Artist,
56  libvlc_meta_Genre,
57  libvlc_meta_Copyright,
58  libvlc_meta_Album,
59  libvlc_meta_TrackNumber,
60  libvlc_meta_Description,
61  libvlc_meta_Rating,
62  libvlc_meta_Date,
63  libvlc_meta_Setting,
64  libvlc_meta_URL,
65  libvlc_meta_Language,
66  libvlc_meta_NowPlaying,
67  libvlc_meta_Publisher,
68  libvlc_meta_EncodedBy,
69  libvlc_meta_ArtworkURL,
70  libvlc_meta_TrackID
71  /* Add new meta types HERE */
73 
85 typedef enum libvlc_state_t
86 {
87  libvlc_NothingSpecial=0,
88  libvlc_Opening,
89  libvlc_Buffering,
90  libvlc_Playing,
91  libvlc_Paused,
92  libvlc_Stopped,
93  libvlc_Ended,
94  libvlc_Error
96 
97 enum
98 {
99  libvlc_media_option_trusted = 0x2,
100  libvlc_media_option_unique = 0x100
101 };
102 
103 typedef enum libvlc_track_type_t
104 {
105  libvlc_track_unknown = -1,
106  libvlc_track_audio = 0,
107  libvlc_track_video = 1,
108  libvlc_track_text = 2
109 } libvlc_track_type_t;
110 
115 typedef struct libvlc_media_stats_t
116 {
117  /* Input */
118  int i_read_bytes;
119  float f_input_bitrate;
120 
121  /* Demux */
122  int i_demux_read_bytes;
123  float f_demux_bitrate;
124  int i_demux_corrupted;
125  int i_demux_discontinuity;
126 
127  /* Decoders */
128  int i_decoded_video;
129  int i_decoded_audio;
130 
131  /* Video Output */
132  int i_displayed_pictures;
133  int i_lost_pictures;
134 
135  /* Audio output */
136  int i_played_abuffers;
137  int i_lost_abuffers;
138 
139  /* Stream output */
140  int i_sent_packets;
141  int i_sent_bytes;
142  float f_send_bitrate;
147 {
148  /* Codec fourcc */
149  uint32_t i_codec;
150  int i_id;
151  libvlc_track_type_t i_type;
152 
153  /* Codec specific */
154  int i_profile;
155  int i_level;
156 
157  union {
158  struct {
159  /* Audio specific */
160  unsigned i_channels;
161  unsigned i_rate;
162  } audio;
163  struct {
164  /* Video specific */
165  unsigned i_height;
166  unsigned i_width;
167  } video;
168  } u;
169 
171 
172 
173 typedef struct libvlc_audio_track_t
174 {
175  unsigned i_channels;
176  unsigned i_rate;
178 
179 typedef struct libvlc_video_track_t
180 {
181  unsigned i_height;
182  unsigned i_width;
183  unsigned i_sar_num;
184  unsigned i_sar_den;
185  unsigned i_frame_rate_num;
186  unsigned i_frame_rate_den;
188 
190 {
191  char *psz_encoding;
193 
194 typedef struct libvlc_media_track_t
195 {
196  /* Codec fourcc */
197  uint32_t i_codec;
198  uint32_t i_original_fourcc;
199  int i_id;
200  libvlc_track_type_t i_type;
201 
202  /* Codec specific */
203  int i_profile;
204  int i_level;
205 
206  union {
207  libvlc_audio_track_t *audio;
208  libvlc_video_track_t *video;
209  libvlc_subtitle_track_t *subtitle;
210  };
211 
212  unsigned int i_bitrate;
213  char *psz_language;
214  char *psz_description;
215 
217 
218 
234 LIBVLC_API libvlc_media_t *libvlc_media_new_location(
235  libvlc_instance_t *p_instance,
236  const char * psz_mrl );
237 
247 LIBVLC_API libvlc_media_t *libvlc_media_new_path(
248  libvlc_instance_t *p_instance,
249  const char *path );
250 
275 LIBVLC_API libvlc_media_t *libvlc_media_new_fd(
276  libvlc_instance_t *p_instance,
277  int fd );
278 
279 
289 LIBVLC_API libvlc_media_t *libvlc_media_new_as_node(
290  libvlc_instance_t *p_instance,
291  const char * psz_name );
292 
311 LIBVLC_API void libvlc_media_add_option(
312  libvlc_media_t *p_md,
313  const char * psz_options );
314 
332 LIBVLC_API void libvlc_media_add_option_flag(
333  libvlc_media_t *p_md,
334  const char * psz_options,
335  unsigned i_flags );
336 
337 
345 LIBVLC_API void libvlc_media_retain( libvlc_media_t *p_md );
346 
356 LIBVLC_API void libvlc_media_release( libvlc_media_t *p_md );
357 
358 
365 LIBVLC_API char *libvlc_media_get_mrl( libvlc_media_t *p_md );
366 
372 LIBVLC_API libvlc_media_t *libvlc_media_duplicate( libvlc_media_t *p_md );
373 
391 LIBVLC_API char *libvlc_media_get_meta( libvlc_media_t *p_md,
392  libvlc_meta_t e_meta );
393 
402 LIBVLC_API void libvlc_media_set_meta( libvlc_media_t *p_md,
403  libvlc_meta_t e_meta,
404  const char *psz_value );
405 
406 
413 LIBVLC_API int libvlc_media_save_meta( libvlc_media_t *p_md );
414 
415 
428  libvlc_media_t *p_md );
429 
430 
440 LIBVLC_API int libvlc_media_get_stats( libvlc_media_t *p_md,
441  libvlc_media_stats_t *p_stats );
442 
443 /* The following method uses libvlc_media_list_t, however, media_list usage is optionnal
444  * and this is here for convenience */
445 #define VLC_FORWARD_DECLARE_OBJECT(a) struct a
446 
455 LIBVLC_API VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t *)
456 libvlc_media_subitems( libvlc_media_t *p_md );
457 
465 LIBVLC_API libvlc_event_manager_t *
466  libvlc_media_event_manager( libvlc_media_t *p_md );
467 
474 LIBVLC_API libvlc_time_t
475  libvlc_media_get_duration( libvlc_media_t *p_md );
476 
489 LIBVLC_API void
490 libvlc_media_parse( libvlc_media_t *p_md );
491 
509 LIBVLC_API void
510 libvlc_media_parse_async( libvlc_media_t *p_md );
511 
522 LIBVLC_API int
523  libvlc_media_is_parsed( libvlc_media_t *p_md );
524 
533 LIBVLC_API void
534  libvlc_media_set_user_data( libvlc_media_t *p_md, void *p_new_user_data );
535 
543 LIBVLC_API void *libvlc_media_get_user_data( libvlc_media_t *p_md );
544 
560 LIBVLC_DEPRECATED LIBVLC_API
561 int libvlc_media_get_tracks_info( libvlc_media_t *p_md,
562  libvlc_media_track_info_t **tracks );
563 
580 LIBVLC_API
581 unsigned libvlc_media_tracks_get( libvlc_media_t *p_md,
582  libvlc_media_track_t ***tracks );
583 
584 
593 LIBVLC_API
595  unsigned i_count );
596 
599 # ifdef __cplusplus
600 }
601 # endif
602 
603 #endif /* VLC_LIBVLC_MEDIA_H */
LIBVLC_DEPRECATED LIBVLC_API int libvlc_media_get_tracks_info(libvlc_media_t *p_md, libvlc_media_track_info_t **tracks)
LIBVLC_API libvlc_media_t * libvlc_media_new_path(libvlc_instance_t *p_instance, const char *path)
Definition: libvlc_media.h:194
LIBVLC_API int libvlc_media_get_stats(libvlc_media_t *p_md, libvlc_media_stats_t *p_stats)
LIBVLC_API libvlc_media_t * libvlc_media_new_as_node(libvlc_instance_t *p_instance, const char *psz_name)
LIBVLC_API void libvlc_media_retain(libvlc_media_t *p_md)
Definition: libvlc_media.h:146
libvlc_state_t
Definition: libvlc_media.h:85
LIBVLC_API libvlc_time_t libvlc_media_get_duration(libvlc_media_t *p_md)
struct libvlc_event_manager_t libvlc_event_manager_t
Definition: libvlc.h:282
LIBVLC_API char * libvlc_media_get_mrl(libvlc_media_t *p_md)
libvlc_meta_t
Definition: libvlc_media.h:53
LIBVLC_API unsigned libvlc_media_tracks_get(libvlc_media_t *p_md, libvlc_media_track_t ***tracks)
LIBVLC_API void * libvlc_media_get_user_data(libvlc_media_t *p_md)
LIBVLC_API void libvlc_media_tracks_release(libvlc_media_track_t **p_tracks, unsigned i_count)
LIBVLC_API void libvlc_media_set_meta(libvlc_media_t *p_md, libvlc_meta_t e_meta, const char *psz_value)
LIBVLC_API void libvlc_media_set_user_data(libvlc_media_t *p_md, void *p_new_user_data)
LIBVLC_API int libvlc_media_save_meta(libvlc_media_t *p_md)
LIBVLC_API void libvlc_media_parse(libvlc_media_t *p_md)
struct libvlc_media_stats_t libvlc_media_stats_t
LIBVLC_API VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t *) libvlc_media_subitems(libvlc_media_t *p_md)
LIBVLC_API int libvlc_media_is_parsed(libvlc_media_t *p_md)
Definition: libvlc_media.h:189
LIBVLC_API char * libvlc_media_get_meta(libvlc_media_t *p_md, libvlc_meta_t e_meta)
Definition: libvlc_media.h:179
LIBVLC_API libvlc_state_t libvlc_media_get_state(libvlc_media_t *p_md)
LIBVLC_API libvlc_media_t * libvlc_media_duplicate(libvlc_media_t *p_md)
Definition: libvlc_media.h:115
LIBVLC_API void libvlc_media_release(libvlc_media_t *p_md)
LIBVLC_API void libvlc_media_parse_async(libvlc_media_t *p_md)
Definition: libvlc_media.h:173
struct libvlc_instance_t libvlc_instance_t
Definition: libvlc_structures.h:44
LIBVLC_API libvlc_media_t * libvlc_media_new_location(libvlc_instance_t *p_instance, const char *psz_mrl)
LIBVLC_API libvlc_event_manager_t * libvlc_media_event_manager(libvlc_media_t *p_md)
LIBVLC_API void libvlc_media_add_option_flag(libvlc_media_t *p_md, const char *psz_options, unsigned i_flags)
LIBVLC_API void libvlc_media_add_option(libvlc_media_t *p_md, const char *psz_options)
LIBVLC_API libvlc_media_t * libvlc_media_new_fd(libvlc_instance_t *p_instance, int fd)