VLC  4.0.0-dev
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  *
6  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
7  * Jean-Paul Saman <jpsaman@videolan.org>
8  * Pierre d'Herbemont <pdherbemont@videolan.org>
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_LIBVLC_MEDIA_H
26 #define VLC_LIBVLC_MEDIA_H 1
27 
28 # ifdef __cplusplus
29 extern "C" {
30 # else
31 # include <stdbool.h>
32 # endif
33 
34 /** \defgroup libvlc_media LibVLC media
35  * \ingroup libvlc
36  * @ref libvlc_media_t is an abstract representation of a playable media.
37  * It consists of a media location and various optional meta data.
38  * @{
39  * \file
40  * LibVLC media item/descriptor external API
41  */
42 
44 
45 /** Meta data types */
46 typedef enum libvlc_meta_t {
73  /* Add new meta types HERE */
75 
76 /**
77  * Note the order of libvlc_state_t enum must match exactly the order of
78  * \see mediacontrol_PlayerStatus, \see input_state_e enums,
79  * and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).
80  *
81  * Expected states by web plugins are:
82  * IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,
83  * STOPPING=5, ENDED=6, ERROR=7
84  */
85 typedef enum libvlc_state_t
86 {
89  libvlc_Buffering, /* XXX: Deprecated value. Check the
90  * libvlc_MediaPlayerBuffering event to know the
91  * buffering state of a libvlc_media_player */
98 
99 enum
100 {
103 };
104 
106 {
112 
113 typedef struct libvlc_media_stats_t
114 {
115  /* Input */
118 
119  /* Demux */
124 
125  /* Decoders */
128 
129  /* Video Output */
132 
133  /* Audio output */
137 
138 typedef struct libvlc_audio_track_t
139 {
140  unsigned i_channels;
141  unsigned i_rate;
143 
145 {
146  libvlc_video_orient_top_left, /**< Normal. Top line represents top, left column left. */
147  libvlc_video_orient_top_right, /**< Flipped horizontally */
148  libvlc_video_orient_bottom_left, /**< Flipped vertically */
149  libvlc_video_orient_bottom_right, /**< Rotated 180 degrees */
150  libvlc_video_orient_left_top, /**< Transposed */
151  libvlc_video_orient_left_bottom, /**< Rotated 90 degrees clockwise (or 270 anti-clockwise) */
152  libvlc_video_orient_right_top, /**< Rotated 90 degrees anti-clockwise */
153  libvlc_video_orient_right_bottom /**< Anti-transposed */
155 
157 {
160 
163 
164 /**
165  * Viewpoint
166  *
167  * \warning allocate using libvlc_video_new_viewpoint()
168  */
170 {
171  float f_yaw; /**< view point yaw in degrees ]-180;180] */
172  float f_pitch; /**< view point pitch in degrees ]-90;90] */
173  float f_roll; /**< view point roll in degrees ]-180;180] */
174  float f_field_of_view; /**< field of view in degrees ]0;180[ (default 80.)*/
176 
178 {
179  libvlc_video_multiview_2d, /**< No stereoscopy: 2D picture. */
180  libvlc_video_multiview_stereo_sbs, /**< Side-by-side */
182  libvlc_video_multiview_stereo_row, /**< Row sequential */
183  libvlc_video_multiview_stereo_col, /**< Column sequential */
184  libvlc_video_multiview_stereo_frame, /**< Frame sequential */
185  libvlc_video_multiview_stereo_checkerboard, /**< Checkerboard pattern */
187 
188 typedef struct libvlc_video_track_t
189 {
190  unsigned i_height;
191  unsigned i_width;
192  unsigned i_sar_num;
193  unsigned i_sar_den;
196 
197  libvlc_video_orient_t i_orientation;
199  libvlc_video_viewpoint_t pose; /**< Initial view point */
200  libvlc_video_multiview_t i_multiview;
202 
204 {
207 
208 typedef struct libvlc_media_track_t
209 {
210  /* Codec fourcc */
211  uint32_t i_codec;
213  int i_id;
215 
216  /* Codec specific */
218  int i_level;
219 
220  union {
224  };
225 
226  unsigned int i_bitrate;
229 
231 
232 /**
233  * Media type
234  *
235  * \see libvlc_media_get_type
236  */
237 typedef enum libvlc_media_type_t {
245 
246 /**
247  * Parse flags used by libvlc_media_parse_with_options()
248  *
249  * \see libvlc_media_parse_with_options
250  */
252 {
253  /**
254  * Parse media if it's a local file
255  */
257  /**
258  * Parse media even if it's a network file
259  */
261  /**
262  * Fetch meta and covert art using local resources
263  */
265  /**
266  * Fetch meta and covert art using network resources
267  */
269  /**
270  * Interact with the user (via libvlc_dialog_cbs) when preparsing this item
271  * (and not its sub items). Set this flag in order to receive a callback
272  * when the input is asking for credentials.
273  */
276 
277 /**
278  * Parse status used sent by libvlc_media_parse_with_options() or returned by
279  * libvlc_media_get_parsed_status()
280  *
281  * \see libvlc_media_parse_with_options
282  * \see libvlc_media_get_parsed_status
283  */
285 {
291 
292 /**
293  * Type of a media slave: subtitle or audio.
294  */
296 {
300 
301 /**
302  * A slave of a libvlc_media_t
303  * \see libvlc_media_slaves_get
304  */
305 typedef struct libvlc_media_slave_t
306 {
307  char * psz_uri;
308  libvlc_media_slave_type_t i_type;
309  unsigned int i_priority;
311 
312 /**
313  * Callback prototype to open a custom bitstream input media.
314  *
315  * The same media item can be opened multiple times. Each time, this callback
316  * is invoked. It should allocate and initialize any instance-specific
317  * resources, then store them in *datap. The instance resources can be freed
318  * in the @ref libvlc_media_close_cb callback.
319  *
320  * \param opaque private pointer as passed to libvlc_media_new_callbacks()
321  * \param datap storage space for a private data pointer [OUT]
322  * \param sizep byte length of the bitstream or UINT64_MAX if unknown [OUT]
323  *
324  * \note For convenience, *datap is initially NULL and *sizep is initially 0.
325  *
326  * \return 0 on success, non-zero on error. In case of failure, the other
327  * callbacks will not be invoked and any value stored in *datap and *sizep is
328  * discarded.
329  */
330 typedef int (*libvlc_media_open_cb)(void *opaque, void **datap,
331  uint64_t *sizep);
332 
333 /**
334  * Callback prototype to read data from a custom bitstream input media.
335  *
336  * \param opaque private pointer as set by the @ref libvlc_media_open_cb
337  * callback
338  * \param buf start address of the buffer to read data into
339  * \param len bytes length of the buffer
340  *
341  * \return strictly positive number of bytes read, 0 on end-of-stream,
342  * or -1 on non-recoverable error
343  *
344  * \note If no data is immediately available, then the callback should sleep.
345  * \warning The application is responsible for avoiding deadlock situations.
346  */
347 typedef ssize_t (*libvlc_media_read_cb)(void *opaque, unsigned char *buf,
348  size_t len);
349 
350 /**
351  * Callback prototype to seek a custom bitstream input media.
352  *
353  * \param opaque private pointer as set by the @ref libvlc_media_open_cb
354  * callback
355  * \param offset absolute byte offset to seek to
356  * \return 0 on success, -1 on error.
357  */
358 typedef int (*libvlc_media_seek_cb)(void *opaque, uint64_t offset);
359 
360 /**
361  * Callback prototype to close a custom bitstream input media.
362  *
363  * \param opaque private pointer as set by the @ref libvlc_media_open_cb
364  * callback
365  */
366 typedef void (*libvlc_media_close_cb)(void *opaque);
367 
368 /**
369  * Create a media with a certain given media resource location,
370  * for instance a valid URL.
371  *
372  * \note To refer to a local file with this function,
373  * the file://... URI syntax <b>must</b> be used (see IETF RFC3986).
374  * We recommend using libvlc_media_new_path() instead when dealing with
375  * local files.
376  *
377  * \see libvlc_media_release
378  *
379  * \param p_instance the instance
380  * \param psz_mrl the media location
381  * \return the newly created media or NULL on error
382  */
384  libvlc_instance_t *p_instance,
385  const char * psz_mrl );
386 
387 /**
388  * Create a media for a certain file path.
389  *
390  * \see libvlc_media_release
391  *
392  * \param p_instance the instance
393  * \param path local filesystem path
394  * \return the newly created media or NULL on error
395  */
397  libvlc_instance_t *p_instance,
398  const char *path );
399 
400 /**
401  * Create a media for an already open file descriptor.
402  * The file descriptor shall be open for reading (or reading and writing).
403  *
404  * Regular file descriptors, pipe read descriptors and character device
405  * descriptors (including TTYs) are supported on all platforms.
406  * Block device descriptors are supported where available.
407  * Directory descriptors are supported on systems that provide fdopendir().
408  * Sockets are supported on all platforms where they are file descriptors,
409  * i.e. all except Windows.
410  *
411  * \note This library will <b>not</b> automatically close the file descriptor
412  * under any circumstance. Nevertheless, a file descriptor can usually only be
413  * rendered once in a media player. To render it a second time, the file
414  * descriptor should probably be rewound to the beginning with lseek().
415  *
416  * \see libvlc_media_release
417  *
418  * \version LibVLC 1.1.5 and later.
419  *
420  * \param p_instance the instance
421  * \param fd open file descriptor
422  * \return the newly created media or NULL on error
423  */
425  libvlc_instance_t *p_instance,
426  int fd );
427 
428 /**
429  * Create a media with custom callbacks to read the data from.
430  *
431  * \param instance LibVLC instance
432  * \param open_cb callback to open the custom bitstream input media
433  * \param read_cb callback to read data (must not be NULL)
434  * \param seek_cb callback to seek, or NULL if seeking is not supported
435  * \param close_cb callback to close the media, or NULL if unnecessary
436  * \param opaque data pointer for the open callback
437  *
438  * \return the newly created media or NULL on error
439  *
440  * \note If open_cb is NULL, the opaque pointer will be passed to read_cb,
441  * seek_cb and close_cb, and the stream size will be treated as unknown.
442  *
443  * \note The callbacks may be called asynchronously (from another thread).
444  * A single stream instance need not be reentrant. However the open_cb needs to
445  * be reentrant if the media is used by multiple player instances.
446  *
447  * \warning The callbacks may be used until all or any player instances
448  * that were supplied the media item are stopped.
449  *
450  * \see libvlc_media_release
451  *
452  * \version LibVLC 3.0.0 and later.
453  */
455  libvlc_instance_t *instance,
456  libvlc_media_open_cb open_cb,
457  libvlc_media_read_cb read_cb,
458  libvlc_media_seek_cb seek_cb,
459  libvlc_media_close_cb close_cb,
460  void *opaque );
461 
462 /**
463  * Create a media as an empty node with a given name.
464  *
465  * \see libvlc_media_release
466  *
467  * \param p_instance the instance
468  * \param psz_name the name of the node
469  * \return the new empty media or NULL on error
470  */
472  libvlc_instance_t *p_instance,
473  const char * psz_name );
474 
475 /**
476  * Add an option to the media.
477  *
478  * This option will be used to determine how the media_player will
479  * read the media. This allows to use VLC's advanced
480  * reading/streaming options on a per-media basis.
481  *
482  * \note The options are listed in 'vlc --longhelp' from the command line,
483  * e.g. "--sout-all". Keep in mind that available options and their semantics
484  * vary across LibVLC versions and builds.
485  * \warning Not all options affects libvlc_media_t objects:
486  * Specifically, due to architectural issues most audio and video options,
487  * such as text renderer options, have no effects on an individual media.
488  * These options must be set through libvlc_new() instead.
489  *
490  * \param p_md the media descriptor
491  * \param psz_options the options (as a string)
492  */
494  libvlc_media_t *p_md,
495  const char * psz_options );
496 
497 /**
498  * Add an option to the media with configurable flags.
499  *
500  * This option will be used to determine how the media_player will
501  * read the media. This allows to use VLC's advanced
502  * reading/streaming options on a per-media basis.
503  *
504  * The options are detailed in vlc --longhelp, for instance
505  * "--sout-all". Note that all options are not usable on medias:
506  * specifically, due to architectural issues, video-related options
507  * such as text renderer options cannot be set on a single media. They
508  * must be set on the whole libvlc instance instead.
509  *
510  * \param p_md the media descriptor
511  * \param psz_options the options (as a string)
512  * \param i_flags the flags for this option
513  */
515  libvlc_media_t *p_md,
516  const char * psz_options,
517  unsigned i_flags );
518 
519 
520 /**
521  * Retain a reference to a media descriptor object (libvlc_media_t). Use
522  * libvlc_media_release() to decrement the reference count of a
523  * media descriptor object.
524  *
525  * \param p_md the media descriptor
526  */
528 
529 /**
530  * Decrement the reference count of a media descriptor object. If the
531  * reference count is 0, then libvlc_media_release() will release the
532  * media descriptor object. It will send out an libvlc_MediaFreed event
533  * to all listeners. If the media descriptor object has been released it
534  * should not be used again.
535  *
536  * \param p_md the media descriptor
537  */
539 
540 
541 /**
542  * Get the media resource locator (mrl) from a media descriptor object
543  *
544  * \param p_md a media descriptor object
545  * \return string with mrl of media descriptor object
546  */
548 
549 /**
550  * Duplicate a media descriptor object.
551  *
552  * \param p_md a media descriptor object.
553  */
555 
556 /**
557  * Read the meta of the media.
558  *
559  * Note, you need to call libvlc_media_parse_with_options() or play the media
560  * at least once before calling this function.
561  * If the media has not yet been parsed this will return NULL.
562  *
563  * \see libvlc_media_parse_with_options
564  * \see libvlc_MediaMetaChanged
565  *
566  * \param p_md the media descriptor
567  * \param e_meta the meta to read
568  * \return the media's meta
569  */
571  libvlc_meta_t e_meta );
572 
573 /**
574  * Set the meta of the media (this function will not save the meta, call
575  * libvlc_media_save_meta in order to save the meta)
576  *
577  * \param p_md the media descriptor
578  * \param e_meta the meta to write
579  * \param psz_value the media's meta
580  */
582  libvlc_meta_t e_meta,
583  const char *psz_value );
584 
585 
586 /**
587  * Save the meta previously set
588  *
589  * \param p_md the media desriptor
590  * \return true if the write operation was successful
591  */
593 
594 
595 /**
596  * Get current state of media descriptor object. Possible media states are
597  * libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused,
598  * libvlc_Stopped, libvlc_Ended, libvlc_Error.
599  *
600  * \see libvlc_state_t
601  * \param p_md a media descriptor object
602  * \return state of media descriptor object
603  */
604 LIBVLC_API libvlc_state_t libvlc_media_get_state(
605  libvlc_media_t *p_md );
606 
607 
608 /**
609  * Get the current statistics about the media
610  * \param p_md: media descriptor object
611  * \param p_stats: structure that contain the statistics about the media
612  * (this structure must be allocated by the caller)
613  * \retval true statistics are available
614  * \retval false otherwise
615  */
617  libvlc_media_stats_t *p_stats);
618 
619 /* The following method uses libvlc_media_list_t, however, media_list usage is optionnal
620  * and this is here for convenience */
621 #define VLC_FORWARD_DECLARE_OBJECT(a) struct a
622 
623 /**
624  * Get subitems of media descriptor object. This will increment
625  * the reference count of supplied media descriptor object. Use
626  * libvlc_media_list_release() to decrement the reference counting.
627  *
628  * \param p_md media descriptor object
629  * \return list of media descriptor subitems or NULL
630  */
633 
634 /**
635  * Get event manager from media descriptor object.
636  * NOTE: this function doesn't increment reference counting.
637  *
638  * \param p_md a media descriptor object
639  * \return event manager object
640  */
643 
644 /**
645  * Get duration (in ms) of media descriptor object item.
646  *
647  * Note, you need to call libvlc_media_parse_with_options() or play the media
648  * at least once before calling this function.
649  * Not doing this will result in an undefined result.
650  *
651  * \see libvlc_media_parse_with_options
652  *
653  * \param p_md media descriptor object
654  * \return duration of media item or -1 on error
655  */
658 
659 /**
660  * Parse the media asynchronously with options.
661  *
662  * This fetches (local or network) art, meta data and/or tracks information.
663  *
664  * To track when this is over you can listen to libvlc_MediaParsedChanged
665  * event. However if this functions returns an error, you will not receive any
666  * events.
667  *
668  * It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All
669  * these flags can be combined. By default, media is parsed if it's a local
670  * file.
671  *
672  * \note Parsing can be aborted with libvlc_media_parse_stop().
673  *
674  * \see libvlc_MediaParsedChanged
675  * \see libvlc_media_get_meta
676  * \see libvlc_media_tracks_get
677  * \see libvlc_media_get_parsed_status
678  * \see libvlc_media_parse_flag_t
679  *
680  * \param p_md media descriptor object
681  * \param parse_flag parse options:
682  * \param timeout maximum time allowed to preparse the media. If -1, the
683  * default "preparse-timeout" option will be used as a timeout. If 0, it will
684  * wait indefinitely. If > 0, the timeout will be used (in milliseconds).
685  * \return -1 in case of error, 0 otherwise
686  * \version LibVLC 3.0.0 or later
687  */
688 LIBVLC_API int
690  libvlc_media_parse_flag_t parse_flag,
691  int timeout );
692 
693 /**
694  * Stop the parsing of the media
695  *
696  * When the media parsing is stopped, the libvlc_MediaParsedChanged event will
697  * be sent with the libvlc_media_parsed_status_timeout status.
698  *
699  * \see libvlc_media_parse_with_options
700  *
701  * \param p_md media descriptor object
702  * \version LibVLC 3.0.0 or later
703  */
704 LIBVLC_API void
706 
707 /**
708  * Get Parsed status for media descriptor object.
709  *
710  * \see libvlc_MediaParsedChanged
711  * \see libvlc_media_parsed_status_t
712  * \see libvlc_media_parse_with_options
713  *
714  * \param p_md media descriptor object
715  * \return a value of the libvlc_media_parsed_status_t enum
716  * \version LibVLC 3.0.0 or later
717  */
718 LIBVLC_API libvlc_media_parsed_status_t
720 
721 /**
722  * Sets media descriptor's user_data. user_data is specialized data
723  * accessed by the host application, VLC.framework uses it as a pointer to
724  * an native object that references a libvlc_media_t pointer
725  *
726  * \param p_md media descriptor object
727  * \param p_new_user_data pointer to user data
728  */
729 LIBVLC_API void
730  libvlc_media_set_user_data( libvlc_media_t *p_md, void *p_new_user_data );
731 
732 /**
733  * Get media descriptor's user_data. user_data is specialized data
734  * accessed by the host application, VLC.framework uses it as a pointer to
735  * an native object that references a libvlc_media_t pointer
736  *
737  * \see libvlc_media_set_user_data
738  *
739  * \param p_md media descriptor object
740  */
742 
743 /**
744  * Get media descriptor's elementary streams description
745  *
746  * Note, you need to call libvlc_media_parse_with_options() or play the media
747  * at least once before calling this function.
748  * Not doing this will result in an empty array.
749  *
750  * \version LibVLC 2.1.0 and later.
751  * \see libvlc_media_parse_with_options
752  *
753  * \param p_md media descriptor object
754  * \param tracks address to store an allocated array of Elementary Streams
755  * descriptions (must be freed with libvlc_media_tracks_release
756  by the caller) [OUT]
757  *
758  * \return the number of Elementary Streams (zero on error)
759  */
762  libvlc_media_track_t ***tracks );
763 
764 /**
765  * Get codec description from media elementary stream
766  *
767  * Note, you need to call libvlc_media_parse_with_options() or play the media
768  * at least once before calling this function.
769  *
770  * \version LibVLC 3.0.0 and later.
771  *
772  * \see libvlc_media_track_t
773  * \see libvlc_media_parse_with_options
774  *
775  * \param i_type i_type from libvlc_media_track_t
776  * \param i_codec i_codec or i_original_fourcc from libvlc_media_track_t
777  *
778  * \return codec description
779  */
782  uint32_t i_codec );
783 
784 /**
785  * Release media descriptor's elementary streams description array
786  *
787  * \version LibVLC 2.1.0 and later.
788  *
789  * \param p_tracks tracks info array to release
790  * \param i_count number of elements in the array
791  */
794  unsigned i_count );
795 
796 /**
797  * Get the media type of the media descriptor object
798  *
799  * \version LibVLC 3.0.0 and later.
800  *
801  * \see libvlc_media_type_t
802  *
803  * \param p_md media descriptor object
804  *
805  * \return media type
806  */
808 libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md );
809 
810 /**
811  * \brief libvlc_media_thumbnail_request_t An opaque thumbnail request object
812  */
814 
816 {
820 
821 /**
822  * \brief libvlc_media_get_thumbnail_by_time Start an asynchronous thumbnail generation
823  *
824  * If the request is successfuly queued, the libvlc_MediaThumbnailGenerated
825  * is guaranteed to be emited.
826  *
827  * \param md media descriptor object
828  * \param time The time at which the thumbnail should be generated
829  * \param speed The seeking speed \sa{libvlc_thumbnailer_seek_speed_t}
830  * \param width The thumbnail width
831  * \param height the thumbnail height
832  * \param picture_type The thumbnail picture type \sa{libvlc_picture_type_t}
833  * \param timeout A timeout value in ms, or 0 to disable timeout
834  *
835  * \return A valid opaque request object, or NULL in case of failure.
836  * It may be cancelled by libvlc_media_thumbnail_request_cancel().
837  * It must be released by libvlc_media_thumbnail_request_destroy().
838  *
839  * \version libvlc 4.0 or later
840  *
841  * \see libvlc_picture_t
842  * \see libvlc_picture_type_t
843  */
846  libvlc_time_t time,
847  libvlc_thumbnailer_seek_speed_t speed,
848  unsigned int width, unsigned int height,
849  bool crop, libvlc_picture_type_t picture_type,
850  libvlc_time_t timeout );
851 
852 /**
853  * \brief libvlc_media_get_thumbnail_by_pos Start an asynchronous thumbnail generation
854  *
855  * If the request is successfuly queued, the libvlc_MediaThumbnailGenerated
856  * is guaranteed to be emited.
857  *
858  * \param md media descriptor object
859  * \param pos The position at which the thumbnail should be generated
860  * \param speed The seeking speed \sa{libvlc_thumbnailer_seek_speed_t}
861  * \param width The thumbnail width
862  * \param height the thumbnail height
863  * \param picture_type The thumbnail picture type \sa{libvlc_picture_type_t}
864  * \param timeout A timeout value in ms, or 0 to disable timeout
865  *
866  * \return A valid opaque request object, or NULL in case of failure.
867  * It may be cancelled by libvlc_media_thumbnail_request_cancel().
868  * It must be released by libvlc_media_thumbnail_request_destroy().
869  *
870  * \version libvlc 4.0 or later
871  *
872  * \see libvlc_picture_t
873  * \see libvlc_picture_type_t
874  */
877  float pos,
878  libvlc_thumbnailer_seek_speed_t speed,
879  unsigned int width, unsigned int height,
880  bool crop, libvlc_picture_type_t picture_type,
881  libvlc_time_t timeout );
882 
883 /**
884  * @brief libvlc_media_thumbnail_cancel cancels a thumbnailing request
885  * @param p_req An opaque thumbnail request object.
886  *
887  * Cancelling the request will still cause libvlc_MediaThumbnailGenerated event
888  * to be emited, with a NULL libvlc_picture_t
889  * If the request is cancelled after its completion, the behavior is undefined.
890  */
891 LIBVLC_API void
893 
894 /**
895  * @brief libvlc_media_thumbnail_destroy destroys a thumbnail request
896  * @param p_req An opaque thumbnail request object.
897  *
898  * If the request has not completed or hasn't been cancelled yet, the behavior
899  * is undefined
900  */
901 LIBVLC_API void
903 
904 /**
905  * Add a slave to the current media.
906  *
907  * A slave is an external input source that may contains an additional subtitle
908  * track (like a .srt) or an additional audio track (like a .ac3).
909  *
910  * \note This function must be called before the media is parsed (via
911  * libvlc_media_parse_with_options()) or before the media is played (via
912  * libvlc_media_player_play())
913  *
914  * \version LibVLC 3.0.0 and later.
915  *
916  * \param p_md media descriptor object
917  * \param i_type subtitle or audio
918  * \param i_priority from 0 (low priority) to 4 (high priority)
919  * \param psz_uri Uri of the slave (should contain a valid scheme).
920  *
921  * \return 0 on success, -1 on error.
922  */
925  libvlc_media_slave_type_t i_type,
926  unsigned int i_priority,
927  const char *psz_uri );
928 
929 /**
930  * Clear all slaves previously added by libvlc_media_slaves_add() or
931  * internally.
932  *
933  * \version LibVLC 3.0.0 and later.
934  *
935  * \param p_md media descriptor object
936  */
939 
940 /**
941  * Get a media descriptor's slave list
942  *
943  * The list will contain slaves parsed by VLC or previously added by
944  * libvlc_media_slaves_add(). The typical use case of this function is to save
945  * a list of slave in a database for a later use.
946  *
947  * \version LibVLC 3.0.0 and later.
948  *
949  * \see libvlc_media_slaves_add
950  *
951  * \param p_md media descriptor object
952  * \param ppp_slaves address to store an allocated array of slaves (must be
953  * freed with libvlc_media_slaves_release()) [OUT]
954  *
955  * \return the number of slaves (zero on error)
956  */
958 unsigned int libvlc_media_slaves_get( libvlc_media_t *p_md,
959  libvlc_media_slave_t ***ppp_slaves );
960 
961 /**
962  * Release a media descriptor's slave list
963  *
964  * \version LibVLC 3.0.0 and later.
965  *
966  * \param pp_slaves slave array to release
967  * \param i_count number of elements in the array
968  */
971  unsigned int i_count );
972 
973 /** @}*/
974 
975 # ifdef __cplusplus
976 }
977 # endif
978 
979 #endif /* VLC_LIBVLC_MEDIA_H */
Definition: libvlc_media.h:94
Transposed.
Definition: libvlc_media.h:150
libvlc_track_type_t
Definition: libvlc_media.h:105
Checkerboard pattern.
Definition: libvlc_media.h:185
libvlc_video_viewpoint_t pose
Initial view point.
Definition: libvlc_media.h:199
LIBVLC_API libvlc_media_t * libvlc_media_new_path(libvlc_instance_t *p_instance, const char *path)
Create a media for a certain file path.
libvlc_video_projection_t i_projection
Definition: libvlc_media.h:198
float f_roll
view point roll in degrees ]-180;180]
Definition: libvlc_media.h:173
Definition: libvlc_media.h:288
Definition: libvlc_media.h:208
Definition: libvlc_media.h:109
Definition: libvlc_media.h:55
Rotated 180 degrees.
Definition: libvlc_media.h:149
LIBVLC_API libvlc_media_t * libvlc_media_new_as_node(libvlc_instance_t *p_instance, const char *psz_name)
Create a media as an empty node with a given name.
vlc_fourcc_t i_codec
Definition: image.c:579
Definition: libvlc_media.h:89
Definition: libvlc_media.h:66
LIBVLC_API void libvlc_media_retain(libvlc_media_t *p_md)
Retain a reference to a media descriptor object (libvlc_media_t).
LIBVLC_API int libvlc_media_slaves_add(libvlc_media_t *p_md, libvlc_media_slave_type_t i_type, unsigned int i_priority, const char *psz_uri)
Add a slave to the current media.
uint32_t i_original_fourcc
Definition: libvlc_media.h:212
unsigned i_height
Definition: libvlc_media.h:190
unsigned i_rate
Definition: libvlc_media.h:141
libvlc_state_t
Note the order of libvlc_state_t enum must match exactly the order of.
Definition: libvlc_media.h:85
Anti-transposed.
Definition: libvlc_media.h:153
float f_pitch
view point pitch in degrees ]-90;90]
Definition: libvlc_media.h:172
libvlc_thumbnailer_seek_speed_t
Definition: libvlc_media.h:815
Definition: libvlc_media.h:54
LIBVLC_API void libvlc_media_parse_stop(libvlc_media_t *p_md)
Stop the parsing of the media.
Definition: libvlc_media.h:59
LIBVLC_API libvlc_time_t libvlc_media_get_duration(libvlc_media_t *p_md)
Get duration (in ms) of media descriptor object item.
struct libvlc_event_manager_t libvlc_event_manager_t
Event manager that belongs to a libvlc object, and from whom events can be received.
Definition: libvlc.h:304
LIBVLC_API char * libvlc_media_get_mrl(libvlc_media_t *p_md)
Get the media resource locator (mrl) from a media descriptor object.
int i_displayed_pictures
Definition: libvlc_media.h:130
Fetch meta and covert art using network resources.
Definition: libvlc_media.h:268
libvlc_media_slave_type_t
Type of a media slave: subtitle or audio.
Definition: libvlc_media.h:295
struct libvlc_media_slave_t libvlc_media_slave_t
A slave of a libvlc_media_t.
libvlc_meta_t
Meta data types.
Definition: libvlc_media.h:46
LIBVLC_API unsigned libvlc_media_tracks_get(libvlc_media_t *p_md, libvlc_media_track_t ***tracks)
Get media descriptor&#39;s elementary streams description.
struct libvlc_media_t libvlc_media_t
Definition: libvlc_media.h:43
Side-by-side.
Definition: libvlc_media.h:180
char * psz_uri
Definition: libvlc_media.h:307
Definition: libvlc_media.h:49
Definition: libvlc_media.h:65
unsigned i_width
Definition: libvlc_media.h:191
int i_lost_pictures
Definition: libvlc_media.h:131
Definition: libvlc_media.h:286
#define LIBVLC_API
Definition: libvlc.h:42
Definition: libvlc_media.h:61
float f_yaw
view point yaw in degrees ]-180;180]
Definition: libvlc_media.h:171
LIBVLC_API libvlc_media_thumbnail_request_t * libvlc_media_thumbnail_request_by_pos(libvlc_media_t *md, float pos, libvlc_thumbnailer_seek_speed_t speed, unsigned int width, unsigned int height, bool crop, libvlc_picture_type_t picture_type, libvlc_time_t timeout)
libvlc_media_get_thumbnail_by_pos Start an asynchronous thumbnail generation
libvlc_audio_track_t * audio
Definition: libvlc_media.h:221
LIBVLC_API void * libvlc_media_get_user_data(libvlc_media_t *p_md)
Get media descriptor&#39;s user_data.
Row sequential.
Definition: libvlc_media.h:182
Definition: libvlc_media.h:239
Definition: libvlc_media.h:70
int i_profile
Definition: libvlc_media.h:217
#define VLC_FORWARD_DECLARE_OBJECT(a)
Definition: libvlc_media.h:621
unsigned int i_bitrate
Definition: libvlc_media.h:226
Definition: libvlc_media.h:241
Definition: libvlc_media.h:68
LIBVLC_API libvlc_media_t * libvlc_media_new_callbacks(libvlc_instance_t *instance, libvlc_media_open_cb open_cb, libvlc_media_read_cb read_cb, libvlc_media_seek_cb seek_cb, libvlc_media_close_cb close_cb, void *opaque)
Create a media with custom callbacks to read the data from.
struct libvlc_audio_track_t libvlc_audio_track_t
int i_demux_read_bytes
Definition: libvlc_media.h:120
360 spherical
Definition: libvlc_media.h:159
Definition: libvlc_media.h:62
Definition: libvlc_media.h:63
Definition: libvlc_media.h:53
int i_decoded_video
Definition: libvlc_media.h:126
Rotated 90 degrees anti-clockwise.
Definition: libvlc_media.h:152
LIBVLC_API void libvlc_media_tracks_release(libvlc_media_track_t **p_tracks, unsigned i_count)
Release media descriptor&#39;s elementary streams description array.
Definition: libvlc_media.h:289
LIBVLC_API void libvlc_media_set_meta(libvlc_media_t *p_md, libvlc_meta_t e_meta, const char *psz_value)
Set the meta of the media (this function will not save the meta, call libvlc_media_save_meta in order...
Definition: libvlc_media.h:72
Parse media even if it&#39;s a network file.
Definition: libvlc_media.h:260
const char * psz_name
Definition: text_style.c:33
LIBVLC_API void libvlc_media_set_user_data(libvlc_media_t *p_md, void *p_new_user_data)
Sets media descriptor&#39;s user_data.
Definition: libvlc_media.h:57
LIBVLC_API int libvlc_media_save_meta(libvlc_media_t *p_md)
Save the meta previously set.
Definition: libvlc_media.h:158
LIBVLC_API unsigned int libvlc_media_slaves_get(libvlc_media_t *p_md, libvlc_media_slave_t ***ppp_slaves)
Get a media descriptor&#39;s slave list.
int(* libvlc_media_seek_cb)(void *opaque, uint64_t offset)
Callback prototype to seek a custom bitstream input media.
Definition: libvlc_media.h:358
libvlc_subtitle_track_t * subtitle
Definition: libvlc_media.h:223
struct libvlc_media_stats_t libvlc_media_stats_t
Interact with the user (via libvlc_dialog_cbs) when preparsing this item (and not its sub items)...
Definition: libvlc_media.h:274
Definition: libvlc_media.h:243
LIBVLC_API void libvlc_media_slaves_release(libvlc_media_slave_t **pp_slaves, unsigned int i_count)
Release a media descriptor&#39;s slave list.
Definition: libvlc_media.h:96
Definition: libvlc_media.h:64
Parse media if it&#39;s a local file.
Definition: libvlc_media.h:256
Definition: libvlc_media.h:203
LIBVLC_API bool libvlc_media_get_stats(libvlc_media_t *p_md, libvlc_media_stats_t *p_stats)
Get the current statistics about the media.
LIBVLC_API libvlc_media_parsed_status_t libvlc_media_get_parsed_status(libvlc_media_t *p_md)
Get Parsed status for media descriptor object.
LIBVLC_API char * libvlc_media_get_meta(libvlc_media_t *p_md, libvlc_meta_t e_meta)
Read the meta of the media.
Definition: libvlc_media.h:188
Definition: libvlc_media.h:298
unsigned i_frame_rate_num
Definition: libvlc_media.h:194
int i_type
Definition: httpd.c:1270
Definition: libvlc_media.h:108
Rotated 90 degrees clockwise (or 270 anti-clockwise)
Definition: libvlc_media.h:151
Definition: libvlc_media.h:71
unsigned i_channels
Definition: libvlc_media.h:140
Definition: libvlc_media.h:67
Definition: libvlc_media.h:95
Definition: libvlc_media.h:69
libvlc_video_multiview_t i_multiview
Definition: libvlc_media.h:200
Column sequential.
Definition: libvlc_media.h:183
float f_demux_bitrate
Definition: libvlc_media.h:121
libvlc_track_type_t i_type
Definition: libvlc_media.h:214
libvlc_picture_type_t
Definition: libvlc_picture.h:32
Definition: libvlc_media.h:242
Definition: libvlc_media.h:56
float f_field_of_view
field of view in degrees ]0;180[ (default 80.)
Definition: libvlc_media.h:174
LIBVLC_API libvlc_state_t libvlc_media_get_state(libvlc_media_t *p_md)
Get current state of media descriptor object.
Definition: libvlc_media.h:87
Flipped vertically.
Definition: libvlc_media.h:148
char * psz_language
Definition: libvlc_media.h:227
LIBVLC_API libvlc_media_t * libvlc_media_duplicate(libvlc_media_t *p_md)
Duplicate a media descriptor object.
char psz_value[8]
Definition: vout_intf.c:99
Definition: libvlc_media.h:101
LIBVLC_API libvlc_media_thumbnail_request_t * libvlc_media_thumbnail_request_by_time(libvlc_media_t *md, libvlc_time_t time, libvlc_thumbnailer_seek_speed_t speed, unsigned int width, unsigned int height, bool crop, libvlc_picture_type_t picture_type, libvlc_time_t timeout)
libvlc_media_get_thumbnail_by_time Start an asynchronous thumbnail generation
int(* libvlc_media_open_cb)(void *opaque, void **datap, uint64_t *sizep)
Callback prototype to open a custom bitstream input media.
Definition: libvlc_media.h:330
Definition: libvlc_media.h:92
Definition: libvlc_media.h:58
Definition: libvlc_media.h:107
char * psz_description
Definition: libvlc_media.h:228
int i_read_bytes
Definition: libvlc_media.h:116
char * psz_encoding
Definition: libvlc_media.h:205
LIBVLC_API int libvlc_media_parse_with_options(libvlc_media_t *p_md, libvlc_media_parse_flag_t parse_flag, int timeout)
Parse the media asynchronously with options.
Definition: libvlc_media.h:240
Viewpoint.
Definition: libvlc_media.h:169
libvlc_media_slave_type_t i_type
Definition: libvlc_media.h:308
Top-bottom.
Definition: libvlc_media.h:181
Definition: libvlc_media.h:52
Definition: libvlc_media.h:51
Flipped horizontally.
Definition: libvlc_media.h:147
unsigned i_sar_num
Definition: libvlc_media.h:192
struct libvlc_video_track_t libvlc_video_track_t
Definition: libvlc_media.h:102
Definition: libvlc_media.h:113
float f_input_bitrate
Definition: libvlc_media.h:117
LIBVLC_API void libvlc_media_release(libvlc_media_t *p_md)
Decrement the reference count of a media descriptor object.
libvlc_media_parsed_status_t
Parse status used sent by libvlc_media_parse_with_options() or returned by libvlc_media_get_parsed_st...
Definition: libvlc_media.h:284
libvlc_video_projection_t
Definition: libvlc_media.h:156
int i_lost_abuffers
Definition: libvlc_media.h:135
Definition: libvlc_media.h:138
Frame sequential.
Definition: libvlc_media.h:184
Definition: libvlc_media.h:238
struct libvlc_instance_t libvlc_instance_t
This structure is opaque.
Definition: libvlc.h:76
uint32_t i_codec
Definition: libvlc_media.h:211
struct libvlc_media_list_t libvlc_media_list_t
Definition: libvlc_media_list.h:38
libvlc_video_multiview_t
Definition: libvlc_media.h:177
int i_played_abuffers
Definition: libvlc_media.h:134
struct libvlc_video_viewpoint_t libvlc_video_viewpoint_t
Viewpoint.
Definition: libvlc_media.h:287
Definition: libvlc_media.h:88
struct libvlc_subtitle_track_t libvlc_subtitle_track_t
int64_t libvlc_time_t
Definition: libvlc.h:78
LIBVLC_API void libvlc_media_thumbnail_request_cancel(libvlc_media_thumbnail_request_t *p_req)
libvlc_media_thumbnail_cancel cancels a thumbnailing request
LIBVLC_API const char * libvlc_media_get_codec_description(libvlc_track_type_t i_type, uint32_t i_codec)
Get codec description from media elementary stream.
libvlc_media_parse_flag_t
Parse flags used by libvlc_media_parse_with_options()
Definition: libvlc_media.h:251
int i_demux_corrupted
Definition: libvlc_media.h:122
Definition: libvlc_media.h:817
LIBVLC_API libvlc_media_t * libvlc_media_new_location(libvlc_instance_t *p_instance, const char *psz_mrl)
Create a media with a certain given media resource location, for instance a valid URL...
LIBVLC_API struct libvlc_media_list_t * libvlc_media_subitems(libvlc_media_t *p_md)
Get subitems of media descriptor object.
Normal.
Definition: libvlc_media.h:146
libvlc_media_type_t
Media type.
Definition: libvlc_media.h:237
No stereoscopy: 2D picture.
Definition: libvlc_media.h:179
int i_level
Definition: libvlc_media.h:218
int i_id
Definition: libvlc_media.h:213
int i_decoded_audio
Definition: libvlc_media.h:127
LIBVLC_API libvlc_event_manager_t * libvlc_media_event_manager(libvlc_media_t *p_md)
Get event manager from media descriptor object.
Definition: libvlc_media.h:50
LIBVLC_API void libvlc_media_thumbnail_request_destroy(libvlc_media_thumbnail_request_t *p_req)
libvlc_media_thumbnail_destroy destroys a thumbnail request
Definition: libvlc_media.h:297
Definition: libvlc_media.h:60
libvlc_video_orient_t i_orientation
Definition: libvlc_media.h:197
LIBVLC_API void libvlc_media_add_option_flag(libvlc_media_t *p_md, const char *psz_options, unsigned i_flags)
Add an option to the media with configurable flags.
ssize_t(* libvlc_media_read_cb)(void *opaque, unsigned char *buf, size_t len)
Callback prototype to read data from a custom bitstream input media.
Definition: libvlc_media.h:347
LIBVLC_API void libvlc_media_slaves_clear(libvlc_media_t *p_md)
Clear all slaves previously added by libvlc_media_slaves_add() or internally.
Definition: libvlc_media.h:47
int i_demux_discontinuity
Definition: libvlc_media.h:123
Definition: libvlc_media.h:48
LIBVLC_API void libvlc_media_add_option(libvlc_media_t *p_md, const char *psz_options)
Add an option to the media.
LIBVLC_API libvlc_media_t * libvlc_media_new_fd(libvlc_instance_t *p_instance, int fd)
Create a media for an already open file descriptor.
Definition: libvlc_media.h:110
Definition: libvlc_media.h:93
LIBVLC_API libvlc_media_type_t libvlc_media_get_type(libvlc_media_t *p_md)
Get the media type of the media descriptor object.
struct libvlc_media_track_t libvlc_media_track_t
unsigned i_frame_rate_den
Definition: libvlc_media.h:195
libvlc_video_orient_t
Definition: libvlc_media.h:144
Fetch meta and covert art using local resources.
Definition: libvlc_media.h:264
Definition: libvlc_media.h:818
unsigned i_sar_den
Definition: libvlc_media.h:193
unsigned int i_priority
Definition: libvlc_media.h:309
A slave of a libvlc_media_t.
Definition: libvlc_media.h:305
libvlc_video_track_t * video
Definition: libvlc_media.h:222
void(* libvlc_media_close_cb)(void *opaque)
Callback prototype to close a custom bitstream input media.
Definition: libvlc_media.h:366
struct libvlc_media_thumbnail_request_t libvlc_media_thumbnail_request_t
libvlc_media_thumbnail_request_t An opaque thumbnail request object
Definition: libvlc_media.h:813