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 uint8_t subpath_id;
00134 } BLURAY_STREAM_INFO;
00135
00136 typedef struct bd_clip {
00137 uint32_t pkt_count;
00138 uint8_t still_mode;
00139 uint16_t still_time;
00140 uint8_t video_stream_count;
00141 uint8_t audio_stream_count;
00142 uint8_t pg_stream_count;
00143 uint8_t ig_stream_count;
00144 uint8_t sec_audio_stream_count;
00145 uint8_t sec_video_stream_count;
00146 BLURAY_STREAM_INFO *video_streams;
00147 BLURAY_STREAM_INFO *audio_streams;
00148 BLURAY_STREAM_INFO *pg_streams;
00149 BLURAY_STREAM_INFO *ig_streams;
00150 BLURAY_STREAM_INFO *sec_audio_streams;
00151 BLURAY_STREAM_INFO *sec_video_streams;
00152
00153 uint64_t start_time;
00154 uint64_t in_time;
00155 uint64_t out_time;
00156 } BLURAY_CLIP_INFO;
00157
00158 typedef struct bd_chapter {
00159 uint32_t idx;
00160 uint64_t start;
00161 uint64_t duration;
00162 uint64_t offset;
00163 unsigned clip_ref;
00164 } BLURAY_TITLE_CHAPTER;
00165
00166 typedef struct bd_mark {
00167 uint32_t idx;
00168 int type;
00169 uint64_t start;
00170 uint64_t duration;
00171 uint64_t offset;
00172 unsigned clip_ref;
00173 } BLURAY_TITLE_MARK;
00174
00175 typedef struct bd_title_info {
00176 uint32_t idx;
00177 uint32_t playlist;
00178 uint64_t duration;
00179 uint32_t clip_count;
00180 uint8_t angle_count;
00181 uint32_t chapter_count;
00182 BLURAY_CLIP_INFO *clips;
00183 BLURAY_TITLE_CHAPTER *chapters;
00184
00185 uint32_t mark_count;
00186 BLURAY_TITLE_MARK *marks;
00187 } BLURAY_TITLE_INFO;
00188
00189 typedef struct bd_sound_effect {
00190 uint8_t num_channels;
00191 uint32_t num_frames;
00192 const int16_t *samples;
00193 } BLURAY_SOUND_EFFECT;
00194
00199 void bd_get_version(int *major, int *minor, int *micro);
00200
00212 uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length);
00213
00223 BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle);
00224
00234 BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle);
00235
00242 void bd_free_title_info(BLURAY_TITLE_INFO *title_info);
00243
00251 BLURAY *bd_open(const char* device_path, const char* keyfile_path);
00252
00258 void bd_close(BLURAY *bd);
00259
00267 int64_t bd_seek(BLURAY *bd, uint64_t pos);
00268
00277 int64_t bd_seek_time(BLURAY *bd, uint64_t tick);
00278
00288 int bd_read(BLURAY *bd, unsigned char *buf, int len);
00289
00297 int bd_read_skip_still(BLURAY *bd);
00298
00307 int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter);
00308
00317 int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter);
00318
00326 uint32_t bd_get_current_chapter(BLURAY *bd);
00327
00336 int64_t bd_seek_mark(BLURAY *bd, unsigned mark);
00337
00346 int64_t bd_seek_playitem(BLURAY *bd, unsigned clip_ref);
00347
00356 int bd_select_playlist(BLURAY *bd, uint32_t playlist);
00357
00366 int bd_select_title(BLURAY *bd, uint32_t title);
00367
00376 int bd_select_angle(BLURAY *bd, unsigned angle);
00377
00385 void bd_seamless_angle_change(BLURAY *bd, unsigned angle);
00386
00396 uint64_t bd_get_title_size(BLURAY *bd);
00397
00405 uint32_t bd_get_current_title(BLURAY *bd);
00406
00414 unsigned bd_get_current_angle(BLURAY *bd);
00415
00423 uint64_t bd_tell(BLURAY *bd);
00424
00432 uint64_t bd_tell_time(BLURAY *bd);
00433
00434
00435
00436
00437
00438
00439 #define BD_AACS_CORRUPTED_DISC -1
00440 #define BD_AACS_NO_CONFIG -2
00441 #define BD_AACS_NO_PK -3
00442 #define BD_AACS_NO_CERT -4
00443 #define BD_AACS_CERT_REVOKED -5
00444 #define BD_AACS_MMC_FAILED -6
00445
00446 typedef struct {
00447 uint8_t bluray_detected;
00448
00449 uint8_t first_play_supported;
00450 uint8_t top_menu_supported;
00451
00452 uint32_t num_hdmv_titles;
00453 uint32_t num_bdj_titles;
00454 uint32_t num_unsupported_titles;
00455
00456 uint8_t aacs_detected;
00457 uint8_t libaacs_detected;
00458 uint8_t aacs_handled;
00459
00460 uint8_t bdplus_detected;
00461 uint8_t libbdplus_detected;
00462 uint8_t bdplus_handled;
00463
00464
00465 int aacs_error_code;
00466
00467 int aacs_mkbv;
00468
00469
00470 uint8_t disc_id[20];
00471
00472 } BLURAY_DISC_INFO;
00473
00481 const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY*);
00482
00483
00484
00485
00486
00487 typedef enum {
00488 BLURAY_PLAYER_SETTING_PARENTAL = 13,
00489 BLURAY_PLAYER_SETTING_AUDIO_CAP = 15,
00490 BLURAY_PLAYER_SETTING_AUDIO_LANG = 16,
00491 BLURAY_PLAYER_SETTING_PG_LANG = 17,
00492 BLURAY_PLAYER_SETTING_MENU_LANG = 18,
00493 BLURAY_PLAYER_SETTING_COUNTRY_CODE = 19,
00494 BLURAY_PLAYER_SETTING_REGION_CODE = 20,
00495 BLURAY_PLAYER_SETTING_OUTPUT_PREFER = 21,
00496 BLURAY_PLAYER_SETTING_DISPLAY_CAP = 23,
00497 BLURAY_PLAYER_SETTING_3D_CAP = 24,
00498 BLURAY_PLAYER_SETTING_VIDEO_CAP = 29,
00499 BLURAY_PLAYER_SETTING_TEXT_CAP = 30,
00500 BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31,
00501
00502 BLURAY_PLAYER_SETTING_DECODE_PG = 0x100,
00503 } bd_player_setting;
00504
00515 int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value);
00516 int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s);
00517
00518
00519
00520
00521 int bd_start_bdj(BLURAY *bd, const char* start_object);
00522 void bd_stop_bdj(BLURAY *bd);
00523
00524
00525
00526
00527
00528 typedef enum {
00529
00530 BD_EVENT_NONE = 0,
00531
00532
00533
00534
00535
00536 BD_EVENT_ERROR = 1,
00537 BD_EVENT_READ_ERROR = 2,
00538 BD_EVENT_ENCRYPTED = 3,
00539
00540
00541
00542
00543
00544 BD_EVENT_ANGLE = 4,
00545 BD_EVENT_TITLE = 5,
00546 BD_EVENT_PLAYLIST = 6,
00547 BD_EVENT_PLAYITEM = 7,
00548 BD_EVENT_CHAPTER = 8,
00549 BD_EVENT_PLAYMARK = 30,
00550 BD_EVENT_END_OF_TITLE = 9,
00551
00552
00553
00554
00555
00556 BD_EVENT_AUDIO_STREAM = 10,
00557 BD_EVENT_IG_STREAM = 11,
00558 BD_EVENT_PG_TEXTST_STREAM = 12,
00559 BD_EVENT_PIP_PG_TEXTST_STREAM = 13,
00560 BD_EVENT_SECONDARY_AUDIO_STREAM = 14,
00561 BD_EVENT_SECONDARY_VIDEO_STREAM = 15,
00562
00563 BD_EVENT_PG_TEXTST = 16,
00564 BD_EVENT_PIP_PG_TEXTST = 17,
00565 BD_EVENT_SECONDARY_AUDIO = 18,
00566 BD_EVENT_SECONDARY_VIDEO = 19,
00567 BD_EVENT_SECONDARY_VIDEO_SIZE = 20,
00568
00569
00570
00571
00572
00573
00574 BD_EVENT_DISCONTINUITY = 28,
00575
00576
00577 BD_EVENT_SEEK = 21,
00578
00579
00580 BD_EVENT_STILL = 22,
00581
00582
00583
00584 BD_EVENT_STILL_TIME = 23,
00585
00586
00587 BD_EVENT_SOUND_EFFECT = 24,
00588
00589
00590
00591
00592
00593
00594 BD_EVENT_IDLE = 29,
00595
00596
00597 BD_EVENT_POPUP = 25,
00598
00599
00600 BD_EVENT_MENU = 26,
00601
00602
00603 BD_EVENT_STEREOSCOPIC_STATUS = 27,
00604
00605
00606
00607 } bd_event_e;
00608
00609 typedef struct {
00610 uint32_t event;
00611 uint32_t param;
00612 } BD_EVENT;
00613
00614 #define BLURAY_TITLE_FIRST_PLAY 0xffff
00615 #define BLURAY_TITLE_TOP_MENU 0
00616
00624 int bd_get_event(BLURAY *bd, BD_EVENT *event);
00625
00626
00627
00628
00629
00639 int bd_play(BLURAY *bd);
00640
00653 int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event);
00654
00667 int bd_play_title(BLURAY *bd, unsigned title);
00668
00679 int bd_menu_call(BLURAY *bd, int64_t pts);
00680
00681
00682
00683
00684
00685 struct bd_overlay_s;
00686 struct bd_argb_overlay_s;
00687 struct bd_argb_buffer_s;
00688 typedef void (*bd_overlay_proc_f)(void *, const struct bd_overlay_s * const);
00689 typedef void (*bd_argb_overlay_proc_f)(void *, const struct bd_argb_overlay_s * const);
00690
00691
00710 void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func);
00711
00727 void bd_register_argb_overlay_proc(BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, struct bd_argb_buffer_s *buf);
00728
00736 void bd_set_scr(BLURAY *bd, int64_t pts);
00737
00749 int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key);
00750
00761 int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y);
00762
00772 int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect);
00773
00774
00775
00776
00777
00778 struct meta_dl;
00786 const struct meta_dl *bd_get_meta(BLURAY *bd);
00787
00788
00789 struct clpi_cl;
00798 struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref);
00799
00806 void bd_free_clpi(struct clpi_cl *cl);
00807
00808 #ifdef __cplusplus
00809 };
00810 #endif
00811
00812 #endif