00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef BLURAY_H_
00023 #define BLURAY_H_
00024
00030 #include <stdint.h>
00031
00032 #define TITLES_ALL 0
00033 #define TITLES_FILTER_DUP_TITLE 0x01
00034 #define TITLES_FILTER_DUP_CLIP 0x02
00036 #define TITLES_RELEVANT \
00037 (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
00040 typedef struct bluray BLURAY;
00041
00042 typedef enum {
00043 BLURAY_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
00044 BLURAY_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
00045 BLURAY_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
00046 BLURAY_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
00047 BLURAY_STREAM_TYPE_AUDIO_LPCM = 0x80,
00048 BLURAY_STREAM_TYPE_AUDIO_AC3 = 0x81,
00049 BLURAY_STREAM_TYPE_AUDIO_DTS = 0x82,
00050 BLURAY_STREAM_TYPE_AUDIO_TRUHD = 0x83,
00051 BLURAY_STREAM_TYPE_AUDIO_AC3PLUS = 0x84,
00052 BLURAY_STREAM_TYPE_AUDIO_DTSHD = 0x85,
00053 BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER = 0x86,
00054 BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea,
00055 BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b,
00056 BLURAY_STREAM_TYPE_SUB_PG = 0x90,
00057 BLURAY_STREAM_TYPE_SUB_IG = 0x91,
00058 BLURAY_STREAM_TYPE_SUB_TEXT = 0x92
00059 } bd_stream_type_e;
00060
00061 typedef enum {
00062 BLURAY_VIDEO_FORMAT_480I = 1,
00063 BLURAY_VIDEO_FORMAT_576I = 2,
00064 BLURAY_VIDEO_FORMAT_480P = 3,
00065 BLURAY_VIDEO_FORMAT_1080I = 4,
00066 BLURAY_VIDEO_FORMAT_720P = 5,
00067 BLURAY_VIDEO_FORMAT_1080P = 6,
00068 BLURAY_VIDEO_FORMAT_576P = 7
00069 } bd_video_format_e;
00070
00071 typedef enum {
00072 BLURAY_VIDEO_RATE_24000_1001 = 1,
00073 BLURAY_VIDEO_RATE_24 = 2,
00074 BLURAY_VIDEO_RATE_25 = 3,
00075 BLURAY_VIDEO_RATE_30000_1001 = 4,
00076 BLURAY_VIDEO_RATE_50 = 6,
00077 BLURAY_VIDEO_RATE_60000_1001 = 7
00078 } bd_video_rate_e;
00079
00080 typedef enum {
00081 BLURAY_ASPECT_RATIO_4_3 = 2,
00082 BLURAY_ASPECT_RATIO_16_9 = 3
00083 } bd_video_aspect_e;
00084
00085 typedef enum {
00086 BLURAY_AUDIO_FORMAT_MONO = 1,
00087 BLURAY_AUDIO_FORMAT_STEREO = 3,
00088 BLURAY_AUDIO_FORMAT_MULTI_CHAN = 6,
00089 BLURAY_AUDIO_FORMAT_COMBO = 12
00090 } bd_audio_format_e;
00091
00092
00093 typedef enum {
00094 BLURAY_AUDIO_RATE_48 = 1,
00095 BLURAY_AUDIO_RATE_96 = 4,
00096 BLURAY_AUDIO_RATE_192 = 5,
00097 BLURAY_AUDIO_RATE_192_COMBO = 12,
00098
00099 BLURAY_AUDIO_RATE_96_COMBO = 14
00100
00101 } bd_audio_rate_e;
00102
00103 typedef enum {
00104 BLURAY_TEXT_CHAR_CODE_UTF8 = 0x01,
00105 BLURAY_TEXT_CHAR_CODE_UTF16BE = 0x02,
00106 BLURAY_TEXT_CHAR_CODE_SHIFT_JIS = 0x03,
00107 BLURAY_TEXT_CHAR_CODE_EUC_KR = 0x04,
00108 BLURAY_TEXT_CHAR_CODE_GB18030_20001 = 0x05,
00109 BLURAY_TEXT_CHAR_CODE_CN_GB = 0x06,
00110 BLURAY_TEXT_CHAR_CODE_BIG5 = 0x07
00111 } bd_char_code_e;
00112
00113 typedef enum {
00114 BLURAY_STILL_NONE = 0x00,
00115 BLURAY_STILL_TIME = 0x01,
00116 BLURAY_STILL_INFINITE = 0x02,
00117 } bd_still_mode_e;
00118
00119 typedef struct bd_stream_info {
00120 uint8_t coding_type;
00121 uint8_t format;
00122 uint8_t rate;
00123 uint8_t char_code;
00124 uint8_t lang[4];
00125 uint16_t pid;
00126 uint8_t aspect;
00127 } BLURAY_STREAM_INFO;
00128
00129 typedef struct bd_clip {
00130 uint32_t pkt_count;
00131 uint8_t still_mode;
00132 uint16_t still_time;
00133 uint8_t video_stream_count;
00134 uint8_t audio_stream_count;
00135 uint8_t pg_stream_count;
00136 uint8_t ig_stream_count;
00137 uint8_t sec_audio_stream_count;
00138 uint8_t sec_video_stream_count;
00139 BLURAY_STREAM_INFO *video_streams;
00140 BLURAY_STREAM_INFO *audio_streams;
00141 BLURAY_STREAM_INFO *pg_streams;
00142 BLURAY_STREAM_INFO *ig_streams;
00143 BLURAY_STREAM_INFO *sec_audio_streams;
00144 BLURAY_STREAM_INFO *sec_video_streams;
00145 } BLURAY_CLIP_INFO;
00146
00147 typedef struct bd_chapter {
00148 uint32_t idx;
00149 uint64_t start;
00150 uint64_t duration;
00151 uint64_t offset;
00152 } BLURAY_TITLE_CHAPTER;
00153
00154 typedef struct bd_title_info {
00155 uint32_t idx;
00156 uint32_t playlist;
00157 uint64_t duration;
00158 uint32_t clip_count;
00159 uint8_t angle_count;
00160 uint32_t chapter_count;
00161 BLURAY_CLIP_INFO *clips;
00162 BLURAY_TITLE_CHAPTER *chapters;
00163 } BLURAY_TITLE_INFO;
00164
00175 uint32_t bd_get_titles(BLURAY *bd, uint8_t flags);
00176
00185 BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx);
00186
00195 BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist);
00196
00203 void bd_free_title_info(BLURAY_TITLE_INFO *title_info);
00204
00212 BLURAY *bd_open(const char* device_path, const char* keyfile_path);
00213
00219 void bd_close(BLURAY *bd);
00220
00228 int64_t bd_seek(BLURAY *bd, uint64_t pos);
00229
00238 int64_t bd_seek_time(BLURAY *bd, uint64_t tick);
00239
00249 int bd_read(BLURAY *bd, unsigned char *buf, int len);
00250
00259 int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter);
00260
00269 int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter);
00270
00278 uint32_t bd_get_current_chapter(BLURAY *bd);
00279
00288 int64_t bd_seek_mark(BLURAY *bd, unsigned mark);
00289
00298 int bd_select_playlist(BLURAY *bd, uint32_t playlist);
00299
00308 int bd_select_title(BLURAY *bd, uint32_t title);
00309
00318 int bd_select_angle(BLURAY *bd, unsigned angle);
00319
00327 void bd_seamless_angle_change(BLURAY *bd, unsigned angle);
00328
00338 uint64_t bd_get_title_size(BLURAY *bd);
00339
00347 uint32_t bd_get_current_title(BLURAY *bd);
00348
00356 unsigned bd_get_current_angle(BLURAY *bd);
00357
00365 uint64_t bd_tell(BLURAY *bd);
00366
00374 uint64_t bd_tell_time(BLURAY *bd);
00375
00376
00377
00378
00379
00380 typedef struct {
00381 uint8_t bluray_detected;
00382
00383 uint8_t first_play_supported;
00384 uint8_t top_menu_supported;
00385
00386 uint32_t num_hdmv_titles;
00387 uint32_t num_bdj_titles;
00388 uint32_t num_unsupported_titles;
00389
00390 uint8_t aacs_detected;
00391 uint8_t libaacs_detected;
00392 uint8_t aacs_handled;
00393
00394 uint8_t bdplus_detected;
00395 uint8_t libbdplus_detected;
00396 uint8_t bdplus_handled;
00397
00398 } BLURAY_DISC_INFO;
00399
00407 const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY*);
00408
00409
00410
00411
00412
00413 typedef enum {
00414 BLURAY_PLAYER_SETTING_PARENTAL = 13,
00415 BLURAY_PLAYER_SETTING_AUDIO_CAP = 15,
00416 BLURAY_PLAYER_SETTING_AUDIO_LANG = 16,
00417 BLURAY_PLAYER_SETTING_PG_LANG = 17,
00418 BLURAY_PLAYER_SETTING_MENU_LANG = 18,
00419 BLURAY_PLAYER_SETTING_COUNTRY_CODE = 19,
00420 BLURAY_PLAYER_SETTING_REGION_CODE = 20,
00421 BLURAY_PLAYER_SETTING_VIDEO_CAP = 29,
00422 BLURAY_PLAYER_SETTING_TEXT_CAP = 30,
00423 BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31,
00424 } bd_player_setting;
00425
00436 int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value);
00437 int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s);
00438
00439
00440
00441
00442 int bd_start_bdj(BLURAY *bd, const char* start_object);
00443 void bd_stop_bdj(BLURAY *bd);
00444
00445
00446
00447
00448
00449 typedef enum {
00450 BD_EVENT_NONE = 0,
00451 BD_EVENT_ERROR,
00452 BD_EVENT_ENCRYPTED,
00453
00454
00455 BD_EVENT_ANGLE,
00456 BD_EVENT_TITLE,
00457 BD_EVENT_PLAYLIST,
00458 BD_EVENT_PLAYITEM,
00459 BD_EVENT_CHAPTER,
00460 BD_EVENT_END_OF_TITLE,
00461
00462
00463 BD_EVENT_AUDIO_STREAM,
00464 BD_EVENT_IG_STREAM,
00465 BD_EVENT_PG_TEXTST_STREAM,
00466 BD_EVENT_PIP_PG_TEXTST_STREAM,
00467 BD_EVENT_SECONDARY_AUDIO_STREAM,
00468 BD_EVENT_SECONDARY_VIDEO_STREAM,
00469
00470 BD_EVENT_PG_TEXTST,
00471 BD_EVENT_PIP_PG_TEXTST,
00472 BD_EVENT_SECONDARY_AUDIO,
00473 BD_EVENT_SECONDARY_VIDEO,
00474 BD_EVENT_SECONDARY_VIDEO_SIZE,
00475
00476
00477 BD_EVENT_SEEK,
00478
00479
00480 BD_EVENT_STILL,
00481
00482
00483 BD_EVENT_STILL_TIME,
00484
00485 } bd_event_e;
00486
00487 typedef struct {
00488 uint32_t event;
00489 uint32_t param;
00490 } BD_EVENT;
00491
00492 #define BLURAY_TITLE_FIRST_PLAY 0xffff
00493 #define BLURAY_TITLE_TOP_MENU 0
00494
00502 int bd_get_event(BLURAY *bd, BD_EVENT *event);
00503
00504
00505
00506
00507
00517 int bd_play(BLURAY *bd);
00518
00531 int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event);
00532
00545 int bd_play_title(BLURAY *bd, unsigned title);
00546
00557 int bd_menu_call(BLURAY *bd, int64_t pts);
00558
00559
00560
00561
00562
00563 struct bd_overlay_s;
00564 typedef void (*bd_overlay_proc_f)(void *, const struct bd_overlay_s * const);
00565
00575 void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func);
00576
00588 void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key);
00589
00600 void bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y);
00601
00602 struct meta_dl;
00610 struct meta_dl *bd_get_meta(BLURAY *bd);
00611
00612 #endif