src/player.h
author Benjamin Zores <ben@geexbox.org>
Sat Jul 31 12:22:03 2010 +0200 (4 weeks ago)
changeset 1496 e77ffbf606a9
parent 1482453378773227
permissions -rw-r--r--
add xine DirectFB vo support
     1 /*
     2  * GeeXboX libplayer: a multimedia A/V abstraction layer API.
     3  * Copyright (C) 2006-2008 Benjamin Zores <ben@geexbox.org>
     4  * Copyright (C) 2007-2008 Mathieu Schroeter <mathieu.schroeter@gamesover.ch>
     5  *
     6  * This file is part of libplayer.
     7  *
     8  * libplayer is free software; you can redistribute it and/or
     9  * modify it under the terms of the GNU Lesser General Public
    10  * License as published by the Free Software Foundation; either
    11  * version 2.1 of the License, or (at your option) any later version.
    12  *
    13  * libplayer is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16  * Lesser General Public License for more details.
    17  *
    18  * You should have received a copy of the GNU Lesser General Public
    19  * License along with libplayer; if not, write to the Free Software
    20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    21  */
    22 
    23 #ifndef PLAYER_H
    24 #define PLAYER_H
    25 
    26 /**
    27  * \file player.h
    28  *
    29  * GeeXboX libplayer public API header.
    30  */
    31 
    32 /**
    33  * \mainpage
    34  *
    35  * libplayer is a multimedia A/V abstraction layer API. Its goal is to
    36  * interact with Enna Media Center.
    37  *
    38  * libplayer provides a generic A/V API that relies on various multimedia
    39  * player for Linux systems. It currently supports
    40  * <a href="http://www.mplayerhq.hu">MPlayer</a> (through slave-mode), <a
    41  * href="http://www.xinehq.de">xine</a>, <a href="http://www.videolan.org">
    42  * VLC</a> and <a href="http://www.gstreamer.org">GStreamer</a>.
    43  *
    44  * Its main goal is to provide an unique API that player frontends can use
    45  * to control any kind of multimedia player underneath. For example, it
    46  * provides a library to easily control MPlayer famous slave-mode.
    47  *
    48  * \section mtlevel MT-Level
    49  * Most functions in this API are indicated as being MT-Safe in multithreaded
    50  * applications. That is right <b>only</b> if the functions are used
    51  * concurrently with the same (#player_t) controller. Else, unexpected
    52  * behaviours can appear.
    53  */
    54 
    55 #ifdef __cplusplus
    56 extern "C" {
    57 #if 0 /* avoid EMACS indent */
    58 }
    59 #endif /* 0 */
    60 #endif /* __cplusplus */
    61 
    62 #ifndef pl_unused
    63 #if defined(__GNUC__)
    64 #  define pl_unused __attribute__((unused))
    65 #else
    66 #  define pl_unused
    67 #endif
    68 #endif
    69 
    70 #define PL_STRINGIFY(s) #s
    71 #define PL_TOSTRING(s) PL_STRINGIFY(s)
    72 
    73 #define PL_VERSION_INT(a, b, c) (a << 16 | b << 8 | c)
    74 #define PL_VERSION_DOT(a, b, c) a ##.## b ##.## c
    75 #define PL_VERSION(a, b, c) PL_VERSION_DOT(a, b, c)
    76 
    77 #define LIBPLAYER_VERSION_MAJOR  2
    78 #define LIBPLAYER_VERSION_MINOR  0
    79 #define LIBPLAYER_VERSION_MICRO  0
    80 
    81 #define LIBPLAYER_VERSION_INT PL_VERSION_INT(LIBPLAYER_VERSION_MAJOR, \
    82                                              LIBPLAYER_VERSION_MINOR, \
    83                                              LIBPLAYER_VERSION_MICRO)
    84 #define LIBPLAYER_VERSION     PL_VERSION(LIBPLAYER_VERSION_MAJOR, \
    85                                          LIBPLAYER_VERSION_MINOR, \
    86                                          LIBPLAYER_VERSION_MICRO)
    87 #define LIBPLAYER_VERSION_STR PL_TOSTRING(LIBPLAYER_VERSION)
    88 #define LIBPLAYER_BUILD       LIBPLAYER_VERSION_INT
    89 
    90 #include <inttypes.h>
    91 #include <sys/types.h>
    92 
    93 /**
    94  * \brief Return LIBPLAYER_VERSION_INT constant.
    95  */
    96 unsigned int libplayer_version (void);
    97 
    98 
    99 /***************************************************************************/
   100 /*                                                                         */
   101 /* Player (Un)Initialization                                               */
   102 /*  Mandatory for all operations below                                     */
   103 /*                                                                         */
   104 /***************************************************************************/
   105 
   106 /**
   107  * \brief Player controller.
   108  *
   109  * This controls a multimedia player.
   110  */
   111 typedef struct player_s player_t;
   112 
   113 /** \brief Player types. */
   114 typedef enum player_type {
   115   PLAYER_TYPE_XINE,
   116   PLAYER_TYPE_MPLAYER,
   117   PLAYER_TYPE_VLC,
   118   PLAYER_TYPE_GSTREAMER,
   119   PLAYER_TYPE_DUMMY
   120 } player_type_t;
   121 
   122 /** \brief Player video outputs. */
   123 typedef enum player_vo {
   124   PLAYER_VO_AUTO = 0,
   125   PLAYER_VO_NULL,
   126   PLAYER_VO_X11,
   127   PLAYER_VO_X11_SDL,
   128   PLAYER_VO_XV,
   129   PLAYER_VO_GL,
   130   PLAYER_VO_FB,
   131   PLAYER_VO_DIRECTFB,
   132   PLAYER_VO_VDPAU,
   133   PLAYER_VO_OMAP
   134 } player_vo_t;
   135 
   136 /** \brief Player audio outputs. */
   137 typedef enum player_ao {
   138   PLAYER_AO_AUTO = 0,
   139   PLAYER_AO_NULL,
   140   PLAYER_AO_ALSA,
   141   PLAYER_AO_OSS,
   142   PLAYER_AO_PULSE,
   143 } player_ao_t;
   144 
   145 /** \brief Player events. */
   146 typedef enum player_event {
   147   PLAYER_EVENT_UNKNOWN,
   148   PLAYER_EVENT_PLAYBACK_START,
   149   PLAYER_EVENT_PLAYBACK_STOP,
   150   PLAYER_EVENT_PLAYBACK_FINISHED,
   151   PLAYER_EVENT_PLAYLIST_FINISHED,
   152   PLAYER_EVENT_PLAYBACK_PAUSE,
   153   PLAYER_EVENT_PLAYBACK_UNPAUSE,
   154 } player_event_t;
   155 
   156 /** \brief Player verbosity. */
   157 typedef enum {
   158   PLAYER_MSG_NONE,          /* no error messages */
   159   PLAYER_MSG_VERBOSE,       /* super-verbose mode: mostly for debugging */
   160   PLAYER_MSG_INFO,          /* working operations */
   161   PLAYER_MSG_WARNING,       /* harmless failures */
   162   PLAYER_MSG_ERROR,         /* may result in hazardous behavior */
   163   PLAYER_MSG_CRITICAL,      /* prevents lib from working */
   164 } player_verbosity_level_t;
   165 
   166 typedef enum {
   167   PLAYER_QUALITY_NORMAL,    /* normal picture quality */
   168   PLAYER_QUALITY_LOW,       /* slightly degraded picture for fastest playback */
   169   PLAYER_QUALITY_LOWEST,    /* degraded picture, suitable for low-end CPU */
   170 } player_quality_level_t;
   171 
   172 /** \brief Parameters for player_init() .*/
   173 typedef struct player_init_param_s {
   174   /** Audio output driver. */
   175   player_ao_t ao;
   176   /** Video output driver. */
   177   player_vo_t vo;
   178   /** Window ID to attach the video (X Window). */
   179   uint32_t winid;
   180 
   181   /** Public event callback. */
   182   int (*event_cb) (player_event_t e, void *data);
   183   /** User data for event callback. */
   184   void *data;
   185 
   186   /**
   187    * Display to use with X11 video outputs.
   188    *
   189    * The string has to follow the same rules that the DISPLAY environment
   190    * variable. If \p display is NULL, then the environment variable is
   191    * considered.
   192    */
   193   const char *display;
   194 
   195   /** Picture decoding quality. */
   196   player_quality_level_t quality;
   197 
   198 } player_init_param_t;
   199 
   200 /**
   201  * \name Player (Un)Initialization.
   202  * @{
   203  */
   204 
   205 /**
   206  * \brief Initialization of a new player controller.
   207  *
   208  * Multiple player controllers can be initialized with any wrappers.
   209  * The same Window ID can be used to attach their video.
   210  *
   211  * For a description of each parameters supported by this function:
   212  * \see ::player_init_param_t
   213  *
   214  * When a parameter in \p param is 0 (or NULL), its default value is used.
   215  * If \p param is NULL, then all default values are forced for all parameters.
   216  *
   217  * Wrappers supported (even partially):
   218  *  GStreamer, MPlayer, VLC, xine
   219  *
   220  * \param[in] type        Type of wrapper to load.
   221  * \param[in] verbosity   Level of verbosity to set.
   222  * \param[in] param       Parameters, NULL for default values.
   223  * \return Player controller, NULL otherwise.
   224  */
   225 player_t *player_init (player_type_t type, player_verbosity_level_t verbosity,
   226                        player_init_param_t *param);
   227 
   228 /**
   229  * \brief Uninitialization of a player controller.
   230  *
   231  * All MRL objects in the internal playlist will be freed.
   232  *
   233  * Wrappers supported (even partially):
   234  *  GStreamer, MPlayer, VLC, xine
   235  *
   236  * \warning Must be used only as the last player function for a controller.
   237  * \param[in] player      Player controller.
   238  */
   239 void player_uninit (player_t *player);
   240 
   241 /**
   242  * \brief Set verbosity level.
   243  *
   244  * Wrappers supported (even partially):
   245  *  MPlayer, VLC, xine
   246  *
   247  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   248  * \param[in] player      Player controller.
   249  * \param[in] level       Level of verbosity to set.
   250  */
   251 void player_set_verbosity (player_t *player, player_verbosity_level_t level);
   252 
   253 /**
   254  * @}
   255  */
   256 
   257 /***************************************************************************/
   258 /*                                                                         */
   259 /* Media Resource Locater (MRL) Helpers                                    */
   260 /*  MRLs can have multiple types and are used to define a stream           */
   261 /*                                                                         */
   262 /***************************************************************************/
   263 
   264 /**
   265  * \brief MRL object.
   266  *
   267  * This handles an audio, video or image resource.
   268  */
   269 typedef struct mrl_s mrl_t;
   270 
   271 /** \brief MRL types. */
   272 typedef enum mrl_type {
   273   MRL_TYPE_UNKNOWN,
   274   MRL_TYPE_AUDIO,
   275   MRL_TYPE_VIDEO,
   276   MRL_TYPE_IMAGE,
   277 } mrl_type_t;
   278 
   279 /*
   280  * Support by wrappers
   281  *
   282  *                           GStreamer     MPlayer        VLC         xine
   283  *                         ------------ ------------ ------------ ------------
   284  */
   285 /** \brief MRL resources. */
   286 typedef enum mrl_resource {
   287   MRL_RESOURCE_UNKNOWN,
   288 
   289   /* Local Streams */
   290   MRL_RESOURCE_FIFO,        /*  NO           NO           NO           NO   */
   291   MRL_RESOURCE_FILE,        /*  NO           YES          YES          YES  */
   292   MRL_RESOURCE_STDIN,       /*  NO           NO           NO           NO   */
   293 
   294   /* Audio CD */
   295   MRL_RESOURCE_CDDA,        /*  NO           YES          NO           NO   */
   296   MRL_RESOURCE_CDDB,        /*  NO           YES          NO           NO   */
   297 
   298   /* Video discs */
   299   MRL_RESOURCE_DVD,         /*  NO           YES          YES          YES  */
   300   MRL_RESOURCE_DVDNAV,      /*  NO           YES          YES          YES  */
   301   MRL_RESOURCE_VCD,         /*  NO           YES          NO           NO   */
   302 
   303   /* Radio/Television */
   304   MRL_RESOURCE_DVB,         /*  NO           YES          NO           NO   */
   305   MRL_RESOURCE_PVR,         /*  NO           NO           NO           NO   */
   306   MRL_RESOURCE_RADIO,       /*  NO           YES          NO           NO   */
   307   MRL_RESOURCE_TV,          /*  NO           YES          NO           NO   */
   308   MRL_RESOURCE_VDR,         /*  NO           NO           NO           YES  */
   309 
   310   /* Network Streams */
   311   MRL_RESOURCE_FTP,         /*  NO           YES          YES          NO   */
   312   MRL_RESOURCE_HTTP,        /*  NO           YES          YES          YES  */
   313   MRL_RESOURCE_MMS,         /*  NO           YES          YES          YES  */
   314   MRL_RESOURCE_NETVDR,      /*  NO           NO           NO           YES  */
   315   MRL_RESOURCE_RTP,         /*  NO           YES          YES          YES  */
   316   MRL_RESOURCE_RTSP,        /*  NO           YES          YES          NO   */
   317   MRL_RESOURCE_SMB,         /*  NO           YES          YES          NO   */
   318   MRL_RESOURCE_TCP,         /*  NO           NO           NO           YES  */
   319   MRL_RESOURCE_UDP,         /*  NO           YES          YES          YES  */
   320   MRL_RESOURCE_UNSV,        /*  NO           YES          YES          NO   */
   321 } mrl_resource_t;
   322 
   323 /** \brief Arguments for local streams. */
   324 typedef struct mrl_resource_local_args_s {
   325   char *location;           /*  NO           YES          YES          YES  */
   326   int playlist;             /*  NO           NO           NO           NO   */
   327 } mrl_resource_local_args_t;
   328 
   329 /** \brief Arguments for audio CD. */
   330 typedef struct mrl_resource_cd_args_s {
   331   char *device;             /*  NO           YES          NO           NO   */
   332   uint8_t speed;            /*  NO           YES          NO           NO   */
   333   uint8_t track_start;      /*  NO           YES          NO           NO   */
   334   uint8_t track_end;        /*  NO           YES          NO           NO   */
   335 } mrl_resource_cd_args_t;
   336 
   337 /** \brief Arguments for video discs. */
   338 typedef struct mrl_resource_videodisc_args_s {
   339   char *device;             /*  NO           YES          YES          YES  */
   340   uint8_t speed;            /*  NO           NO           NO           NO   */
   341   uint8_t angle;            /*  NO           YES          YES          NO   */
   342   uint8_t title_start;      /*  NO           YES          YES          YES  */
   343   uint8_t title_end;        /*  NO           YES          NO           NO   */
   344   uint8_t chapter_start;    /*  NO           NO           YES          NO   */
   345   uint8_t chapter_end;      /*  NO           NO           NO           NO   */
   346   uint8_t track_start;      /*  NO           YES          NO           NO   */
   347   uint8_t track_end;        /*  NO           NO           NO           NO   */
   348   char *audio_lang;         /*  NO           NO           NO           NO   */
   349   char *sub_lang;           /*  NO           NO           NO           NO   */
   350   uint8_t sub_cc;           /*  NO           NO           NO           NO   */
   351 } mrl_resource_videodisc_args_t;
   352 
   353 /** \brief Arguments for radio/tv streams. */
   354 typedef struct mrl_resource_tv_args_s {
   355   char *device;             /*  NO           NO           NO           YES  */
   356   char *driver;             /*  NO           NO           NO           YES  */
   357   char *channel;            /*  NO           YES          NO           NO   */
   358   uint8_t input;            /*  NO           YES          NO           NO   */
   359   int width;                /*  NO           NO           NO           NO   */
   360   int height;               /*  NO           NO           NO           NO   */
   361   int fps;                  /*  NO           NO           NO           NO   */
   362   char *output_format;      /*  NO           NO           NO           NO   */
   363   char *norm;               /*  NO           YES          NO           NO   */
   364 } mrl_resource_tv_args_t;
   365 
   366 /** \brief Arguments for network streams. */
   367 typedef struct mrl_resource_network_args_s {
   368   char *url;                /*  NO           YES          NO           YES  */
   369   char *username;           /*  NO           YES          NO           NO   */
   370   char *password;           /*  NO           YES          NO           NO   */
   371   char *user_agent;         /*  NO           NO           NO           NO   */
   372 } mrl_resource_network_args_t;
   373 
   374 /** \brief Snapshot image file type. */
   375 typedef enum mrl_snapshot {
   376   MRL_SNAPSHOT_JPG,         /*  NO           YES          NO           NO   */
   377   MRL_SNAPSHOT_PNG,         /*  NO           YES          NO           NO   */
   378   MRL_SNAPSHOT_PPM,         /*  NO           YES          NO           NO   */
   379   MRL_SNAPSHOT_TGA,         /*  NO           NO           NO           NO   */
   380 } mrl_snapshot_t;
   381 
   382 /** \brief MRL metadata. */
   383 typedef enum mrl_metadata_type {
   384   MRL_METADATA_TITLE,
   385   MRL_METADATA_ARTIST,
   386   MRL_METADATA_GENRE,
   387   MRL_METADATA_ALBUM,
   388   MRL_METADATA_YEAR,
   389   MRL_METADATA_TRACK,
   390   MRL_METADATA_COMMENT,
   391 } mrl_metadata_type_t;
   392 
   393 /** \brief MRL CDDA/CDDB metadata. */
   394 typedef enum mrl_metadata_cd_type {
   395   MRL_METADATA_CD_DISCID,
   396   MRL_METADATA_CD_TRACKS,
   397 } mrl_metadata_cd_type_t;
   398 
   399 /** \brief MRL DVD/DVDNAV metadata. */
   400 typedef enum mrl_metadata_dvd_type {
   401   MRL_METADATA_DVD_TITLE_CHAPTERS,
   402   MRL_METADATA_DVD_TITLE_ANGLES,
   403   MRL_METADATA_DVD_TITLE_LENGTH,
   404 } mrl_metadata_dvd_type_t;
   405 
   406 /** \brief MRL properties. */
   407 typedef enum mrl_properties_type {
   408   MRL_PROPERTY_SEEKABLE,
   409   MRL_PROPERTY_LENGTH,
   410   MRL_PROPERTY_AUDIO_BITRATE,
   411   MRL_PROPERTY_AUDIO_BITS,
   412   MRL_PROPERTY_AUDIO_CHANNELS,
   413   MRL_PROPERTY_AUDIO_SAMPLERATE,
   414   MRL_PROPERTY_VIDEO_BITRATE,
   415   MRL_PROPERTY_VIDEO_WIDTH,
   416   MRL_PROPERTY_VIDEO_HEIGHT,
   417   MRL_PROPERTY_VIDEO_ASPECT,
   418   MRL_PROPERTY_VIDEO_CHANNELS,
   419   MRL_PROPERTY_VIDEO_STREAMS,
   420   MRL_PROPERTY_VIDEO_FRAMEDURATION,
   421 } mrl_properties_type_t;
   422 
   423 #define PLAYER_VIDEO_ASPECT_RATIO_MULT         10000.0    /* *10000         */
   424 #define PLAYER_VIDEO_FRAMEDURATION_RATIO_DIV   90000.0    /* 1/90000 sec    */
   425 
   426 /**
   427  * \name Media Resource Locater (MRL) Helpers.
   428  * @{
   429  */
   430 
   431 /**
   432  * \brief Create a new MRL object.
   433  *
   434  * This function can be slow when the stream is not (fastly) reachable.
   435  *
   436  * The argument \p args and the strings provided with \p args must be
   437  * allocated dynamically. The pointers are freed by libplayer when a mrl
   438  * is no longer available.
   439  *
   440  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   441  * \param[in] player      Player controller.
   442  * \param[in] res         Resource type.
   443  * \param[in] args        Arguments specific to the resource type.
   444  * \return MRL object, NULL otherwise.
   445  */
   446 mrl_t *mrl_new (player_t *player, mrl_resource_t res, void *args);
   447 
   448 /**
   449  * \brief Add a subtitle file to a MRL object.
   450  *
   451  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   452  * \param[in] player      Player controller.
   453  * \param[in] mrl         MRL object, NULL for current.
   454  * \param[in] subtitle    Location of the subtitle file to be added.
   455  */
   456 void mrl_add_subtitle (player_t *player, mrl_t *mrl, char *subtitle);
   457 
   458 /**
   459  * \brief Free a MRL object.
   460  *
   461  * Never use this function when the MRL (or a linked MRL) is set in the
   462  * playlist of a player controller.
   463  *
   464  * \warning Must be used only as the last mrl function for one MRL object.
   465  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   466  * \param[in] player      Player controller.
   467  * \param[in] mrl         MRL object.
   468  */
   469 void mrl_free (player_t *player, mrl_t *mrl);
   470 
   471 /**
   472  * \brief Get type of the stream.
   473  *
   474  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   475  * \param[in] player      Player controller.
   476  * \param[in] mrl         MRL object, NULL for current.
   477  * \return Type of MRL object.
   478  */
   479 mrl_type_t mrl_get_type (player_t *player, mrl_t *mrl);
   480 
   481 /**
   482  * \brief Get resource of the stream.
   483  *
   484  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   485  * \param[in] player      Player controller.
   486  * \param[in] mrl         MRL object, NULL for current.
   487  * \return Resource of MRL object.
   488  */
   489 mrl_resource_t mrl_get_resource (player_t *player, mrl_t *mrl);
   490 
   491 /**
   492  * \brief Get metadata of the stream.
   493  *
   494  * This function can be slow when the stream is not (fastly) reachable.
   495  *
   496  * Wrappers supported (even partially):
   497  *  MPlayer, VLC, xine
   498  *
   499  * \warning The returned pointer must be freed when no longer used.
   500  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   501  * \param[in] player      Player controller.
   502  * \param[in] mrl         MRL object, NULL for current.
   503  * \param[in] m           Type of metadata to get.
   504  * \return Metadata string, NULL otherwise.
   505  */
   506 char *mrl_get_metadata (player_t *player, mrl_t *mrl, mrl_metadata_type_t m);
   507 
   508 /**
   509  * \brief Get metadata of a track with CDDA/CDDB MRL object.
   510  *
   511  * This function can be slow when the stream is not (fastly) reachable.
   512  *
   513  * Wrappers supported (even partially):
   514  *  MPlayer
   515  *
   516  * \warning The returned pointer must be freed when no longer used.
   517  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   518  * \param[in] player      Player controller.
   519  * \param[in] mrl         MRL object, NULL for current.
   520  * \param[in] trackid     Track ID on the CD.
   521  * \param[out] length     Length of the track (millisecond).
   522  * \return Title of the track (CDDB only), NULL otherwise.
   523  */
   524 char *mrl_get_metadata_cd_track (player_t *player,
   525                                  mrl_t *mrl, int trackid, uint32_t *length);
   526 
   527 /**
   528  * \brief Get metadata of a CDDA/CDDB MRL object.
   529  *
   530  * This function can be slow when the stream is not (fastly) reachable.
   531  *
   532  * Wrappers supported (even partially):
   533  *  MPlayer
   534  *
   535  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   536  * \param[in] player      Player controller.
   537  * \param[in] mrl         MRL object, NULL for current.
   538  * \param[in] m           Type of metadata to get.
   539  * \return Metadata value.
   540  */
   541 uint32_t mrl_get_metadata_cd (player_t *player,
   542                               mrl_t *mrl, mrl_metadata_cd_type_t m);
   543 
   544 /**
   545  * \brief Get metadata of a title with DVD/DVDNAV MRL object.
   546  *
   547  * This function can be slow when the stream is not (fastly) reachable.
   548  *
   549  * Wrappers supported (even partially):
   550  *  MPlayer
   551  *
   552  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   553  * \param[in] player      Player controller.
   554  * \param[in] mrl         MRL object, NULL for current.
   555  * \param[in] titleid     Title ID on the DVD.
   556  * \param[in] m           Type of metadata to get.
   557  * \return Metadata value.
   558  */
   559 uint32_t mrl_get_metadata_dvd_title (player_t *player, mrl_t *mrl,
   560                                      int titleid, mrl_metadata_dvd_type_t m);
   561 
   562 /**
   563  * \brief Get metadata of a DVD/DVDNAV MRL object.
   564  *
   565  * This function can be slow when the stream is not (fastly) reachable.
   566  *
   567  * Wrappers supported (even partially):
   568  *  MPlayer, xine
   569  *
   570  * \warning The returned pointer must be freed when no longer used.
   571  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   572  * \param[in] player      Player controller.
   573  * \param[in] mrl         MRL object, NULL for current.
   574  * \param[out] titles     How many titles on the DVD.
   575  * \return Volume ID, NULL otherwise.
   576  */
   577 char *mrl_get_metadata_dvd (player_t *player, mrl_t *mrl, uint8_t *titles);
   578 
   579 /**
   580  * \brief Get subtitle metadata of the MRL object.
   581  *
   582  * This function can be slow when the stream is not (fastly) reachable.
   583  *
   584  * The \p pos argument is the position of the subtitle in the internal list
   585  * of libplayer. The first subtitle begins with 1.
   586  * \p id returned by this function can be used with player_subtitle_select().
   587  *
   588  * Wrappers supported (even partially):
   589  *  MPlayer
   590  *
   591  * \warning The pointers (\p name and \p lang) must be freed when no longer used.
   592  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   593  * \param[in] player      Player controller.
   594  * \param[in] mrl         MRL object, NULL for current.
   595  * \param[in] pos         Position of the subtitle.
   596  * \param[out] id         ID of the subtitle, NULL to ignore.
   597  * \param[out] name       Name of the subtitle, NULL to ignore.
   598  * \param[out] lang       Language of the subtitle, NULL to ignore.
   599  * \return 1 for success, 0 if the subtitle is not available.
   600  */
   601 int mrl_get_metadata_subtitle (player_t *player, mrl_t *mrl, int pos,
   602                                uint32_t *id, char **name, char **lang);
   603 
   604 /**
   605  * \brief Get the number of available subtitles.
   606  *
   607  * This function can be slow when the stream is not (fastly) reachable.
   608  *
   609  * Wrappers supported (even partially):
   610  *  MPlayer
   611  *
   612  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   613  * \param[in] player      Player controller.
   614  * \param[in] mrl         MRL object, NULL for current.
   615  * \return Number of subtitles.
   616  */
   617 uint32_t mrl_get_metadata_subtitle_nb (player_t *player, mrl_t *mrl);
   618 
   619 /**
   620  * \brief Get audio metadata of the MRL object.
   621  *
   622  * This function can be slow when the stream is not (fastly) reachable.
   623  *
   624  * The \p pos argument is the position of the audio stream in the internal list
   625  * of libplayer. The first audio stream begins with 1.
   626  * \p id returned by this function can be used with player_audio_select().
   627  *
   628  * Wrappers supported (even partially):
   629  *  MPlayer
   630  *
   631  * \warning The pointers (\p name and \p lang) must be freed when no longer used.
   632  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   633  * \param[in] player      Player controller.
   634  * \param[in] mrl         MRL object, NULL for current.
   635  * \param[in] pos         Position of the audio stream.
   636  * \param[out] id         ID of the audio stream, NULL to ignore.
   637  * \param[out] name       Name of the audio stream, NULL to ignore.
   638  * \param[out] lang       Language of the audio stream, NULL to ignore.
   639  * \return 1 for success, 0 if the audio stream is not available.
   640  */
   641 int mrl_get_metadata_audio (player_t *player, mrl_t *mrl, int pos,
   642                             uint32_t *id, char **name, char **lang);
   643 
   644 /**
   645  * \brief Get the number of available audio streams.
   646  *
   647  * This function can be slow when the stream is not (fastly) reachable.
   648  *
   649  * Wrappers supported (even partially):
   650  *  MPlayer
   651  *
   652  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   653  * \param[in] player      Player controller.
   654  * \param[in] mrl         MRL object, NULL for current.
   655  * \return Number of audio streams.
   656  */
   657 uint32_t mrl_get_metadata_audio_nb (player_t *player, mrl_t *mrl);
   658 
   659 /**
   660  * \brief Get property of the stream.
   661  *
   662  * Wrappers supported (even partially):
   663  *  MPlayer, VLC, xine
   664  *
   665  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   666  * \param[in] player      Player controller.
   667  * \param[in] mrl         MRL object, NULL for current.
   668  * \param[in] p           Type of property.
   669  * \return Property value.
   670  */
   671 uint32_t mrl_get_property (player_t *player,
   672                            mrl_t *mrl, mrl_properties_type_t p);
   673 
   674 /**
   675  * \brief Get audio codec name of the stream.
   676  *
   677  * Wrappers supported (even partially):
   678  *  MPlayer, xine
   679  *
   680  * \warning The returned pointer must be freed when no longer used.
   681  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   682  * \param[in] player      Player controller.
   683  * \param[in] mrl         MRL object, NULL for current.
   684  * \return Audio codec name, NULL otherwise.
   685  */
   686 char *mrl_get_audio_codec (player_t *player, mrl_t *mrl);
   687 
   688 /**
   689  * \brief Get video codec name of the stream.
   690  *
   691  * Wrappers supported (even partially):
   692  *  MPlayer, xine
   693  *
   694  * \warning The returned pointer must be freed when no longer used.
   695  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   696  * \param[in] player      Player controller.
   697  * \param[in] mrl         MRL object, NULL for current.
   698  * \return Video codec name, NULL otherwise.
   699  */
   700 char *mrl_get_video_codec (player_t *player, mrl_t *mrl);
   701 
   702 /**
   703  * \brief Get size of the resource.
   704  *
   705  * Wrappers supported (even partially):
   706  *  MPlayer, VLC, xine
   707  *
   708  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   709  * \param[in] player      Player controller.
   710  * \param[in] mrl         MRL object, NULL for current.
   711  * \return Size of the stream (bytes).
   712  */
   713 off_t mrl_get_size (player_t *player, mrl_t *mrl);
   714 
   715 /**
   716  * \brief Take a video snapshot.
   717  *
   718  * One frame at the \p pos (in second) is saved to \p dst.
   719  *
   720  * Wrappers supported (even partially):
   721  *  MPlayer, VLC
   722  *
   723  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   724  * \param[in] player      Player controller.
   725  * \param[in] mrl         MRL object, NULL for current.
   726  * \param[in] pos         Time position (second).
   727  * \param[in] t           Image file type.
   728  * \param[in] dst         Destination file, NULL for default filename
   729  *                        in the current directory.
   730  */
   731 void mrl_video_snapshot (player_t *player, mrl_t *mrl,
   732                          int pos, mrl_snapshot_t t, const char *dst);
   733 
   734 /**
   735  * @}
   736  */
   737 
   738 /***************************************************************************/
   739 /*                                                                         */
   740 /* Player to MRL connection                                                */
   741 /*                                                                         */
   742 /***************************************************************************/
   743 
   744 /** \brief Player MRL add mode. */
   745 typedef enum player_mrl_add {
   746   PLAYER_MRL_ADD_NOW,
   747   PLAYER_MRL_ADD_QUEUE
   748 } player_mrl_add_t;
   749 
   750 /**
   751  * \name Player to MRL connection.
   752  * @{
   753  */
   754 
   755 /**
   756  * \brief Get current MRL set in the internal playlist.
   757  *
   758  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   759  * \param[in] player      Player controller.
   760  * \return MRL object.
   761  */
   762 mrl_t *player_mrl_get_current (player_t *player);
   763 
   764 /**
   765  * \brief Set MRL object in the internal playlist.
   766  *
   767  * If a MRL was already set in the playlist, then the current is freed and
   768  * replaced by the new MRL object.
   769  *
   770  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   771  * \param[in] player      Player controller.
   772  * \param[in] mrl         MRL object to set.
   773  */
   774 void player_mrl_set (player_t *player, mrl_t *mrl);
   775 
   776 /**
   777  * \brief Append MRL object in the internal playlist.
   778  *
   779  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   780  * \param[in] player      Player controller.
   781  * \param[in] mrl         MRL object to append.
   782  * \param[in] when        Just append, or append and go to the end to play.
   783  */
   784 void player_mrl_append (player_t *player, mrl_t *mrl, player_mrl_add_t when);
   785 
   786 /**
   787  * \brief Remove current MRL object in the internal playlist.
   788  *
   789  * Current MRL object is freed on the way.
   790  *
   791  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   792  * \param[in] player      Player controller.
   793  */
   794 void player_mrl_remove (player_t *player);
   795 
   796 /**
   797  * \brief Remove all MRL objects in the internal playlist.
   798  *
   799  * All MRL objects are freed on the way.
   800  *
   801  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   802  * \param[in] player      Player controller.
   803  */
   804 void player_mrl_remove_all (player_t *player);
   805 
   806 /**
   807  * \brief Go the the previous MRL object in the internal playlist.
   808  *
   809  * Playback is started if a previous MRL object exists.
   810  *
   811  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   812  * \param[in] player      Player controller.
   813  */
   814 void player_mrl_previous (player_t *player);
   815 
   816 /**
   817  * \brief Go the the next MRL object in the internal playlist.
   818  *
   819  * Playback is started if a next MRL object exists.
   820  *
   821  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   822  * \param[in] player      Player controller.
   823  */
   824 void player_mrl_next (player_t *player);
   825 
   826 /**
   827  * @}
   828  */
   829 
   830 /***************************************************************************/
   831 /*                                                                         */
   832 /* Player tuning & properties                                              */
   833 /*                                                                         */
   834 /***************************************************************************/
   835 
   836 /** \brief Player playback mode. */
   837 typedef enum player_pb {
   838   PLAYER_PB_SINGLE = 0,
   839   PLAYER_PB_AUTO,
   840 } player_pb_t;
   841 
   842 /** \brief Player loop mode. */
   843 typedef enum player_loop {
   844   PLAYER_LOOP_DISABLE = 0,
   845   PLAYER_LOOP_ELEMENT,
   846   PLAYER_LOOP_PLAYLIST,
   847 } player_loop_t;
   848 
   849 /** \brief Player frame dropping mode. */
   850 typedef enum player_framedrop {
   851   PLAYER_FRAMEDROP_DISABLE,
   852   PLAYER_FRAMEDROP_SOFT,
   853   PLAYER_FRAMEDROP_HARD,
   854 } player_framedrop_t;
   855 
   856 /** \brief Player X11 window flags. */
   857 typedef enum player_x_window_flags {
   858   PLAYER_X_WINDOW_AUTO = 0,
   859   PLAYER_X_WINDOW_X    = (1 << 0),
   860   PLAYER_X_WINDOW_Y    = (1 << 1),
   861   PLAYER_X_WINDOW_W    = (1 << 2),
   862   PLAYER_X_WINDOW_H    = (1 << 3),
   863 } player_x_window_flags_t;
   864 
   865 /**
   866  * \name Player tuning & properties.
   867  * @{
   868  */
   869 
   870 /**
   871  * \brief Get current time position in the current stream.
   872  *
   873  * Wrappers supported (even partially):
   874  *  MPlayer, VLC, xine
   875  *
   876  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   877  * \param[in] player      Player controller.
   878  * \return Time position (millisecond).
   879  */
   880 int player_get_time_pos (player_t *player);
   881 
   882 /**
   883  * \brief Get percent position in the current stream.
   884  *
   885  * Wrapper supported (even partially):
   886  *  MPlayer, VLC, xine
   887  *
   888  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   889  * \param[in] player      Player controller.
   890  * \return Percent position.
   891  */
   892 int player_get_percent_pos (player_t *player);
   893 
   894 /**
   895  * \brief Set playback mode.
   896  *
   897  * If the playback mode is set to PLAYER_PB_AUTO, then loop and shuffle can
   898  * be used with the internal playlist. By default, AUTO will just going
   899  * to the next available MRL object in the playlist and start a new playback.
   900  *
   901  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   902  * \param[in] player      Player controller.
   903  * \param[in] pb          Mode to use.
   904  */
   905 void player_set_playback (player_t *player, player_pb_t pb);
   906 
   907 /**
   908  * \brief Set loop mode and value.
   909  *
   910  * Only enabled if playback mode is auto, see player_set_playback().
   911  *
   912  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   913  * \param[in] player      Player controller.
   914  * \param[in] loop        Mode to use (one element or the whole playlist).
   915  * \param[in] value       How many loops, negative for infinite.
   916  */
   917 void player_set_loop (player_t *player, player_loop_t loop, int value);
   918 
   919 /**
   920  * \brief Shuffle playback in the internal playlist.
   921  *
   922  * Only enabled if playback mode is auto, see player_set_playback().
   923  *
   924  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   925  * \param[in] player      Player controller.
   926  * \param[in] value       Different of 0 to enable.
   927  */
   928 void player_set_shuffle (player_t *player, int value);
   929 
   930 /**
   931  * \brief Set frame dropping with video playback.
   932  *
   933  * Wrappers supported (even partially):
   934  *  MPlayer
   935  *
   936  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   937  * \param[in] player      Player controller.
   938  * \param[in] fd          Frame dropping type to set.
   939  */
   940 void player_set_framedrop (player_t *player, player_framedrop_t fd);
   941 
   942 /**
   943  * \brief Set the mouse position to the player.
   944  *
   945  * The main goal is to select buttons in DVD menu. The coordinates are
   946  * relative to the top-left corner of the root window. The root window is
   947  * \p winid passed with player_init().
   948  *
   949  * Wrappers supported (even partially):
   950  *  MPlayer, xine
   951  *
   952  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   953  * \param[in] player      Player controller.
   954  * \param[in] x           X coordinate (pixel).
   955  * \param[in] y           Y coordinate (pixel).
   956  */
   957 void player_set_mouse_position (player_t *player, int x, int y);
   958 
   959 /**
   960  * \brief Set properties of X11 window handled by libplayer.
   961  *
   962  * Origin to the top-left corner.
   963  *
   964  * Wrappers supported (even partially):
   965  *  MPlayer, xine
   966  *
   967  * \warning Only usable with video outputs X11 compliant.
   968  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   969  * \param[in] player      Player controller.
   970  * \param[in] x           X coordinate (pixel).
   971  * \param[in] y           Y coordinate (pixel).
   972  * \param[in] w           Width (pixel).
   973  * \param[in] h           Height (pixel).
   974  * \param[in] flags       Flags to select properties to change.
   975  */
   976 void player_x_window_set_properties (player_t *player,
   977                                      int x, int y, int w, int h, int flags);
   978 
   979 /**
   980  * \brief Show a text on the On-screen Display.
   981  *
   982  * Coordinates are not usable with MPlayer wrapper. The text is always shown
   983  * from the top-left corner.
   984  *
   985  * Wrappers supported (even partially):
   986  *  MPlayer
   987  *
   988  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
   989  * \param[in] player      Player controller.
   990  * \param[in] text        Text to show on the OSD.
   991  * \param[in] x           X coordinate (pixel).
   992  * \param[in] y           Y coordinate (pixel).
   993  * \param[in] duration    Duration (millisecond).
   994  */
   995 void player_osd_show_text (player_t *player,
   996                            const char *text, int x, int y, int duration);
   997 
   998 /**
   999  * \brief Enable/disable On-screen Display.
  1000  *
  1001  * With the MPlayer wrapper, this function must be called after every
  1002  * player_playback_start() if OSD must be disabled.
  1003  *
  1004  * Wrappers supported (even partially):
  1005  *  MPlayer
  1006  *
  1007  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1008  * \param[in] player      Player controller.
  1009  * \param[in] value       Different of 0 to enable.
  1010  */
  1011 void player_osd_state (player_t *player, int value);
  1012 
  1013 /**
  1014  * @}
  1015  */
  1016 
  1017 /***************************************************************************/
  1018 /*                                                                         */
  1019 /* Playback related controls                                               */
  1020 /*                                                                         */
  1021 /***************************************************************************/
  1022 
  1023 /** \brief Player playback state. */
  1024 typedef enum player_pb_state {
  1025   PLAYER_PB_STATE_IDLE,
  1026   PLAYER_PB_STATE_PAUSE,
  1027   PLAYER_PB_STATE_PLAY,
  1028 } player_pb_state_t;
  1029 
  1030 /** \brief Player playback seek mode. */
  1031 typedef enum player_pb_seek {
  1032   PLAYER_PB_SEEK_RELATIVE,
  1033   PLAYER_PB_SEEK_ABSOLUTE,
  1034   PLAYER_PB_SEEK_PERCENT,
  1035 } player_pb_seek_t;
  1036 
  1037 /**
  1038  * \name Playback related controls.
  1039  * @{
  1040  */
  1041 
  1042 /**
  1043  * \brief Get current playback state.
  1044  *
  1045  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1046  * \param[in] player      Player controller.
  1047  * \return Playback state.
  1048  */
  1049 player_pb_state_t player_playback_get_state (player_t *player);
  1050 
  1051 /**
  1052  * \brief Start a new playback.
  1053  *
  1054  * The playback is always started from the beginning.
  1055  *
  1056  * Wrappers supported (even partially):
  1057  *  GStreamer, MPlayer, VLC, xine
  1058  *
  1059  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1060  * \param[in] player      Player controller.
  1061  */
  1062 void player_playback_start (player_t *player);
  1063 
  1064 /**
  1065  * \brief Stop playback.
  1066  *
  1067  * Wrappers supported (even partially):
  1068  *  GStreamer, MPlayer, VLC, xine
  1069  *
  1070  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1071  * \param[in] player      Player controller.
  1072  */
  1073 void player_playback_stop (player_t *player);
  1074 
  1075 /**
  1076  * \brief Pause and unpause playback.
  1077  *
  1078  * Wrappers supported (even partially):
  1079  *  MPlayer, VLC, xine
  1080  *
  1081  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1082  * \param[in] player      Player controller.
  1083  */
  1084 void player_playback_pause (player_t *player);
  1085 
  1086 /**
  1087  * \brief Seek in the stream.
  1088  *
  1089  * Wrappers supported (even partially):
  1090  *  MPlayer, VLC, xine
  1091  *
  1092  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1093  * \param[in] player      Player controller.
  1094  * \param[in] value       Value for seeking (millisecond or percent).
  1095  * \param[in] seek        Seeking mode.
  1096  */
  1097 void player_playback_seek (player_t *player, int value, player_pb_seek_t seek);
  1098 
  1099 /**
  1100  * \brief Seek chapter in the stream.
  1101  *
  1102  * Wrappers supported (even partially):
  1103  *  MPlayer, VLC
  1104  *
  1105  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1106  * \param[in] player      Player controller.
  1107  * \param[in] value       Value for seeking.
  1108  * \param[in] absolute    Mode, 0 for relative.
  1109  */
  1110 void player_playback_seek_chapter (player_t *player, int value, int absolute);
  1111 
  1112 /**
  1113  * \brief Change playback speed.
  1114  *
  1115  * This function can't be used to play in backward.
  1116  *
  1117  * Wrappers supported (even partially):
  1118  *  MPlayer, xine, VLC
  1119  *
  1120  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1121  * \param[in] player      Player controller.
  1122  * \param[in] value       Factor of playback speed to set.
  1123  */
  1124 void player_playback_speed (player_t *player, float value);
  1125 
  1126 /**
  1127  * @}
  1128  */
  1129 
  1130 /***************************************************************************/
  1131 /*                                                                         */
  1132 /* Audio related controls                                                  */
  1133 /*                                                                         */
  1134 /***************************************************************************/
  1135 
  1136 /** \brief Player mute state. */
  1137 typedef enum player_mute {
  1138   PLAYER_MUTE_UNKNOWN,
  1139   PLAYER_MUTE_ON,
  1140   PLAYER_MUTE_OFF
  1141 } player_mute_t;
  1142 
  1143 /**
  1144  * \name Audio related controls.
  1145  * @{
  1146  */
  1147 
  1148 /**
  1149  * \brief Get current volume.
  1150  *
  1151  * Wrappers supported (even partially):
  1152  *  MPlayer, VLC, xine
  1153  *
  1154  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1155  * \param[in] player      Player controller.
  1156  * \return Volume (percent).
  1157  */
  1158 int player_audio_volume_get (player_t *player);
  1159 
  1160 /**
  1161  * \brief Set volume.
  1162  *
  1163  * Wrappers supported (even partially):
  1164  *  MPlayer, VLC, xine
  1165  *
  1166  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1167  * \param[in] player      Player controller.
  1168  * \param[in] value       Volume to set (percent).
  1169  */
  1170 void player_audio_volume_set (player_t *player, int value);
  1171 
  1172 /**
  1173  * \brief Get mute state.
  1174  *
  1175  * Wrappers supported (even partially):
  1176  *  MPlayer, VLC, xine
  1177  *
  1178  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1179  * \param[in] player      Player controller.
  1180  * \return Mute state.
  1181  */
  1182 player_mute_t player_audio_mute_get (player_t *player);
  1183 
  1184 /**
  1185  * \brief Set mute state.
  1186  *
  1187  * Wrappers supported (even partially):
  1188  *  MPlayer, VLC, xine
  1189  *
  1190  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1191  * \param[in] player      Player controller.
  1192  * \param[in] value       Mute state to set.
  1193  */
  1194 void player_audio_mute_set (player_t *player, player_mute_t value);
  1195 
  1196 /**
  1197  * \brief Set audio delay.
  1198  *
  1199  * Only useful with video files to set delay between audio and video streams.
  1200  *
  1201  * Wrappers supported (even partially):
  1202  *  MPlayer
  1203  *
  1204  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1205  * \param[in] player      Player controller.
  1206  * \param[in] value       Delay to set (millisecond).
  1207  * \param[in] absolute    Mode, 0 for relative.
  1208  */
  1209 void player_audio_set_delay (player_t *player, int value, int absolute);
  1210 
  1211 /**
  1212  * \brief Select audio ID.
  1213  *
  1214  * Wrappers supported (even partially):
  1215  *  MPlayer
  1216  *
  1217  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1218  * \param[in] player      Player controller.
  1219  * \param[in] audio_id    ID of the audio stream to select.
  1220  */
  1221 void player_audio_select (player_t *player, int audio_id);
  1222 
  1223 /**
  1224  * \brief Select the previous audio ID.
  1225  *
  1226  * It stays on the same audio ID if no previous stream exists.
  1227  *
  1228  * Wrappers supported (even partially):
  1229  *  MPlayer
  1230  *
  1231  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1232  * \param[in] player      Player controller.
  1233  */
  1234 void player_audio_prev (player_t *player);
  1235 
  1236 /**
  1237  * \brief Select the next audio ID.
  1238  *
  1239  * It stays on the same audio ID if no next stream exists.
  1240  *
  1241  * Wrappers supported (even partially):
  1242  *  MPlayer
  1243  *
  1244  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1245  * \param[in] player      Player controller.
  1246  */
  1247 void player_audio_next (player_t *player);
  1248 
  1249 /**
  1250  * @}
  1251  */
  1252 
  1253 /***************************************************************************/
  1254 /*                                                                         */
  1255 /* Video related controls                                                  */
  1256 /*                                                                         */
  1257 /***************************************************************************/
  1258 
  1259 /** \brief Player video aspect. */
  1260 typedef enum player_video_aspect {
  1261   PLAYER_VIDEO_ASPECT_BRIGHTNESS,
  1262   PLAYER_VIDEO_ASPECT_CONTRAST,
  1263   PLAYER_VIDEO_ASPECT_GAMMA,
  1264   PLAYER_VIDEO_ASPECT_HUE,
  1265   PLAYER_VIDEO_ASPECT_SATURATION,
  1266 } player_video_aspect_t;
  1267 
  1268 /**
  1269  * \name Video related controls.
  1270  * @{
  1271  */
  1272 
  1273 /**
  1274  * \brief Set video aspect.
  1275  *
  1276  * Wrappers supported (even partially):
  1277  *  none
  1278  *
  1279  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1280  * \param[in] player      Player controller.
  1281  * \param[in] aspect      Aspect to change.
  1282  * \param[in] value       Value for aspect to set.
  1283  * \param[in] absolute    Mode, 0 for relative.
  1284  */
  1285 void player_video_set_aspect (player_t *player, player_video_aspect_t aspect,
  1286                               int8_t value, int absolute);
  1287 
  1288 /**
  1289  * \brief Set video panscan.
  1290  *
  1291  * Wrappers supported (even partially):
  1292  *  none
  1293  *
  1294  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1295  * \param[in] player      Player controller.
  1296  * \param[in] value       Value for panscan to set.
  1297  * \param[in] absolute    Mode, 0 for relative.
  1298  */
  1299 void player_video_set_panscan (player_t *player, int8_t value, int absolute);
  1300 
  1301 /**
  1302  * \brief Set video aspect ratio.
  1303  *
  1304  * Wrappers supported (even partially):
  1305  *  MPlayer, VLC, xine
  1306  *
  1307  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1308  * \param[in] player      Player controller.
  1309  * \param[in] value       Ratio to set.
  1310  */
  1311 void player_video_set_aspect_ratio (player_t *player, float value);
  1312 
  1313 /**
  1314  * @}
  1315  */
  1316 
  1317 /***************************************************************************/
  1318 /*                                                                         */
  1319 /* Subtitles related controls                                              */
  1320 /*                                                                         */
  1321 /***************************************************************************/
  1322 
  1323 /** \brief Player subtitle alignment. */
  1324 typedef enum player_sub_alignment {
  1325   PLAYER_SUB_ALIGNMENT_TOP,
  1326   PLAYER_SUB_ALIGNMENT_CENTER,
  1327   PLAYER_SUB_ALIGNMENT_BOTTOM,
  1328 } player_sub_alignment_t;
  1329 
  1330 /**
  1331  * \name Subtitles related controls.
  1332  * @{
  1333  */
  1334 
  1335 /**
  1336  * \brief Set subtitle delay.
  1337  *
  1338  * Only useful with video files to set delay between audio stream and
  1339  * the subtitles.
  1340  *
  1341  * Wrappers supported (even partially):
  1342  *  MPlayer, xine
  1343  *
  1344  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1345  * \param[in] player      Player controller.
  1346  * \param[in] value       Delay to set (millisecond).
  1347  */
  1348 void player_subtitle_set_delay (player_t *player, int value);
  1349 
  1350 /**
  1351  * \brief Set subtitle alignment.
  1352  *
  1353  * Wrappers supported (even partially):
  1354  *  MPlayer
  1355  *
  1356  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1357  * \param[in] player      Player controller.
  1358  * \param[in] a           Alignment to set.
  1359  */
  1360 void player_subtitle_set_alignment (player_t *player,
  1361                                     player_sub_alignment_t a);
  1362 
  1363 /**
  1364  * \brief Set subtitle position.
  1365  *
  1366  * Wrappers supported (even partially):
  1367  *  MPlayer
  1368  *
  1369  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1370  * \param[in] player      Player controller.
  1371  * \param[in] value       Position to set.
  1372  */
  1373 void player_subtitle_set_position (player_t *player, int value);
  1374 
  1375 /**
  1376  * \brief Set subtitle visibility.
  1377  *
  1378  * Wrappers supported (even partially):
  1379  *  MPlayer
  1380  *
  1381  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1382  * \param[in] player      Player controller.
  1383  * \param[in] value       Different of 0 to view the subtitles.
  1384  */
  1385 void player_subtitle_set_visibility (player_t *player, int value);
  1386 
  1387 /**
  1388  * \brief Set subtitle scale.
  1389  *
  1390  * Wrappers supported (even partially):
  1391  *  MPlayer
  1392  *
  1393  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1394  * \param[in] player      Player controller.
  1395  * \param[in] value       Scale to set.
  1396  * \param[in] absolute    Mode, 0 for relative.
  1397  */
  1398 void player_subtitle_scale (player_t *player, int value, int absolute);
  1399 
  1400 /**
  1401  * \brief Select subtitle ID.
  1402  *
  1403  * Wrappers supported (even partially):
  1404  *  MPlayer, VLC
  1405  *
  1406  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1407  * \param[in] player      Player controller.
  1408  * \param[in] sub_id      ID of the subtitle to select.
  1409  */
  1410 void player_subtitle_select (player_t *player, int sub_id);
  1411 
  1412 /**
  1413  * \brief Select the previous subtitle ID.
  1414  *
  1415  * It stays on the same subtitle ID if no previous subtitle exists.
  1416  *
  1417  * Wrappers supported (even partially):
  1418  *  MPlayer, VLC
  1419  *
  1420  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1421  * \param[in] player      Player controller.
  1422  */
  1423 void player_subtitle_prev (player_t *player);
  1424 
  1425 /**
  1426  * \brief Select the next subtitle ID.
  1427  *
  1428  * It stays on the same subtitle ID if no next subtitle exists.
  1429  *
  1430  * Wrappers supported (even partially):
  1431  *  MPlayer, VLC
  1432  *
  1433  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1434  * \param[in] player      Player controller.
  1435  */
  1436 void player_subtitle_next (player_t *player);
  1437 
  1438 /**
  1439  * @}
  1440  */
  1441 
  1442 /***************************************************************************/
  1443 /*                                                                         */
  1444 /* DVD specific controls                                                   */
  1445 /*                                                                         */
  1446 /***************************************************************************/
  1447 
  1448 /** \brief Player DVDnav commands. */
  1449 typedef enum player_dvdnav {
  1450   PLAYER_DVDNAV_UP,
  1451   PLAYER_DVDNAV_DOWN,
  1452   PLAYER_DVDNAV_RIGHT,
  1453   PLAYER_DVDNAV_LEFT,
  1454   PLAYER_DVDNAV_MENU,
  1455   PLAYER_DVDNAV_SELECT,
  1456   PLAYER_DVDNAV_PREVMENU,
  1457   PLAYER_DVDNAV_MOUSECLICK,
  1458 } player_dvdnav_t;
  1459 
  1460 /**
  1461  * \name DVD specific controls.
  1462  * @{
  1463  */
  1464 
  1465 /**
  1466  * \brief DVD Navigation commands.
  1467  *
  1468  * Wrappers supported (even partially):
  1469  *  MPlayer, xine
  1470  *
  1471  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1472  * \param[in] player      Player controller.
  1473  * \param[in] value       Command to send.
  1474  */
  1475 void player_dvd_nav (player_t *player, player_dvdnav_t value);
  1476 
  1477 /**
  1478  * \brief Select DVD angle.
  1479  *
  1480  * Wrappers supported (even partially):
  1481  *  MPlayer
  1482  *
  1483  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1484  * \param[in] player      Player controller.
  1485  * \param[in] angle       Angle to select.
  1486  */
  1487 void player_dvd_angle_select (player_t *player, int angle);
  1488 
  1489 /**
  1490  * \brief Select the previous DVD angle.
  1491  *
  1492  * It stays on the same if no previous angle exists.
  1493  *
  1494  * Wrappers supported (even partially):
  1495  *  MPlayer
  1496  *
  1497  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1498  * \param[in] player      Player controller.
  1499  */
  1500 void player_dvd_angle_prev (player_t *player);
  1501 
  1502 /**
  1503  * \brief Select the next DVD angle.
  1504  *
  1505  * It stays on the same if no next angle exists.
  1506  *
  1507  * Wrappers supported (even partially):
  1508  *  MPlayer
  1509  *
  1510  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1511  * \param[in] player      Player controller.
  1512  */
  1513 void player_dvd_angle_next (player_t *player);
  1514 
  1515 /**
  1516  * \brief Select DVD title.
  1517  *
  1518  * Wrappers supported (even partially):
  1519  *  MPlayer, VLC
  1520  *
  1521  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1522  * \param[in] player      Player controller.
  1523  * \param[in] title       Title to select.
  1524  */
  1525 void player_dvd_title_select (player_t *player, int title);
  1526 
  1527 /**
  1528  * \brief Select the previous DVD title.
  1529  *
  1530  * It stays on the same if no previous title exists.
  1531  *
  1532  * Wrappers supported (even partially):
  1533  *  VLC
  1534  *
  1535  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1536  * \param[in] player      Player controller.
  1537  */
  1538 void player_dvd_title_prev (player_t *player);
  1539 
  1540 /**
  1541  * \brief Select the next DVD title.
  1542  *
  1543  * It stays on the same if no next title exists.
  1544  *
  1545  * Wrappers supported (even partially):
  1546  *  VLC
  1547  *
  1548  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1549  * \param[in] player      Player controller.
  1550  */
  1551 void player_dvd_title_next (player_t *player);
  1552 
  1553 /**
  1554  * @}
  1555  */
  1556 
  1557 /***************************************************************************/
  1558 /*                                                                         */
  1559 /* TV/DVB specific controls                                                */
  1560 /*                                                                         */
  1561 /***************************************************************************/
  1562 
  1563 /**
  1564  * \name TV/DVB specific controls.
  1565  * @{
  1566  */
  1567 
  1568 /**
  1569  * \brief Select TV channel.
  1570  *
  1571  * Wrappers supported (even partially):
  1572  *  MPlayer
  1573  *
  1574  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1575  * \param[in] player      Player controller.
  1576  * \param[in] channel     Channel to select.
  1577  */
  1578 void player_tv_channel_select (player_t *player, const char *channel);
  1579 
  1580 /**
  1581  * \brief Select the previous TV channel.
  1582  *
  1583  * It stays on the same if no previous channel exists.
  1584  *
  1585  * Wrappers supported (even partially):
  1586  *  MPlayer
  1587  *
  1588  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1589  * \param[in] player      Player controller.
  1590  */
  1591 void player_tv_channel_prev (player_t *player);
  1592 
  1593 /**
  1594  * \brief Select the next TV channel.
  1595  *
  1596  * It stays on the same if no next channel exists.
  1597  *
  1598  * Wrappers supported (even partially):
  1599  *  MPlayer
  1600  *
  1601  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1602  * \param[in] player      Player controller.
  1603  */
  1604 void player_tv_channel_next (player_t *player);
  1605 
  1606 /**
  1607  * @}
  1608  */
  1609 
  1610 /***************************************************************************/
  1611 /*                                                                         */
  1612 /* Radio specific controls                                                 */
  1613 /*                                                                         */
  1614 /***************************************************************************/
  1615 
  1616 /**
  1617  * \name Radio specific controls.
  1618  * @{
  1619  */
  1620 
  1621 /**
  1622  * \brief Select radio channel.
  1623  *
  1624  * Wrappers supported (even partially):
  1625  *  MPlayer
  1626  *
  1627  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1628  * \param[in] player      Player controller.
  1629  * \param[in] channel     Channel to select.
  1630  */
  1631 void player_radio_channel_select (player_t *player, const char *channel);
  1632 
  1633 /**
  1634  * \brief Select the previous radio channel.
  1635  *
  1636  * It stays on the same if no previous channel exists.
  1637  *
  1638  * Wrappers supported (even partially):
  1639  *  MPlayer
  1640  *
  1641  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1642  * \param[in] player      Player controller.
  1643  */
  1644 void player_radio_channel_prev (player_t *player);
  1645 
  1646 /**
  1647  * \brief Select the next radio channel.
  1648  *
  1649  * It stays on the same if no next channel exists.
  1650  *
  1651  * Wrappers supported (even partially):
  1652  *  MPlayer
  1653  *
  1654  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1655  * \param[in] player      Player controller.
  1656  */
  1657 void player_radio_channel_next (player_t *player);
  1658 
  1659 /**
  1660  * @}
  1661  */
  1662 
  1663 /***************************************************************************/
  1664 /*                                                                         */
  1665 /* VDR specific controls                                                   */
  1666 /*                                                                         */
  1667 /***************************************************************************/
  1668 
  1669 /** \brief Player VDR commands. */
  1670 typedef enum player_vdr {
  1671   PLAYER_VDR_UP = 0,
  1672   PLAYER_VDR_DOWN,
  1673   PLAYER_VDR_LEFT,
  1674   PLAYER_VDR_RIGHT,
  1675   PLAYER_VDR_OK,
  1676   PLAYER_VDR_BACK,
  1677   PLAYER_VDR_CHANNELPLUS,
  1678   PLAYER_VDR_CHANNELMINUS,
  1679   PLAYER_VDR_RED,
  1680   PLAYER_VDR_GREEN,
  1681   PLAYER_VDR_YELLOW,
  1682   PLAYER_VDR_BLUE,
  1683   PLAYER_VDR_PLAY,
  1684   PLAYER_VDR_PAUSE,
  1685   PLAYER_VDR_STOP,
  1686   PLAYER_VDR_RECORD,
  1687   PLAYER_VDR_FASTFWD,
  1688   PLAYER_VDR_FASTREW,
  1689   PLAYER_VDR_POWER,
  1690   PLAYER_VDR_SCHEDULE,
  1691   PLAYER_VDR_CHANNELS,
  1692   PLAYER_VDR_TIMERS,
  1693   PLAYER_VDR_RECORDINGS,
  1694   PLAYER_VDR_MENU,
  1695   PLAYER_VDR_SETUP,
  1696   PLAYER_VDR_COMMANDS,
  1697   PLAYER_VDR_0,
  1698   PLAYER_VDR_1,
  1699   PLAYER_VDR_2,
  1700   PLAYER_VDR_3,
  1701   PLAYER_VDR_4,
  1702   PLAYER_VDR_5,
  1703   PLAYER_VDR_6,
  1704   PLAYER_VDR_7,
  1705   PLAYER_VDR_8,
  1706   PLAYER_VDR_9,
  1707   PLAYER_VDR_USER_1,
  1708   PLAYER_VDR_USER_2,
  1709   PLAYER_VDR_USER_3,
  1710   PLAYER_VDR_USER_4,
  1711   PLAYER_VDR_USER_5,
  1712   PLAYER_VDR_USER_6,
  1713   PLAYER_VDR_USER_7,
  1714   PLAYER_VDR_USER_8,
  1715   PLAYER_VDR_USER_9,
  1716   PLAYER_VDR_VOLPLUS,
  1717   PLAYER_VDR_VOLMINUS,
  1718   PLAYER_VDR_MUTE,
  1719   PLAYER_VDR_AUDIO,
  1720   PLAYER_VDR_INFO,
  1721   PLAYER_VDR_CHANNELPREVIOUS,
  1722   PLAYER_VDR_NEXT,
  1723   PLAYER_VDR_PREVIOUS,
  1724   PLAYER_VDR_SUBTITLES,
  1725 } player_vdr_t;
  1726 
  1727 /**
  1728  * \name VDR specific controls.
  1729  * @{
  1730  */
  1731 
  1732 /**
  1733  * \brief VDR commands.
  1734  *
  1735  * Wrappers supported (even partially):
  1736  *  xine
  1737  *
  1738  * \warning MT-Safe in multithreaded applications (see \ref mtlevel).
  1739  * \param[in] player      Player controller.
  1740  * \param[in] value       Command to send.
  1741  */
  1742 void player_vdr (player_t *player, player_vdr_t value);
  1743 
  1744 /**
  1745  * @}
  1746  */
  1747 
  1748 /***************************************************************************/
  1749 /*                                                                         */
  1750 /* Global libplayer functions                                              */
  1751 /*                                                                         */
  1752 /***************************************************************************/
  1753 
  1754 /**
  1755  * \name Global libplayer functions.
  1756  * @{
  1757  */
  1758 
  1759 /**
  1760  * \brief Test if a wrapper is enabled.
  1761  *
  1762  * \warning MT-Safe in multithreaded applications.
  1763  * \param[in] type        Player type.
  1764  * \return 1 if enabled, 0 otherwise.
  1765  */
  1766 int libplayer_wrapper_enabled (player_type_t type);
  1767 
  1768 /**
  1769  * \brief Test if a resource is supported by a wrapper.
  1770  *
  1771  * \warning MT-Safe in multithreaded applications.
  1772  * \param[in] type        Player type.
  1773  * \param[in] res         Resource type.
  1774  * \return 1 if supported, 0 otherwise.
  1775  */
  1776 int libplayer_wrapper_supported_res (player_type_t type, mrl_resource_t res);
  1777 
  1778 /**
  1779  * @}
  1780  */
  1781 
  1782 #ifdef __cplusplus
  1783 #if 0 /* avoid EMACS indent */
  1784 {
  1785 #endif /* 0 */
  1786 }
  1787 #endif /* __cplusplus */
  1788 
  1789 #endif /* PLAYER_H */