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 #include <inttypes.h>
00071 #include <sys/types.h>
00072
00073 #define LIBPLAYER_VERSION_MAJOR 1
00074 #define LIBPLAYER_VERSION_MINOR 0
00075 #define LIBPLAYER_VERSION_MICRO 0
00076 #define LIBPLAYER_VERSION "1.0.0"
00077
00078
00079
00080
00081
00082
00083
00084
00090 typedef struct player_s player_t;
00091
00093 typedef enum player_type {
00094 PLAYER_TYPE_XINE,
00095 PLAYER_TYPE_MPLAYER,
00096 PLAYER_TYPE_VLC,
00097 PLAYER_TYPE_GSTREAMER,
00098 PLAYER_TYPE_DUMMY
00099 } player_type_t;
00100
00102 typedef enum player_vo {
00103 PLAYER_VO_NULL,
00104 PLAYER_VO_AUTO,
00105 PLAYER_VO_X11,
00106 PLAYER_VO_X11_SDL,
00107 PLAYER_VO_XV,
00108 PLAYER_VO_GL,
00109 PLAYER_VO_FB,
00110 PLAYER_VO_VDPAU
00111 } player_vo_t;
00112
00114 typedef enum player_ao {
00115 PLAYER_AO_NULL,
00116 PLAYER_AO_AUTO,
00117 PLAYER_AO_ALSA,
00118 PLAYER_AO_OSS
00119 } player_ao_t;
00120
00122 typedef enum player_event {
00123 PLAYER_EVENT_UNKNOWN,
00124 PLAYER_EVENT_PLAYBACK_START,
00125 PLAYER_EVENT_PLAYBACK_STOP,
00126 PLAYER_EVENT_PLAYBACK_FINISHED,
00127 PLAYER_EVENT_PLAYLIST_FINISHED,
00128 PLAYER_EVENT_PLAYBACK_PAUSE,
00129 PLAYER_EVENT_PLAYBACK_UNPAUSE,
00130 } player_event_t;
00131
00133 typedef enum {
00134 PLAYER_MSG_NONE,
00135 PLAYER_MSG_VERBOSE,
00136 PLAYER_MSG_INFO,
00137 PLAYER_MSG_WARNING,
00138 PLAYER_MSG_ERROR,
00139 PLAYER_MSG_CRITICAL,
00140 } player_verbosity_level_t;
00141
00165 player_t *player_init (player_type_t type, player_ao_t ao, player_vo_t vo,
00166 player_verbosity_level_t verbosity, unsigned long winid,
00167 int (*event_cb) (player_event_t e, void *data));
00168
00180 void player_uninit (player_t *player);
00181
00192 void player_set_verbosity (player_t *player, player_verbosity_level_t level);
00193
00198
00199
00200
00201
00202
00203
00204
00210 typedef struct mrl_s mrl_t;
00211
00213 typedef enum mrl_type {
00214 MRL_TYPE_UNKNOWN,
00215 MRL_TYPE_AUDIO,
00216 MRL_TYPE_VIDEO,
00217 MRL_TYPE_IMAGE,
00218 } mrl_type_t;
00219
00220
00221
00222
00223
00224
00225
00227 typedef enum mrl_resource {
00228 MRL_RESOURCE_UNKNOWN,
00229
00230
00231 MRL_RESOURCE_FIFO,
00232 MRL_RESOURCE_FILE,
00233 MRL_RESOURCE_STDIN,
00234
00235
00236 MRL_RESOURCE_CDDA,
00237 MRL_RESOURCE_CDDB,
00238
00239
00240 MRL_RESOURCE_DVD,
00241 MRL_RESOURCE_DVDNAV,
00242 MRL_RESOURCE_VCD,
00243
00244
00245 MRL_RESOURCE_DVB,
00246 MRL_RESOURCE_PVR,
00247 MRL_RESOURCE_RADIO,
00248 MRL_RESOURCE_TV,
00249 MRL_RESOURCE_VDR,
00250
00251
00252 MRL_RESOURCE_FTP,
00253 MRL_RESOURCE_HTTP,
00254 MRL_RESOURCE_MMS,
00255 MRL_RESOURCE_NETVDR,
00256 MRL_RESOURCE_RTP,
00257 MRL_RESOURCE_RTSP,
00258 MRL_RESOURCE_SMB,
00259 MRL_RESOURCE_TCP,
00260 MRL_RESOURCE_UDP,
00261 MRL_RESOURCE_UNSV,
00262 } mrl_resource_t;
00263
00265 typedef struct mrl_resource_local_args_s {
00266 char *location;
00267 int playlist;
00268 } mrl_resource_local_args_t;
00269
00271 typedef struct mrl_resource_cd_args_s {
00272 char *device;
00273 uint8_t speed;
00274 uint8_t track_start;
00275 uint8_t track_end;
00276 } mrl_resource_cd_args_t;
00277
00279 typedef struct mrl_resource_videodisc_args_s {
00280 char *device;
00281 uint8_t speed;
00282 uint8_t angle;
00283 uint8_t title_start;
00284 uint8_t title_end;
00285 uint8_t chapter_start;
00286 uint8_t chapter_end;
00287 uint8_t track_start;
00288 uint8_t track_end;
00289 char *audio_lang;
00290 char *sub_lang;
00291 uint8_t sub_cc;
00292 } mrl_resource_videodisc_args_t;
00293
00295 typedef struct mrl_resource_tv_args_s {
00296 char *device;
00297 char *driver;
00298 char *channel;
00299 uint8_t input;
00300 int width;
00301 int height;
00302 int fps;
00303 char *output_format;
00304 char *norm;
00305 } mrl_resource_tv_args_t;
00306
00308 typedef struct mrl_resource_network_args_s {
00309 char *url;
00310 char *username;
00311 char *password;
00312 char *user_agent;
00313 } mrl_resource_network_args_t;
00314
00316 typedef enum mrl_snapshot {
00317 MRL_SNAPSHOT_JPG,
00318 MRL_SNAPSHOT_PNG,
00319 MRL_SNAPSHOT_PPM,
00320 MRL_SNAPSHOT_TGA,
00321 } mrl_snapshot_t;
00322
00324 typedef enum mrl_metadata_type {
00325 MRL_METADATA_TITLE,
00326 MRL_METADATA_ARTIST,
00327 MRL_METADATA_GENRE,
00328 MRL_METADATA_ALBUM,
00329 MRL_METADATA_YEAR,
00330 MRL_METADATA_TRACK,
00331 MRL_METADATA_COMMENT,
00332 } mrl_metadata_type_t;
00333
00335 typedef enum mrl_metadata_cd_type {
00336 MRL_METADATA_CD_DISCID,
00337 MRL_METADATA_CD_TRACKS,
00338 } mrl_metadata_cd_type_t;
00339
00341 typedef enum mrl_metadata_dvd_type {
00342 MRL_METADATA_DVD_TITLE_CHAPTERS,
00343 MRL_METADATA_DVD_TITLE_ANGLES,
00344 MRL_METADATA_DVD_TITLE_LENGTH,
00345 } mrl_metadata_dvd_type_t;
00346
00348 typedef enum mrl_properties_type {
00349 MRL_PROPERTY_SEEKABLE,
00350 MRL_PROPERTY_LENGTH,
00351 MRL_PROPERTY_AUDIO_BITRATE,
00352 MRL_PROPERTY_AUDIO_BITS,
00353 MRL_PROPERTY_AUDIO_CHANNELS,
00354 MRL_PROPERTY_AUDIO_SAMPLERATE,
00355 MRL_PROPERTY_VIDEO_BITRATE,
00356 MRL_PROPERTY_VIDEO_WIDTH,
00357 MRL_PROPERTY_VIDEO_HEIGHT,
00358 MRL_PROPERTY_VIDEO_ASPECT,
00359 MRL_PROPERTY_VIDEO_CHANNELS,
00360 MRL_PROPERTY_VIDEO_STREAMS,
00361 MRL_PROPERTY_VIDEO_FRAMEDURATION,
00362 } mrl_properties_type_t;
00363
00364 #define PLAYER_VIDEO_ASPECT_RATIO_MULT 10000.0
00365 #define PLAYER_VIDEO_FRAMEDURATION_RATIO_DIV 90000.0
00366
00383 mrl_t *mrl_new (player_t *player, mrl_resource_t res, void *args);
00384
00393 void mrl_add_subtitle (player_t *player, mrl_t *mrl, char *subtitle);
00394
00406 void mrl_free (player_t *player, mrl_t *mrl);
00407
00416 mrl_type_t mrl_get_type (player_t *player, mrl_t *mrl);
00417
00426 mrl_resource_t mrl_get_resource (player_t *player, mrl_t *mrl);
00427
00443 char *mrl_get_metadata (player_t *player, mrl_t *mrl, mrl_metadata_type_t m);
00444
00461 char *mrl_get_metadata_cd_track (player_t *player,
00462 mrl_t *mrl, int trackid, uint32_t *length);
00463
00478 uint32_t mrl_get_metadata_cd (player_t *player,
00479 mrl_t *mrl, mrl_metadata_cd_type_t m);
00480
00496 uint32_t mrl_get_metadata_dvd_title (player_t *player, mrl_t *mrl,
00497 int titleid, mrl_metadata_dvd_type_t m);
00498
00514 char *mrl_get_metadata_dvd (player_t *player, mrl_t *mrl, uint8_t *titles);
00515
00538 int mrl_get_metadata_subtitle (player_t *player, mrl_t *mrl, int pos,
00539 uint32_t *id, char **name, char **lang);
00540
00554 uint32_t mrl_get_metadata_subtitle_nb (player_t *player, mrl_t *mrl);
00555
00578 int mrl_get_metadata_audio (player_t *player, mrl_t *mrl, int pos,
00579 uint32_t *id, char **name, char **lang);
00580
00594 uint32_t mrl_get_metadata_audio_nb (player_t *player, mrl_t *mrl);
00595
00608 uint32_t mrl_get_property (player_t *player,
00609 mrl_t *mrl, mrl_properties_type_t p);
00610
00623 char *mrl_get_audio_codec (player_t *player, mrl_t *mrl);
00624
00637 char *mrl_get_video_codec (player_t *player, mrl_t *mrl);
00638
00650 off_t mrl_get_size (player_t *player, mrl_t *mrl);
00651
00668 void mrl_video_snapshot (player_t *player, mrl_t *mrl,
00669 int pos, mrl_snapshot_t t, const char *dst);
00670
00675
00676
00677
00678
00679
00680
00682 typedef enum player_mrl_add {
00683 PLAYER_MRL_ADD_NOW,
00684 PLAYER_MRL_ADD_QUEUE
00685 } player_mrl_add_t;
00686
00699 mrl_t *player_mrl_get_current (player_t *player);
00700
00711 void player_mrl_set (player_t *player, mrl_t *mrl);
00712
00721 void player_mrl_append (player_t *player, mrl_t *mrl, player_mrl_add_t when);
00722
00731 void player_mrl_remove (player_t *player);
00732
00741 void player_mrl_remove_all (player_t *player);
00742
00751 void player_mrl_previous (player_t *player);
00752
00761 void player_mrl_next (player_t *player);
00762
00767
00768
00769
00770
00771
00772
00774 typedef enum player_pb {
00775 PLAYER_PB_SINGLE = 0,
00776 PLAYER_PB_AUTO,
00777 } player_pb_t;
00778
00780 typedef enum player_loop {
00781 PLAYER_LOOP_DISABLE = 0,
00782 PLAYER_LOOP_ELEMENT,
00783 PLAYER_LOOP_PLAYLIST,
00784 } player_loop_t;
00785
00787 typedef enum player_framedrop {
00788 PLAYER_FRAMEDROP_DISABLE,
00789 PLAYER_FRAMEDROP_SOFT,
00790 PLAYER_FRAMEDROP_HARD,
00791 } player_framedrop_t;
00792
00794 typedef enum player_x_window_flags {
00795 PLAYER_X_WINDOW_AUTO = 0,
00796 PLAYER_X_WINDOW_X = (1 << 0),
00797 PLAYER_X_WINDOW_Y = (1 << 1),
00798 PLAYER_X_WINDOW_W = (1 << 2),
00799 PLAYER_X_WINDOW_H = (1 << 3),
00800 } player_x_window_flags_t;
00801
00817 int player_get_time_pos (player_t *player);
00818
00829 int player_get_percent_pos (player_t *player);
00830
00842 void player_set_playback (player_t *player, player_pb_t pb);
00843
00854 void player_set_loop (player_t *player, player_loop_t loop, int value);
00855
00865 void player_set_shuffle (player_t *player, int value);
00866
00877 void player_set_framedrop (player_t *player, player_framedrop_t fd);
00878
00894 void player_set_mouse_position (player_t *player, int x, int y);
00895
00913 void player_x_window_set_properties (player_t *player,
00914 int x, int y, int w, int h, int flags);
00915
00932 void player_osd_show_text (player_t *player,
00933 const char *text, int x, int y, int duration);
00934
00939
00940
00941
00942
00943
00944
00946 typedef enum player_pb_state {
00947 PLAYER_PB_STATE_IDLE,
00948 PLAYER_PB_STATE_PAUSE,
00949 PLAYER_PB_STATE_PLAY,
00950 } player_pb_state_t;
00951
00953 typedef enum player_pb_seek {
00954 PLAYER_PB_SEEK_RELATIVE,
00955 PLAYER_PB_SEEK_ABSOLUTE,
00956 PLAYER_PB_SEEK_PERCENT,
00957 } player_pb_seek_t;
00958
00971 player_pb_state_t player_playback_get_state (player_t *player);
00972
00984 void player_playback_start (player_t *player);
00985
00995 void player_playback_stop (player_t *player);
00996
01006 void player_playback_pause (player_t *player);
01007
01019 void player_playback_seek (player_t *player, int value, player_pb_seek_t seek);
01020
01032 void player_playback_seek_chapter (player_t *player, int value, int absolute);
01033
01046 void player_playback_speed (player_t *player, float value);
01047
01052
01053
01054
01055
01056
01057
01059 typedef enum player_mute {
01060 PLAYER_MUTE_UNKNOWN,
01061 PLAYER_MUTE_ON,
01062 PLAYER_MUTE_OFF
01063 } player_mute_t;
01064
01080 int player_audio_volume_get (player_t *player);
01081
01092 void player_audio_volume_set (player_t *player, int value);
01093
01104 player_mute_t player_audio_mute_get (player_t *player);
01105
01116 void player_audio_mute_set (player_t *player, player_mute_t value);
01117
01131 void player_audio_set_delay (player_t *player, int value, int absolute);
01132
01143 void player_audio_select (player_t *player, int audio_id);
01144
01156 void player_audio_prev (player_t *player);
01157
01169 void player_audio_next (player_t *player);
01170
01175
01176
01177
01178
01179
01180
01182 typedef enum player_video_aspect {
01183 PLAYER_VIDEO_ASPECT_BRIGHTNESS,
01184 PLAYER_VIDEO_ASPECT_CONTRAST,
01185 PLAYER_VIDEO_ASPECT_GAMMA,
01186 PLAYER_VIDEO_ASPECT_HUE,
01187 PLAYER_VIDEO_ASPECT_SATURATION,
01188 } player_video_aspect_t;
01189
01208 void player_video_set_fullscreen (player_t *player, int value);
01209
01222 void player_video_set_aspect (player_t *player, player_video_aspect_t aspect,
01223 int8_t value, int absolute);
01224
01236 void player_video_set_panscan (player_t *player, int8_t value, int absolute);
01237
01248 void player_video_set_aspect_ratio (player_t *player, float value);
01249
01254
01255
01256
01257
01258
01259
01261 typedef enum player_sub_alignment {
01262 PLAYER_SUB_ALIGNMENT_TOP,
01263 PLAYER_SUB_ALIGNMENT_CENTER,
01264 PLAYER_SUB_ALIGNMENT_BOTTOM,
01265 } player_sub_alignment_t;
01266
01285 void player_subtitle_set_delay (player_t *player, int value);
01286
01297 void player_subtitle_set_alignment (player_t *player,
01298 player_sub_alignment_t a);
01299
01310 void player_subtitle_set_position (player_t *player, int value);
01311
01322 void player_subtitle_set_visibility (player_t *player, int value);
01323
01335 void player_subtitle_scale (player_t *player, int value, int absolute);
01336
01347 void player_subtitle_select (player_t *player, int sub_id);
01348
01360 void player_subtitle_prev (player_t *player);
01361
01373 void player_subtitle_next (player_t *player);
01374
01379
01380
01381
01382
01383
01384
01386 typedef enum player_dvdnav {
01387 PLAYER_DVDNAV_UP,
01388 PLAYER_DVDNAV_DOWN,
01389 PLAYER_DVDNAV_RIGHT,
01390 PLAYER_DVDNAV_LEFT,
01391 PLAYER_DVDNAV_MENU,
01392 PLAYER_DVDNAV_SELECT,
01393 PLAYER_DVDNAV_PREVMENU,
01394 PLAYER_DVDNAV_MOUSECLICK,
01395 } player_dvdnav_t;
01396
01412 void player_dvd_nav (player_t *player, player_dvdnav_t value);
01413
01424 void player_dvd_angle_select (player_t *player, int angle);
01425
01437 void player_dvd_angle_prev (player_t *player);
01438
01450 void player_dvd_angle_next (player_t *player);
01451
01462 void player_dvd_title_select (player_t *player, int title);
01463
01475 void player_dvd_title_prev (player_t *player);
01476
01488 void player_dvd_title_next (player_t *player);
01489
01494
01495
01496
01497
01498
01499
01515 void player_tv_channel_select (player_t *player, const char *channel);
01516
01528 void player_tv_channel_prev (player_t *player);
01529
01541 void player_tv_channel_next (player_t *player);
01542
01547
01548
01549
01550
01551
01552
01568 void player_radio_channel_select (player_t *player, const char *channel);
01569
01581 void player_radio_channel_prev (player_t *player);
01582
01594 void player_radio_channel_next (player_t *player);
01595
01600
01601
01602
01603
01604
01605
01607 typedef enum player_vdr {
01608 PLAYER_VDR_UP,
01609 PLAYER_VDR_DOWN,
01610 PLAYER_VDR_LEFT,
01611 PLAYER_VDR_RIGHT,
01612 PLAYER_VDR_OK,
01613 PLAYER_VDR_BACK,
01614 PLAYER_VDR_CHANNELPLUS,
01615 PLAYER_VDR_CHANNELMINUS,
01616 PLAYER_VDR_RED,
01617 PLAYER_VDR_GREEN,
01618 PLAYER_VDR_YELLOW,
01619 PLAYER_VDR_BLUE,
01620 PLAYER_VDR_PLAY,
01621 PLAYER_VDR_PAUSE,
01622 PLAYER_VDR_STOP,
01623 PLAYER_VDR_RECORD,
01624 PLAYER_VDR_FASTFWD,
01625 PLAYER_VDR_FASTREW,
01626 PLAYER_VDR_POWER,
01627 PLAYER_VDR_SCHEDULE,
01628 PLAYER_VDR_CHANNELS,
01629 PLAYER_VDR_TIMERS,
01630 PLAYER_VDR_RECORDINGS,
01631 PLAYER_VDR_MENU,
01632 PLAYER_VDR_SETUP,
01633 PLAYER_VDR_COMMANDS,
01634 PLAYER_VDR_0,
01635 PLAYER_VDR_1,
01636 PLAYER_VDR_2,
01637 PLAYER_VDR_3,
01638 PLAYER_VDR_4,
01639 PLAYER_VDR_5,
01640 PLAYER_VDR_6,
01641 PLAYER_VDR_7,
01642 PLAYER_VDR_8,
01643 PLAYER_VDR_9,
01644 PLAYER_VDR_USER_1,
01645 PLAYER_VDR_USER_2,
01646 PLAYER_VDR_USER_3,
01647 PLAYER_VDR_USER_4,
01648 PLAYER_VDR_USER_5,
01649 PLAYER_VDR_USER_6,
01650 PLAYER_VDR_USER_7,
01651 PLAYER_VDR_USER_8,
01652 PLAYER_VDR_USER_9,
01653 PLAYER_VDR_VOLPLUS,
01654 PLAYER_VDR_VOLMINUS,
01655 PLAYER_VDR_MUTE,
01656 PLAYER_VDR_AUDIO,
01657 PLAYER_VDR_INFO,
01658 PLAYER_VDR_CHANNELPREVIOUS,
01659 PLAYER_VDR_NEXT,
01660 PLAYER_VDR_PREVIOUS,
01661 PLAYER_VDR_SUBTITLES,
01662 } player_vdr_t;
01663
01679 void player_vdr (player_t *player, player_vdr_t value);
01680
01685
01686
01687
01688
01689
01690
01703 int libplayer_wrapper_enabled (player_type_t type);
01704
01713 int libplayer_wrapper_supported_res (player_type_t type, mrl_resource_t res);
01714
01719 #ifdef __cplusplus
01720 #if 0
01721 {
01722 #endif
01723 }
01724 #endif
01725
01726 #endif