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