00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PLAYER_H
00024 #define PLAYER_H
00025
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #if 0
00058 }
00059 #endif
00060 #endif
00061
00062 #ifndef pl_unused
00063 #if defined(__GNUC__)
00064 # define pl_unused __attribute__((unused))
00065 #else
00066 # define pl_unused
00067 #endif
00068 #endif
00069
00070 #define PL_STRINGIFY(s) #s
00071 #define PL_TOSTRING(s) PL_STRINGIFY(s)
00072
00073 #define PL_VERSION_INT(a, b, c) (a << 16 | b << 8 | c)
00074 #define PL_VERSION_DOT(a, b, c) a ##.## b ##.## c
00075 #define PL_VERSION(a, b, c) PL_VERSION_DOT(a, b, c)
00076
00077 #define LIBPLAYER_VERSION_MAJOR 2
00078 #define LIBPLAYER_VERSION_MINOR 0
00079 #define LIBPLAYER_VERSION_MICRO 1
00080
00081 #define LIBPLAYER_VERSION_INT PL_VERSION_INT(LIBPLAYER_VERSION_MAJOR, \
00082 LIBPLAYER_VERSION_MINOR, \
00083 LIBPLAYER_VERSION_MICRO)
00084 #define LIBPLAYER_VERSION PL_VERSION(LIBPLAYER_VERSION_MAJOR, \
00085 LIBPLAYER_VERSION_MINOR, \
00086 LIBPLAYER_VERSION_MICRO)
00087 #define LIBPLAYER_VERSION_STR PL_TOSTRING(LIBPLAYER_VERSION)
00088 #define LIBPLAYER_BUILD LIBPLAYER_VERSION_INT
00089
00090 #include <inttypes.h>
00091 #include <sys/types.h>
00092
00096 unsigned int libplayer_version (void);
00097
00098
00099
00100
00101
00102
00103
00104
00105
00111 typedef struct player_s player_t;
00112
00114 typedef enum player_type {
00115 PLAYER_TYPE_XINE,
00116 PLAYER_TYPE_MPLAYER,
00117 PLAYER_TYPE_VLC,
00118 PLAYER_TYPE_GSTREAMER,
00119 PLAYER_TYPE_DUMMY
00120 } player_type_t;
00121
00123 typedef enum player_vo {
00124 PLAYER_VO_AUTO = 0,
00125 PLAYER_VO_NULL,
00126 PLAYER_VO_X11,
00127 PLAYER_VO_X11_SDL,
00128 PLAYER_VO_XV,
00129 PLAYER_VO_GL,
00130 PLAYER_VO_FB,
00131 PLAYER_VO_DIRECTFB,
00132 PLAYER_VO_VDPAU,
00133 PLAYER_VO_VAAPI,
00134 } player_vo_t;
00135
00137 typedef enum player_ao {
00138 PLAYER_AO_AUTO = 0,
00139 PLAYER_AO_NULL,
00140 PLAYER_AO_ALSA,
00141 PLAYER_AO_OSS,
00142 PLAYER_AO_PULSE,
00143 } player_ao_t;
00144
00146 typedef enum player_event {
00147 PLAYER_EVENT_UNKNOWN,
00148 PLAYER_EVENT_PLAYBACK_START,
00149 PLAYER_EVENT_PLAYBACK_STOP,
00150 PLAYER_EVENT_PLAYBACK_FINISHED,
00151 PLAYER_EVENT_PLAYLIST_FINISHED,
00152 PLAYER_EVENT_PLAYBACK_PAUSE,
00153 PLAYER_EVENT_PLAYBACK_UNPAUSE,
00154 } player_event_t;
00155
00157 typedef enum {
00158 PLAYER_MSG_NONE,
00159 PLAYER_MSG_VERBOSE,
00160 PLAYER_MSG_INFO,
00161 PLAYER_MSG_WARNING,
00162 PLAYER_MSG_ERROR,
00163 PLAYER_MSG_CRITICAL,
00164 } player_verbosity_level_t;
00165
00166 typedef enum {
00167 PLAYER_QUALITY_NORMAL,
00168 PLAYER_QUALITY_LOW,
00169 PLAYER_QUALITY_LOWEST,
00170 } player_quality_level_t;
00171
00173 typedef struct player_init_param_s {
00175 player_ao_t ao;
00177 player_vo_t vo;
00179 uint32_t winid;
00180
00182 int (*event_cb) (player_event_t e, void *data);
00184 void *data;
00185
00193 const char *display;
00194
00196 player_quality_level_t quality;
00197
00198 } player_init_param_t;
00199
00225 player_t *player_init (player_type_t type, player_verbosity_level_t verbosity,
00226 player_init_param_t *param);
00227
00239 void player_uninit (player_t *player);
00240
00251 void player_set_verbosity (player_t *player, player_verbosity_level_t level);
00252
00257
00258
00259
00260
00261
00262
00263
00269 typedef struct mrl_s mrl_t;
00270
00272 typedef enum mrl_type {
00273 MRL_TYPE_UNKNOWN,
00274 MRL_TYPE_AUDIO,
00275 MRL_TYPE_VIDEO,
00276 MRL_TYPE_IMAGE,
00277 } mrl_type_t;
00278
00279
00280
00281
00282
00283
00284
00286 typedef enum mrl_resource {
00287 MRL_RESOURCE_UNKNOWN,
00288
00289
00290 MRL_RESOURCE_FIFO,
00291 MRL_RESOURCE_FILE,
00292 MRL_RESOURCE_STDIN,
00293
00294
00295 MRL_RESOURCE_CDDA,
00296 MRL_RESOURCE_CDDB,
00297
00298
00299 MRL_RESOURCE_DVD,
00300 MRL_RESOURCE_DVDNAV,
00301 MRL_RESOURCE_VCD,
00302
00303
00304 MRL_RESOURCE_DVB,
00305 MRL_RESOURCE_PVR,
00306 MRL_RESOURCE_RADIO,
00307 MRL_RESOURCE_TV,
00308 MRL_RESOURCE_VDR,
00309
00310
00311 MRL_RESOURCE_FTP,
00312 MRL_RESOURCE_HTTP,
00313 MRL_RESOURCE_MMS,
00314 MRL_RESOURCE_NETVDR,
00315 MRL_RESOURCE_RTP,
00316 MRL_RESOURCE_RTSP,
00317 MRL_RESOURCE_SMB,
00318 MRL_RESOURCE_TCP,
00319 MRL_RESOURCE_UDP,
00320 MRL_RESOURCE_UNSV,
00321 } mrl_resource_t;
00322
00324 typedef struct mrl_resource_local_args_s {
00325 char *location;
00326 int playlist;
00327 } mrl_resource_local_args_t;
00328
00330 typedef struct mrl_resource_cd_args_s {
00331 char *device;
00332 uint8_t speed;
00333 uint8_t track_start;
00334 uint8_t track_end;
00335 } mrl_resource_cd_args_t;
00336
00338 typedef struct mrl_resource_videodisc_args_s {
00339 char *device;
00340 uint8_t speed;
00341 uint8_t angle;
00342 uint8_t title_start;
00343 uint8_t title_end;
00344 uint8_t chapter_start;
00345 uint8_t chapter_end;
00346 uint8_t track_start;
00347 uint8_t track_end;
00348 char *audio_lang;
00349 char *sub_lang;
00350 uint8_t sub_cc;
00351 } mrl_resource_videodisc_args_t;
00352
00354 typedef struct mrl_resource_tv_args_s {
00355 char *device;
00356 char *driver;
00357 char *channel;
00358 uint8_t input;
00359 int width;
00360 int height;
00361 int fps;
00362 char *output_format;
00363 char *norm;
00364 } mrl_resource_tv_args_t;
00365
00367 typedef struct mrl_resource_network_args_s {
00368 char *url;
00369 char *username;
00370 char *password;
00371 char *user_agent;
00372 } mrl_resource_network_args_t;
00373
00375 typedef enum mrl_snapshot {
00376 MRL_SNAPSHOT_JPG,
00377 MRL_SNAPSHOT_PNG,
00378 MRL_SNAPSHOT_PPM,
00379 MRL_SNAPSHOT_TGA,
00380 } mrl_snapshot_t;
00381
00383 typedef enum mrl_metadata_type {
00384 MRL_METADATA_TITLE,
00385 MRL_METADATA_ARTIST,
00386 MRL_METADATA_GENRE,
00387 MRL_METADATA_ALBUM,
00388 MRL_METADATA_YEAR,
00389 MRL_METADATA_TRACK,
00390 MRL_METADATA_COMMENT,
00391 } mrl_metadata_type_t;
00392
00394 typedef enum mrl_metadata_cd_type {
00395 MRL_METADATA_CD_DISCID,
00396 MRL_METADATA_CD_TRACKS,
00397 } mrl_metadata_cd_type_t;
00398
00400 typedef enum mrl_metadata_dvd_type {
00401 MRL_METADATA_DVD_TITLE_CHAPTERS,
00402 MRL_METADATA_DVD_TITLE_ANGLES,
00403 MRL_METADATA_DVD_TITLE_LENGTH,
00404 } mrl_metadata_dvd_type_t;
00405
00407 typedef enum mrl_properties_type {
00408 MRL_PROPERTY_SEEKABLE,
00409 MRL_PROPERTY_LENGTH,
00410 MRL_PROPERTY_AUDIO_BITRATE,
00411 MRL_PROPERTY_AUDIO_BITS,
00412 MRL_PROPERTY_AUDIO_CHANNELS,
00413 MRL_PROPERTY_AUDIO_SAMPLERATE,
00414 MRL_PROPERTY_VIDEO_BITRATE,
00415 MRL_PROPERTY_VIDEO_WIDTH,
00416 MRL_PROPERTY_VIDEO_HEIGHT,
00417 MRL_PROPERTY_VIDEO_ASPECT,
00418 MRL_PROPERTY_VIDEO_CHANNELS,
00419 MRL_PROPERTY_VIDEO_STREAMS,
00420 MRL_PROPERTY_VIDEO_FRAMEDURATION,
00421 } mrl_properties_type_t;
00422
00423 #define PLAYER_VIDEO_ASPECT_RATIO_MULT 10000.0
00424 #define PLAYER_VIDEO_FRAMEDURATION_RATIO_DIV 90000.0
00425
00446 mrl_t *mrl_new (player_t *player, mrl_resource_t res, void *args);
00447
00456 void mrl_add_subtitle (player_t *player, mrl_t *mrl, char *subtitle);
00457
00469 void mrl_free (player_t *player, mrl_t *mrl);
00470
00479 mrl_type_t mrl_get_type (player_t *player, mrl_t *mrl);
00480
00489 mrl_resource_t mrl_get_resource (player_t *player, mrl_t *mrl);
00490
00506 char *mrl_get_metadata (player_t *player, mrl_t *mrl, mrl_metadata_type_t m);
00507
00524 char *mrl_get_metadata_cd_track (player_t *player,
00525 mrl_t *mrl, int trackid, uint32_t *length);
00526
00541 uint32_t mrl_get_metadata_cd (player_t *player,
00542 mrl_t *mrl, mrl_metadata_cd_type_t m);
00543
00559 uint32_t mrl_get_metadata_dvd_title (player_t *player, mrl_t *mrl,
00560 int titleid, mrl_metadata_dvd_type_t m);
00561
00577 char *mrl_get_metadata_dvd (player_t *player, mrl_t *mrl, uint8_t *titles);
00578
00601 int mrl_get_metadata_subtitle (player_t *player, mrl_t *mrl, int pos,
00602 uint32_t *id, char **name, char **lang);
00603
00617 uint32_t mrl_get_metadata_subtitle_nb (player_t *player, mrl_t *mrl);
00618
00641 int mrl_get_metadata_audio (player_t *player, mrl_t *mrl, int pos,
00642 uint32_t *id, char **name, char **lang);
00643
00657 uint32_t mrl_get_metadata_audio_nb (player_t *player, mrl_t *mrl);
00658
00671 uint32_t mrl_get_property (player_t *player,
00672 mrl_t *mrl, mrl_properties_type_t p);
00673
00686 char *mrl_get_audio_codec (player_t *player, mrl_t *mrl);
00687
00700 char *mrl_get_video_codec (player_t *player, mrl_t *mrl);
00701
00713 off_t mrl_get_size (player_t *player, mrl_t *mrl);
00714
00731 void mrl_video_snapshot (player_t *player, mrl_t *mrl,
00732 int pos, mrl_snapshot_t t, const char *dst);
00733
00738
00739
00740
00741
00742
00743
00745 typedef enum player_mrl_add {
00746 PLAYER_MRL_ADD_NOW,
00747 PLAYER_MRL_ADD_QUEUE
00748 } player_mrl_add_t;
00749
00762 mrl_t *player_mrl_get_current (player_t *player);
00763
00774 void player_mrl_set (player_t *player, mrl_t *mrl);
00775
00784 void player_mrl_append (player_t *player, mrl_t *mrl, player_mrl_add_t when);
00785
00794 void player_mrl_remove (player_t *player);
00795
00804 void player_mrl_remove_all (player_t *player);
00805
00814 void player_mrl_previous (player_t *player);
00815
00824 void player_mrl_next (player_t *player);
00825
00835 void player_mrl_continue (player_t *player);
00836
00841
00842
00843
00844
00845
00846
00848 typedef enum player_pb {
00849 PLAYER_PB_SINGLE = 0,
00850 PLAYER_PB_AUTO,
00851 } player_pb_t;
00852
00854 typedef enum player_loop {
00855 PLAYER_LOOP_DISABLE = 0,
00856 PLAYER_LOOP_ELEMENT,
00857 PLAYER_LOOP_PLAYLIST,
00858 } player_loop_t;
00859
00861 typedef enum player_framedrop {
00862 PLAYER_FRAMEDROP_DISABLE,
00863 PLAYER_FRAMEDROP_SOFT,
00864 PLAYER_FRAMEDROP_HARD,
00865 } player_framedrop_t;
00866
00868 typedef enum player_x_window_flags {
00869 PLAYER_X_WINDOW_AUTO = 0,
00870 PLAYER_X_WINDOW_X = (1 << 0),
00871 PLAYER_X_WINDOW_Y = (1 << 1),
00872 PLAYER_X_WINDOW_W = (1 << 2),
00873 PLAYER_X_WINDOW_H = (1 << 3),
00874 } player_x_window_flags_t;
00875
00891 int player_get_time_pos (player_t *player);
00892
00903 int player_get_percent_pos (player_t *player);
00904
00916 void player_set_playback (player_t *player, player_pb_t pb);
00917
00928 void player_set_loop (player_t *player, player_loop_t loop, int value);
00929
00939 void player_set_shuffle (player_t *player, int value);
00940
00951 void player_set_framedrop (player_t *player, player_framedrop_t fd);
00952
00968 void player_set_mouse_position (player_t *player, int x, int y);
00969
00987 void player_x_window_set_properties (player_t *player,
00988 int x, int y, int w, int h, int flags);
00989
01006 void player_osd_show_text (player_t *player,
01007 const char *text, int x, int y, int duration);
01008
01022 void player_osd_state (player_t *player, int value);
01023
01028
01029
01030
01031
01032
01033
01035 typedef enum player_pb_state {
01036 PLAYER_PB_STATE_IDLE,
01037 PLAYER_PB_STATE_PAUSE,
01038 PLAYER_PB_STATE_PLAY,
01039 } player_pb_state_t;
01040
01042 typedef enum player_pb_seek {
01043 PLAYER_PB_SEEK_RELATIVE,
01044 PLAYER_PB_SEEK_ABSOLUTE,
01045 PLAYER_PB_SEEK_PERCENT,
01046 } player_pb_seek_t;
01047
01060 player_pb_state_t player_playback_get_state (player_t *player);
01061
01073 void player_playback_start (player_t *player);
01074
01084 void player_playback_stop (player_t *player);
01085
01095 void player_playback_pause (player_t *player);
01096
01108 void player_playback_seek (player_t *player, int value, player_pb_seek_t seek);
01109
01121 void player_playback_seek_chapter (player_t *player, int value, int absolute);
01122
01135 void player_playback_speed (player_t *player, float value);
01136
01141
01142
01143
01144
01145
01146
01148 typedef enum player_mute {
01149 PLAYER_MUTE_UNKNOWN,
01150 PLAYER_MUTE_ON,
01151 PLAYER_MUTE_OFF
01152 } player_mute_t;
01153
01169 int player_audio_volume_get (player_t *player);
01170
01181 void player_audio_volume_set (player_t *player, int value);
01182
01193 player_mute_t player_audio_mute_get (player_t *player);
01194
01205 void player_audio_mute_set (player_t *player, player_mute_t value);
01206
01220 void player_audio_set_delay (player_t *player, int value, int absolute);
01221
01232 void player_audio_select (player_t *player, int audio_id);
01233
01245 void player_audio_prev (player_t *player);
01246
01258 void player_audio_next (player_t *player);
01259
01264
01265
01266
01267
01268
01269
01271 typedef enum player_video_aspect {
01272 PLAYER_VIDEO_ASPECT_BRIGHTNESS,
01273 PLAYER_VIDEO_ASPECT_CONTRAST,
01274 PLAYER_VIDEO_ASPECT_GAMMA,
01275 PLAYER_VIDEO_ASPECT_HUE,
01276 PLAYER_VIDEO_ASPECT_SATURATION,
01277 } player_video_aspect_t;
01278
01296 void player_video_set_aspect (player_t *player, player_video_aspect_t aspect,
01297 int8_t value, int absolute);
01298
01310 void player_video_set_panscan (player_t *player, int8_t value, int absolute);
01311
01322 void player_video_set_aspect_ratio (player_t *player, float value);
01323
01328
01329
01330
01331
01332
01333
01335 typedef enum player_sub_alignment {
01336 PLAYER_SUB_ALIGNMENT_TOP,
01337 PLAYER_SUB_ALIGNMENT_CENTER,
01338 PLAYER_SUB_ALIGNMENT_BOTTOM,
01339 } player_sub_alignment_t;
01340
01359 void player_subtitle_set_delay (player_t *player, int value);
01360
01371 void player_subtitle_set_alignment (player_t *player,
01372 player_sub_alignment_t a);
01373
01384 void player_subtitle_set_position (player_t *player, int value);
01385
01396 void player_subtitle_set_visibility (player_t *player, int value);
01397
01409 void player_subtitle_scale (player_t *player, int value, int absolute);
01410
01421 void player_subtitle_select (player_t *player, int sub_id);
01422
01434 void player_subtitle_prev (player_t *player);
01435
01447 void player_subtitle_next (player_t *player);
01448
01453
01454
01455
01456
01457
01458
01460 typedef enum player_dvdnav {
01461 PLAYER_DVDNAV_UP,
01462 PLAYER_DVDNAV_DOWN,
01463 PLAYER_DVDNAV_RIGHT,
01464 PLAYER_DVDNAV_LEFT,
01465 PLAYER_DVDNAV_MENU,
01466 PLAYER_DVDNAV_SELECT,
01467 PLAYER_DVDNAV_PREVMENU,
01468 PLAYER_DVDNAV_MOUSECLICK,
01469 } player_dvdnav_t;
01470
01486 void player_dvd_nav (player_t *player, player_dvdnav_t value);
01487
01498 void player_dvd_angle_select (player_t *player, int angle);
01499
01511 void player_dvd_angle_prev (player_t *player);
01512
01524 void player_dvd_angle_next (player_t *player);
01525
01536 void player_dvd_title_select (player_t *player, int title);
01537
01549 void player_dvd_title_prev (player_t *player);
01550
01562 void player_dvd_title_next (player_t *player);
01563
01568
01569
01570
01571
01572
01573
01589 void player_tv_channel_select (player_t *player, const char *channel);
01590
01602 void player_tv_channel_prev (player_t *player);
01603
01615 void player_tv_channel_next (player_t *player);
01616
01621
01622
01623
01624
01625
01626
01642 void player_radio_channel_select (player_t *player, const char *channel);
01643
01655 void player_radio_channel_prev (player_t *player);
01656
01668 void player_radio_channel_next (player_t *player);
01669
01674
01675
01676
01677
01678
01679
01681 typedef enum player_vdr {
01682 PLAYER_VDR_UP = 0,
01683 PLAYER_VDR_DOWN,
01684 PLAYER_VDR_LEFT,
01685 PLAYER_VDR_RIGHT,
01686 PLAYER_VDR_OK,
01687 PLAYER_VDR_BACK,
01688 PLAYER_VDR_CHANNELPLUS,
01689 PLAYER_VDR_CHANNELMINUS,
01690 PLAYER_VDR_RED,
01691 PLAYER_VDR_GREEN,
01692 PLAYER_VDR_YELLOW,
01693 PLAYER_VDR_BLUE,
01694 PLAYER_VDR_PLAY,
01695 PLAYER_VDR_PAUSE,
01696 PLAYER_VDR_STOP,
01697 PLAYER_VDR_RECORD,
01698 PLAYER_VDR_FASTFWD,
01699 PLAYER_VDR_FASTREW,
01700 PLAYER_VDR_POWER,
01701 PLAYER_VDR_SCHEDULE,
01702 PLAYER_VDR_CHANNELS,
01703 PLAYER_VDR_TIMERS,
01704 PLAYER_VDR_RECORDINGS,
01705 PLAYER_VDR_MENU,
01706 PLAYER_VDR_SETUP,
01707 PLAYER_VDR_COMMANDS,
01708 PLAYER_VDR_0,
01709 PLAYER_VDR_1,
01710 PLAYER_VDR_2,
01711 PLAYER_VDR_3,
01712 PLAYER_VDR_4,
01713 PLAYER_VDR_5,
01714 PLAYER_VDR_6,
01715 PLAYER_VDR_7,
01716 PLAYER_VDR_8,
01717 PLAYER_VDR_9,
01718 PLAYER_VDR_USER_1,
01719 PLAYER_VDR_USER_2,
01720 PLAYER_VDR_USER_3,
01721 PLAYER_VDR_USER_4,
01722 PLAYER_VDR_USER_5,
01723 PLAYER_VDR_USER_6,
01724 PLAYER_VDR_USER_7,
01725 PLAYER_VDR_USER_8,
01726 PLAYER_VDR_USER_9,
01727 PLAYER_VDR_VOLPLUS,
01728 PLAYER_VDR_VOLMINUS,
01729 PLAYER_VDR_MUTE,
01730 PLAYER_VDR_AUDIO,
01731 PLAYER_VDR_INFO,
01732 PLAYER_VDR_CHANNELPREVIOUS,
01733 PLAYER_VDR_NEXT,
01734 PLAYER_VDR_PREVIOUS,
01735 PLAYER_VDR_SUBTITLES,
01736 } player_vdr_t;
01737
01753 void player_vdr (player_t *player, player_vdr_t value);
01754
01759
01760
01761
01762
01763
01764
01777 int libplayer_wrapper_enabled (player_type_t type);
01778
01787 int libplayer_wrapper_supported_res (player_type_t type, mrl_resource_t res);
01788
01793 #ifdef __cplusplus
01794 #if 0
01795 {
01796 #endif
01797 }
01798 #endif
01799
01800 #endif