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
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028
00034 #include <stdint.h>
00035
00036 #define TITLES_ALL 0
00037 #define TITLES_FILTER_DUP_TITLE 0x01
00038 #define TITLES_FILTER_DUP_CLIP 0x02
00040 #define TITLES_RELEVANT \
00041 (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
00044 typedef struct bluray BLURAY;
00045
00046 typedef enum {
00047 BLURAY_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
00048 BLURAY_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
00049 BLURAY_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
00050 BLURAY_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
00051 BLURAY_STREAM_TYPE_AUDIO_LPCM = 0x80,
00052 BLURAY_STREAM_TYPE_AUDIO_AC3 = 0x81,
00053 BLURAY_STREAM_TYPE_AUDIO_DTS = 0x82,
00054 BLURAY_STREAM_TYPE_AUDIO_TRUHD = 0x83,
00055 BLURAY_STREAM_TYPE_AUDIO_AC3PLUS = 0x84,
00056 BLURAY_STREAM_TYPE_AUDIO_DTSHD = 0x85,
00057 BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER = 0x86,
00058 BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea,
00059 BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b,
00060 BLURAY_STREAM_TYPE_SUB_PG = 0x90,
00061 BLURAY_STREAM_TYPE_SUB_IG = 0x91,
00062 BLURAY_STREAM_TYPE_SUB_TEXT = 0x92,
00063 BLURAY_STREAM_TYPE_AUDIO_AC3PLUS_SECONDARY = 0xa1,
00064 BLURAY_STREAM_TYPE_AUDIO_DTSHD_SECONDARY = 0xa2
00065 } bd_stream_type_e;
00066
00067 typedef enum {
00068 BLURAY_VIDEO_FORMAT_480I = 1,
00069 BLURAY_VIDEO_FORMAT_576I = 2,
00070 BLURAY_VIDEO_FORMAT_480P = 3,
00071 BLURAY_VIDEO_FORMAT_1080I = 4,
00072 BLURAY_VIDEO_FORMAT_720P = 5,
00073 BLURAY_VIDEO_FORMAT_1080P = 6,
00074 BLURAY_VIDEO_FORMAT_576P = 7
00075 } bd_video_format_e;
00076
00077 typedef enum {
00078 BLURAY_VIDEO_RATE_24000_1001 = 1,
00079 BLURAY_VIDEO_RATE_24 = 2,
00080 BLURAY_VIDEO_RATE_25 = 3,
00081 BLURAY_VIDEO_RATE_30000_1001 = 4,
00082 BLURAY_VIDEO_RATE_50 = 6,
00083 BLURAY_VIDEO_RATE_60000_1001 = 7
00084 } bd_video_rate_e;
00085
00086 typedef enum {
00087 BLURAY_ASPECT_RATIO_4_3 = 2,
00088 BLURAY_ASPECT_RATIO_16_9 = 3
00089 } bd_video_aspect_e;
00090
00091 typedef enum {
00092 BLURAY_AUDIO_FORMAT_MONO = 1,
00093 BLURAY_AUDIO_FORMAT_STEREO = 3,
00094 BLURAY_AUDIO_FORMAT_MULTI_CHAN = 6,
00095 BLURAY_AUDIO_FORMAT_COMBO = 12
00096 } bd_audio_format_e;
00097
00098
00099 typedef enum {
00100 BLURAY_AUDIO_RATE_48 = 1,
00101 BLURAY_AUDIO_RATE_96 = 4,
00102 BLURAY_AUDIO_RATE_192 = 5,
00103 BLURAY_AUDIO_RATE_192_COMBO = 12,
00104
00105 BLURAY_AUDIO_RATE_96_COMBO = 14
00106
00107 } bd_audio_rate_e;
00108
00109 typedef enum {
00110 BLURAY_TEXT_CHAR_CODE_UTF8 = 0x01,
00111 BLURAY_TEXT_CHAR_CODE_UTF16BE = 0x02,
00112 BLURAY_TEXT_CHAR_CODE_SHIFT_JIS = 0x03,
00113 BLURAY_TEXT_CHAR_CODE_EUC_KR = 0x04,
00114 BLURAY_TEXT_CHAR_CODE_GB18030_20001 = 0x05,
00115 BLURAY_TEXT_CHAR_CODE_CN_GB = 0x06,
00116 BLURAY_TEXT_CHAR_CODE_BIG5 = 0x07
00117 } bd_char_code_e;
00118
00119 typedef enum {
00120 BLURAY_STILL_NONE = 0x00,
00121 BLURAY_STILL_TIME = 0x01,
00122 BLURAY_STILL_INFINITE = 0x02,
00123 } bd_still_mode_e;
00124
00125 typedef struct bd_stream_info {
00126 uint8_t coding_type;
00127 uint8_t format;
00128 uint8_t rate;
00129 uint8_t char_code;
00130 uint8_t lang[4];
00131 uint16_t pid;
00132 uint8_t aspect;
00133 } BLURAY_STREAM_INFO;
00134
00135 typedef struct bd_clip {
00136 uint32_t pkt_count;
00137 uint8_t still_mode;
00138 uint16_t still_time;
00139 uint8_t video_stream_count;
00140 uint8_t audio_stream_count;
00141 uint8_t pg_stream_count;
00142 uint8_t ig_stream_count;
00143 uint8_t sec_audio_stream_count;
00144 uint8_t sec_video_stream_count;
00145 BLURAY_STREAM_INFO *video_streams;
00146 BLURAY_STREAM_INFO *audio_streams;
00147 BLURAY_STREAM_INFO *pg_streams;
00148 BLURAY_STREAM_INFO *ig_streams;
00149 BLURAY_STREAM_INFO *sec_audio_streams;
00150 BLURAY_STREAM_INFO *sec_video_streams;
00151 } BLURAY_CLIP_INFO;
00152
00153 typedef struct bd_chapter {
00154 uint32_t idx;
00155 uint64_t start;
00156 uint64_t duration;
00157 uint64_t offset;
00158 } BLURAY_TITLE_CHAPTER;
00159
00160 typedef struct bd_title_info {
00161 uint32_t idx;
00162 uint32_t playlist;
00163 uint64_t duration;
00164 uint32_t clip_count;
00165 uint8_t angle_count;
00166 uint32_t chapter_count;
00167 BLURAY_CLIP_INFO *clips;
00168 BLURAY_TITLE_CHAPTER *chapters;
00169 } BLURAY_TITLE_INFO;
00170
00171 typedef struct bd_sound_effect {
00172 uint8_t num_channels;
00173 uint32_t num_frames;
00174 const int16_t *samples;
00175 } BLURAY_SOUND_EFFECT;
00176
00181 void bd_get_version(int *major, int *minor, int *micro);
00182
00194 uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length);
00195
00205 BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle);
00206
00216 BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle);
00217
00224 void bd_free_title_info(BLURAY_TITLE_INFO *title_info);
00225
00233 BLURAY *bd_open(const char* device_path, const char* keyfile_path);
00234
00240 void bd_close(BLURAY *bd);
00241
00249 int64_t bd_seek(BLURAY *bd, uint64_t pos);
00250
00259 int64_t bd_seek_time(BLURAY *bd, uint64_t tick);
00260
00270 int bd_read(BLURAY *bd, unsigned char *buf, int len);
00271
00279 int bd_read_skip_still(BLURAY *bd);
00280
00289 int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter);
00290
00299 int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter);
00300
00308 uint32_t bd_get_current_chapter(BLURAY *bd);
00309
00318 int64_t bd_seek_mark(BLURAY *bd, unsigned mark);
00319
00328 int bd_select_playlist(BLURAY *bd, uint32_t playlist);
00329
00338 int bd_select_title(BLURAY *bd, uint32_t title);
00339
00348 int bd_select_angle(BLURAY *bd, unsigned angle);
00349
00357 void bd_seamless_angle_change(BLURAY *bd, unsigned angle);
00358
00368 uint64_t bd_get_title_size(BLURAY *bd);
00369
00377 uint32_t bd_get_current_title(BLURAY *bd);
00378
00386 unsigned bd_get_current_angle(BLURAY *bd);
00387
00395 uint64_t bd_tell(BLURAY *bd);
00396
00404 uint64_t bd_tell_time(BLURAY *bd);
00405
00406
00407
00408
00409
00410
00411 #define BD_AACS_CORRUPTED_DISC -1
00412 #define BD_AACS_NO_CONFIG -2
00413 #define BD_AACS_NO_PK -3
00414 #define BD_AACS_NO_CERT -4
00415 #define BD_AACS_CERT_REVOKED -5
00416 #define BD_AACS_MMC_FAILED -6
00417
00418 typedef struct {
00419 uint8_t bluray_detected;
00420
00421 uint8_t first_play_supported;
00422 uint8_t top_menu_supported;
00423
00424 uint32_t num_hdmv_titles;
00425 uint32_t num_bdj_titles;
00426 uint32_t num_unsupported_titles;
00427
00428 uint8_t aacs_detected;
00429 uint8_t libaacs_detected;
00430 uint8_t aacs_handled;
00431
00432 uint8_t bdplus_detected;
00433 uint8_t libbdplus_detected;
00434 uint8_t bdplus_handled;
00435
00436
00437 int aacs_error_code;
00438
00439 int aacs_mkbv;
00440
00441
00442 uint8_t disc_id[20];
00443
00444 } BLURAY_DISC_INFO;
00445
00453 const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY*);
00454
00455
00456
00457
00458
00459 typedef enum {
00460 BLURAY_PLAYER_SETTING_PARENTAL = 13,
00461 BLURAY_PLAYER_SETTING_AUDIO_CAP = 15,
00462 BLURAY_PLAYER_SETTING_AUDIO_LANG = 16,
00463 BLURAY_PLAYER_SETTING_PG_LANG = 17,
00464 BLURAY_PLAYER_SETTING_MENU_LANG = 18,
00465 BLURAY_PLAYER_SETTING_COUNTRY_CODE = 19,
00466 BLURAY_PLAYER_SETTING_REGION_CODE = 20,
00467 BLURAY_PLAYER_SETTING_VIDEO_CAP = 29,
00468 BLURAY_PLAYER_SETTING_TEXT_CAP = 30,
00469 BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31,
00470 } bd_player_setting;
00471
00482 int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value);
00483 int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s);
00484
00485
00486
00487
00488 int bd_start_bdj(BLURAY *bd, const char* start_object);
00489 void bd_stop_bdj(BLURAY *bd);
00490
00491
00492
00493
00494
00495 typedef enum {
00496 BD_EVENT_NONE = 0,
00497 BD_EVENT_ERROR,
00498 BD_EVENT_READ_ERROR,
00499 BD_EVENT_ENCRYPTED,
00500
00501
00502 BD_EVENT_ANGLE,
00503 BD_EVENT_TITLE,
00504 BD_EVENT_PLAYLIST,
00505 BD_EVENT_PLAYITEM,
00506 BD_EVENT_CHAPTER,
00507 BD_EVENT_END_OF_TITLE,
00508
00509
00510 BD_EVENT_AUDIO_STREAM,
00511 BD_EVENT_IG_STREAM,
00512 BD_EVENT_PG_TEXTST_STREAM,
00513 BD_EVENT_PIP_PG_TEXTST_STREAM,
00514 BD_EVENT_SECONDARY_AUDIO_STREAM,
00515 BD_EVENT_SECONDARY_VIDEO_STREAM,
00516
00517 BD_EVENT_PG_TEXTST,
00518 BD_EVENT_PIP_PG_TEXTST,
00519 BD_EVENT_SECONDARY_AUDIO,
00520 BD_EVENT_SECONDARY_VIDEO,
00521 BD_EVENT_SECONDARY_VIDEO_SIZE,
00522
00523
00524 BD_EVENT_SEEK,
00525
00526
00527 BD_EVENT_STILL,
00528
00529
00530 BD_EVENT_STILL_TIME,
00531
00532
00533 BD_EVENT_SOUND_EFFECT,
00534
00535
00536 BD_EVENT_POPUP,
00537
00538
00539 BD_EVENT_MENU,
00540 } bd_event_e;
00541
00542 typedef struct {
00543 uint32_t event;
00544 uint32_t param;
00545 } BD_EVENT;
00546
00547 #define BLURAY_TITLE_FIRST_PLAY 0xffff
00548 #define BLURAY_TITLE_TOP_MENU 0
00549
00557 int bd_get_event(BLURAY *bd, BD_EVENT *event);
00558
00559
00560
00561
00562
00572 int bd_play(BLURAY *bd);
00573
00586 int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event);
00587
00600 int bd_play_title(BLURAY *bd, unsigned title);
00601
00612 int bd_menu_call(BLURAY *bd, int64_t pts);
00613
00614
00615
00616
00617
00618 struct bd_overlay_s;
00619 typedef void (*bd_overlay_proc_f)(void *, const struct bd_overlay_s * const);
00620
00630 void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func);
00631
00643 int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key);
00644
00655 int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y);
00656
00666 int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect);
00667
00668
00669
00670
00671
00672 struct meta_dl;
00680 const struct meta_dl *bd_get_meta(BLURAY *bd);
00681
00682
00683 struct clpi_cl;
00692 struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref);
00693
00700 void bd_free_clpi(struct clpi_cl *cl);
00701
00702 #ifdef __cplusplus
00703 };
00704 #endif
00705
00706 #endif