libbluray
bluray.h
Go to the documentation of this file.
1 /*
2  * This file is part of libbluray
3  * Copyright (C) 2009-2010 Obliter0n
4  * Copyright (C) 2009-2010 John Stebbins
5  * Copyright (C) 2010-2017 Petri Hintukainen
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef BLURAY_H_
23 #define BLURAY_H_
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
34 #include <stdint.h>
35 #include "bdnav/clpi_data.h"
36 
37 #define TITLES_ALL 0
38 #define TITLES_FILTER_DUP_TITLE 0x01
39 #define TITLES_FILTER_DUP_CLIP 0x02
41 #define TITLES_RELEVANT \
42  (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
45 typedef struct bluray BLURAY;
46 
47 /*
48  * Disc info
49  */
50 
51 /* AACS error codes */
52 #define BD_AACS_CORRUPTED_DISC -1
53 #define BD_AACS_NO_CONFIG -2
54 #define BD_AACS_NO_PK -3
55 #define BD_AACS_NO_CERT -4
56 #define BD_AACS_CERT_REVOKED -5
57 #define BD_AACS_MMC_FAILED -6
58 
59 /* HDMV / BD-J title */
60 typedef struct {
61  const char *name; /* optional title name in preferred language */
62  uint8_t interactive; /* 1 if title is interactive (title length and playback position should not be shown in UI) */
63  uint8_t accessible; /* 1 if it is allowed to jump into this title */
64  uint8_t hidden; /* 1 if title number should not be shown during playback */
65 
66  uint8_t bdj; /* 0 - HDMV title. 1 - BD-J title */
67  uint32_t id_ref; /* Movie Object number / bdjo file number */
68 } BLURAY_TITLE;
69 
70 typedef struct {
71  uint8_t bluray_detected;
72 
73  /* Disc ID */
74  const char *disc_name; /* optional disc name in preferred language */
75  const char *udf_volume_id; /* optional UDF volume identifier */
76  uint8_t disc_id[20];
77 
78  /* HDMV / BD-J titles */
79  uint8_t no_menu_support; /* 1 if this disc can't be played using on-disc menus */
80  uint8_t first_play_supported;
81  uint8_t top_menu_supported;
82 
83  uint32_t num_titles;
84  const BLURAY_TITLE *const *titles; /* index is title number 1 ... N */
85  const BLURAY_TITLE *first_play; /* titles[N+1]. NULL if not present on the disc. */
86  const BLURAY_TITLE *top_menu; /* titles[0]. NULL if not present on the disc. */
87 
88  uint32_t num_hdmv_titles;
89  uint32_t num_bdj_titles;
90  uint32_t num_unsupported_titles;
91 
92  /* BD-J info (valid only if disc uses BD-J) */
93  uint8_t bdj_detected; /* 1 if disc uses BD-J */
94  uint8_t bdj_supported; /* 1 if BD-J support was compiled in */
95  uint8_t libjvm_detected; /* 1 if usable Java VM was found */
96  uint8_t bdj_handled; /* 1 if usable Java VM + libbluray.jar was found */
97 
98  char bdj_org_id[9]; /* (BD-J) disc organization ID */
99  char bdj_disc_id[33]; /* (BD-J) disc ID */
100 
101  /* disc application info */
102  uint8_t video_format; /* bd_video_format_e */
103  uint8_t frame_rate; /* bd_frame_rate_e */
104  uint8_t content_exist_3D;
105  uint8_t initial_output_mode_preference; /* 0 - 2D, 1 - 3D */
106  uint8_t provider_data[32];
107 
108  /* AACS info (valid only if disc uses AACS) */
109  uint8_t aacs_detected; /* 1 if disc is using AACS encoding */
110  uint8_t libaacs_detected; /* 1 if usable AACS decoding library was found */
111  uint8_t aacs_handled; /* 1 if disc is using supported AACS encoding */
112 
113  int aacs_error_code; /* AACS error code (BD_AACS_*) */
114  int aacs_mkbv; /* AACS MKB version */
115 
116  /* BD+ info (valid only if disc uses BD+) */
117  uint8_t bdplus_detected; /* 1 if disc is using BD+ encoding */
118  uint8_t libbdplus_detected; /* 1 if usable BD+ decoding library was found */
119  uint8_t bdplus_handled; /* 1 if disc is using supporred BD+ encoding */
120 
121  uint8_t bdplus_gen; /* BD+ content code generation */
122  uint32_t bdplus_date; /* BD+ content code relese date ((year<<16)|(month<<8)|day) */
123 
125 
126 /*
127  * Playlist info
128  */
129 
130 typedef enum {
131  BLURAY_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
132  BLURAY_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
133  BLURAY_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
134  BLURAY_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
135  BLURAY_STREAM_TYPE_AUDIO_LPCM = 0x80,
136  BLURAY_STREAM_TYPE_AUDIO_AC3 = 0x81,
137  BLURAY_STREAM_TYPE_AUDIO_DTS = 0x82,
138  BLURAY_STREAM_TYPE_AUDIO_TRUHD = 0x83,
139  BLURAY_STREAM_TYPE_AUDIO_AC3PLUS = 0x84,
140  BLURAY_STREAM_TYPE_AUDIO_DTSHD = 0x85,
141  BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER = 0x86,
142  BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea,
143  BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b,
144  BLURAY_STREAM_TYPE_VIDEO_HEVC = 0x24,
145  BLURAY_STREAM_TYPE_SUB_PG = 0x90,
146  BLURAY_STREAM_TYPE_SUB_IG = 0x91,
147  BLURAY_STREAM_TYPE_SUB_TEXT = 0x92,
148  BLURAY_STREAM_TYPE_AUDIO_AC3PLUS_SECONDARY = 0xa1,
149  BLURAY_STREAM_TYPE_AUDIO_DTSHD_SECONDARY = 0xa2
150 } bd_stream_type_e;
151 
152 typedef enum {
153  BLURAY_VIDEO_FORMAT_480I = 1, // ITU-R BT.601-5
154  BLURAY_VIDEO_FORMAT_576I = 2, // ITU-R BT.601-4
155  BLURAY_VIDEO_FORMAT_480P = 3, // SMPTE 293M
156  BLURAY_VIDEO_FORMAT_1080I = 4, // SMPTE 274M
157  BLURAY_VIDEO_FORMAT_720P = 5, // SMPTE 296M
158  BLURAY_VIDEO_FORMAT_1080P = 6, // SMPTE 274M
159  BLURAY_VIDEO_FORMAT_576P = 7, // ITU-R BT.1358
160  BLURAY_VIDEO_FORMAT_2160P = 8, //
161 } bd_video_format_e;
162 
163 typedef enum {
164  BLURAY_VIDEO_RATE_24000_1001 = 1, // 23.976
165  BLURAY_VIDEO_RATE_24 = 2,
166  BLURAY_VIDEO_RATE_25 = 3,
167  BLURAY_VIDEO_RATE_30000_1001 = 4, // 29.97
168  BLURAY_VIDEO_RATE_50 = 6,
169  BLURAY_VIDEO_RATE_60000_1001 = 7 // 59.94
170 } bd_video_rate_e;
171 
172 typedef enum {
173  BLURAY_ASPECT_RATIO_4_3 = 2,
174  BLURAY_ASPECT_RATIO_16_9 = 3
175 } bd_video_aspect_e;
176 
177 typedef enum {
178  BLURAY_AUDIO_FORMAT_MONO = 1,
179  BLURAY_AUDIO_FORMAT_STEREO = 3,
180  BLURAY_AUDIO_FORMAT_MULTI_CHAN = 6,
181  BLURAY_AUDIO_FORMAT_COMBO = 12 // Stereo ac3/dts,
182 } bd_audio_format_e;
183  // multi mlp/dts-hd
184 
185 typedef enum {
186  BLURAY_AUDIO_RATE_48 = 1,
187  BLURAY_AUDIO_RATE_96 = 4,
188  BLURAY_AUDIO_RATE_192 = 5,
189  BLURAY_AUDIO_RATE_192_COMBO = 12, // 48 or 96 ac3/dts
190  // 192 mpl/dts-hd
191  BLURAY_AUDIO_RATE_96_COMBO = 14 // 48 ac3/dts
192  // 96 mpl/dts-hd
193 } bd_audio_rate_e;
194 
195 typedef enum {
196  BLURAY_TEXT_CHAR_CODE_UTF8 = 0x01,
197  BLURAY_TEXT_CHAR_CODE_UTF16BE = 0x02,
198  BLURAY_TEXT_CHAR_CODE_SHIFT_JIS = 0x03,
199  BLURAY_TEXT_CHAR_CODE_EUC_KR = 0x04,
200  BLURAY_TEXT_CHAR_CODE_GB18030_20001 = 0x05,
201  BLURAY_TEXT_CHAR_CODE_CN_GB = 0x06,
202  BLURAY_TEXT_CHAR_CODE_BIG5 = 0x07
203 } bd_char_code_e;
204 
205 typedef enum {
206  BLURAY_STILL_NONE = 0x00,
207  BLURAY_STILL_TIME = 0x01,
208  BLURAY_STILL_INFINITE = 0x02,
209 } bd_still_mode_e;
210 
211 typedef enum {
212  BLURAY_MARK_ENTRY = 0x01, /* entry mark for chapter search */
213  BLURAY_MARK_LINK = 0x02, /* link point */
214 } bd_mark_type_e;
215 
216 typedef struct bd_stream_info {
217  uint8_t coding_type;
218  uint8_t format;
219  uint8_t rate;
220  uint8_t char_code;
221  uint8_t lang[4];
222  uint16_t pid;
223  uint8_t aspect;
224  uint8_t subpath_id;
226 
227 typedef struct bd_clip {
228  uint32_t idx;
229  uint32_t pkt_count;
230  uint8_t still_mode;
231  uint16_t still_time; /* seconds */
232  uint8_t video_stream_count;
233  uint8_t audio_stream_count;
234  uint8_t pg_stream_count;
235  uint8_t ig_stream_count;
236  uint8_t sec_audio_stream_count;
237  uint8_t sec_video_stream_count;
238  BLURAY_STREAM_INFO *video_streams;
239  BLURAY_STREAM_INFO *audio_streams;
240  BLURAY_STREAM_INFO *pg_streams;
241  BLURAY_STREAM_INFO *ig_streams;
242  BLURAY_STREAM_INFO *sec_audio_streams;
243  BLURAY_STREAM_INFO *sec_video_streams;
244 
245  uint64_t start_time; /* start media time, 90kHz, ("playlist time") */
246  uint64_t in_time; /* start timestamp, 90kHz */
247  uint64_t out_time; /* end timestamp, 90kHz */
248  char clip_id[6];
250 
251 typedef struct bd_chapter {
252  uint32_t idx;
253  uint64_t start; /* start media time, 90kHz, ("playlist time") */
254  uint64_t duration; /* duration */
255  uint64_t offset; /* distance from title start, bytes */
256  unsigned clip_ref;
258 
259 typedef struct bd_mark {
260  uint32_t idx;
261  int type; /* bd_mark_type_e */
262  uint64_t start; /* mark media time, 90kHz, ("playlist time") */
263  uint64_t duration; /* time to next mark */
264  uint64_t offset; /* mark distance from title start, bytes */
265  unsigned clip_ref;
267 
268 typedef struct bd_title_info {
269  uint32_t idx; /* filled only with bd_get_title_info() */
270  uint32_t playlist;
271  uint64_t duration;
272  uint32_t clip_count;
273  uint8_t angle_count;
274  uint32_t chapter_count;
275  uint32_t mark_count;
276  BLURAY_CLIP_INFO *clips;
277  BLURAY_TITLE_CHAPTER *chapters;
278  BLURAY_TITLE_MARK *marks;
279 
280  uint8_t mvc_base_view_r_flag;
282 
283 /*
284  * Sound effect data
285  */
286 
287 typedef struct bd_sound_effect {
288  uint8_t num_channels; /* 1 - mono, 2 - stereo */
289  uint32_t num_frames;
290  const int16_t *samples; /* 48000 Hz, 16 bit LPCM. interleaved if stereo */
292 
293 
298 void bd_get_version(int *major, int *minor, int *micro);
299 
300 /*
301  * Disc functions
302  */
303 
313 BLURAY *bd_open(const char *device_path, const char *keyfile_path);
314 
322 BLURAY *bd_init(void);
323 
332 int bd_open_disc(BLURAY *bd, const char *device_path, const char *keyfile_path);
333 
342 int bd_open_stream(BLURAY *bd,
343  void *read_blocks_handle,
344  int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks));
345 
355 struct bd_dir_s;
356 struct bd_file_s;
357 int bd_open_files(BLURAY *bd,
358  void *handle,
359  struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path),
360  struct bd_file_s *(*open_file)(void *handle, const char *rel_path));
361 
367 void bd_close(BLURAY *bd);
368 
376 const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY *bd);
377 
391 struct meta_dl;
392 const struct meta_dl *bd_get_meta(BLURAY *bd);
393 
407 int bd_get_meta_file(BLURAY *bd, const char *file_name, void **data, int64_t *size);
408 
409 
410 /*
411  * Title selection without on-disc menus
412  */
413 
427 uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length);
428 
437 int bd_get_main_title(BLURAY *bd);
438 
448 BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle);
449 
456 void bd_free_title_info(BLURAY_TITLE_INFO *title_info);
457 
466 int bd_select_title(BLURAY *bd, uint32_t title);
467 
476 int bd_select_playlist(BLURAY *bd, uint32_t playlist);
477 
485 uint32_t bd_get_current_title(BLURAY *bd);
486 
495 int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick);
496 
506 int bd_read(BLURAY *bd, unsigned char *buf, int len);
507 
508 
509 /*
510  * Playback control functions
511  */
512 
520 int64_t bd_seek(BLURAY *bd, uint64_t pos);
521 
530 int64_t bd_seek_time(BLURAY *bd, uint64_t tick);
531 
540 int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter);
541 
550 int64_t bd_seek_mark(BLURAY *bd, unsigned mark);
551 
560 int64_t bd_seek_playitem(BLURAY *bd, unsigned clip_ref);
561 
570 int bd_select_angle(BLURAY *bd, unsigned angle);
571 
579 void bd_seamless_angle_change(BLURAY *bd, unsigned angle);
580 
603 #define BLURAY_AUDIO_STREAM 0
604 #define BLURAY_PG_TEXTST_STREAM 1
606 void bd_select_stream(BLURAY *bd, uint32_t stream_type, uint32_t stream_id, uint32_t enable_flag);
607 
608 
609 /*
610  * Playback status functions
611  */
612 
621 int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter);
622 
630 uint32_t bd_get_current_chapter(BLURAY *bd);
631 
641 uint64_t bd_get_title_size(BLURAY *bd);
642 
650 unsigned bd_get_current_angle(BLURAY *bd);
651 
659 uint64_t bd_tell(BLURAY *bd);
660 
668 uint64_t bd_tell_time(BLURAY *bd);
669 
670 
671 /*
672  * player settings
673  */
674 
675 typedef enum {
676  BLURAY_PLAYER_SETTING_AUDIO_LANG = 16, /* Initial audio language. String (ISO 639-2/T). */
677  BLURAY_PLAYER_SETTING_PG_LANG = 17, /* Initial PG/SPU language. String (ISO 639-2/T). */
678  BLURAY_PLAYER_SETTING_MENU_LANG = 18, /* Initial menu language. String (ISO 639-2/T). */
679  BLURAY_PLAYER_SETTING_COUNTRY_CODE = 19, /* Player country code. String (ISO 3166-1/alpha-2). */
680  BLURAY_PLAYER_SETTING_REGION_CODE = 20, /* Player region code. Integer. */
681  BLURAY_PLAYER_SETTING_OUTPUT_PREFER = 21, /* Output mode preference. Integer. */
682  BLURAY_PLAYER_SETTING_PARENTAL = 13, /* Age for parental control. Integer. */
683  BLURAY_PLAYER_SETTING_AUDIO_CAP = 15, /* Audio capability. Bit mask. */
684  BLURAY_PLAYER_SETTING_VIDEO_CAP = 29, /* Video capability. Bit mask. */
685  BLURAY_PLAYER_SETTING_DISPLAY_CAP = 23, /* Display capability. Bit mask. */
686  BLURAY_PLAYER_SETTING_3D_CAP = 24, /* 3D capability. Bit mask. */
687  BLURAY_PLAYER_SETTING_UHD_CAP = 25, /* UHD capability. */
688  BLURAY_PLAYER_SETTING_UHD_DISPLAY_CAP = 26, /* UHD display capability. */
689  BLURAY_PLAYER_SETTING_HDR_PREFERENCE = 27, /* HDR preference. */
690  BLURAY_PLAYER_SETTING_SDR_CONV_PREFER = 28, /* SDR conversion preference. */
691  BLURAY_PLAYER_SETTING_TEXT_CAP = 30, /* Text Subtitle capability. Bit mask. */
692  BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31, /* Player profile and version. */
693 
694  BLURAY_PLAYER_SETTING_DECODE_PG = 0x100, /* Enable/disable PG (subtitle) decoder. Integer. Default: disabled. */
695  BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE = 0x101, /* Enable/disable BD-J persistent storage. Integer. Default: enabled. */
696 
697  BLURAY_PLAYER_PERSISTENT_ROOT = 0x200, /* Root path to the BD_J persistent storage location. String. */
698  BLURAY_PLAYER_CACHE_ROOT = 0x201, /* Root path to the BD_J cache storage location. String. */
699 } bd_player_setting;
700 
713 int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value);
714 int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *value);
715 
716 
717 /*
718  * events
719  */
720 
721 typedef enum {
722 
723  BD_EVENT_NONE = 0, /* no pending events */
724 
725  /*
726  * errors
727  */
728 
729  BD_EVENT_ERROR = 1, /* Fatal error. Playback can't be continued. */
730  BD_EVENT_READ_ERROR = 2, /* Reading of .m2ts aligned unit failed. Next call to read will try next block. */
731  BD_EVENT_ENCRYPTED = 3, /* .m2ts file is encrypted and can't be played */
732 
733  /*
734  * current playback position
735  */
736 
737  BD_EVENT_ANGLE = 4, /* current angle, 1...N */
738  BD_EVENT_TITLE = 5, /* current title, 1...N (0 = top menu) */
739  BD_EVENT_PLAYLIST = 6, /* current playlist (xxxxx.mpls) */
740  BD_EVENT_PLAYITEM = 7, /* current play item, 0...N-1 */
741  BD_EVENT_CHAPTER = 8, /* current chapter, 1...N */
742  BD_EVENT_PLAYMARK = 9, /* playmark reached */
743  BD_EVENT_END_OF_TITLE = 10,
744 
745  /*
746  * stream selection
747  */
748 
749  BD_EVENT_AUDIO_STREAM = 11, /* 1..32, 0xff = none */
750  BD_EVENT_IG_STREAM = 12, /* 1..32 */
751  BD_EVENT_PG_TEXTST_STREAM = 13, /* 1..255, 0xfff = none */
752  BD_EVENT_PIP_PG_TEXTST_STREAM = 14, /* 1..255, 0xfff = none */
753  BD_EVENT_SECONDARY_AUDIO_STREAM = 15, /* 1..32, 0xff = none */
754  BD_EVENT_SECONDARY_VIDEO_STREAM = 16, /* 1..32, 0xff = none */
755 
756  BD_EVENT_PG_TEXTST = 17, /* 0 - disable, 1 - enable */
757  BD_EVENT_PIP_PG_TEXTST = 18, /* 0 - disable, 1 - enable */
758  BD_EVENT_SECONDARY_AUDIO = 19, /* 0 - disable, 1 - enable */
759  BD_EVENT_SECONDARY_VIDEO = 20, /* 0 - disable, 1 - enable */
760  BD_EVENT_SECONDARY_VIDEO_SIZE = 21, /* 0 - PIP, 0xf - fullscreen */
761 
762  /*
763  * playback control
764  */
765 
766  /* HDMV VM or JVM stopped playlist playback. Flush all buffers. */
767  BD_EVENT_PLAYLIST_STOP = 22,
768 
769  /* discontinuity in the stream (non-seamless connection). Reset demuxer PES buffers. */
770  BD_EVENT_DISCONTINUITY = 23, /* new timestamp (45 kHz) */
771 
772  /* HDMV VM or JVM seeked the stream. Next read() will return data from new position. Flush all buffers. */
773  BD_EVENT_SEEK = 24, /* new media time (45 kHz) */
774 
775  /* still playback (pause) */
776  BD_EVENT_STILL = 25, /* 0 - off, 1 - on */
777 
778  /* Still playback for n seconds (reached end of still mode play item).
779  * Playback continues by calling bd_read_skip_still(). */
780  BD_EVENT_STILL_TIME = 26, /* 0 = infinite ; 1...300 = seconds */
781 
782  /* Play sound effect */
783  BD_EVENT_SOUND_EFFECT = 27, /* effect ID */
784 
785  /*
786  * status
787  */
788 
789  /* Nothing to do. Playlist is not playing, but title applet is running.
790  * Application should not call bd_read*() immediately again to avoid busy loop. */
791  BD_EVENT_IDLE = 28,
792 
793  /* Pop-Up menu available */
794  BD_EVENT_POPUP = 29, /* 0 - no, 1 - yes */
795 
796  /* Interactive menu visible */
797  BD_EVENT_MENU = 30, /* 0 - no, 1 - yes */
798 
799  /* 3D */
800  BD_EVENT_STEREOSCOPIC_STATUS = 31, /* 0 - 2D, 1 - 3D */
801 
802  /* BD-J key interest table changed */
803  BD_EVENT_KEY_INTEREST_TABLE = 32, /* bitmask, BLURAY_KIT_* */
804 
805  /* UO mask changed */
806  BD_EVENT_UO_MASK_CHANGED = 33, /* bitmask, BLURAY_UO_* */
807 
808  /*BD_EVENT_LAST = 33, */
809 
810 } bd_event_e;
811 
812 typedef struct {
813  uint32_t event; /* bd_event_e */
814  uint32_t param;
815 } BD_EVENT;
816 
817 /* BD_EVENT_ERROR param values */
818 #define BD_ERROR_HDMV 1
819 #define BD_ERROR_BDJ 2
820 
821 /* BD_EVENT_ENCRYPTED param vlues */
822 #define BD_ERROR_AACS 3
823 #define BD_ERROR_BDPLUS 4
824 
825 /* BD_EVENT_TITLE special titles */
826 #define BLURAY_TITLE_FIRST_PLAY 0xffff
827 #define BLURAY_TITLE_TOP_MENU 0
828 
829 /* BD_EVENT_KEY_INTEREST flags */
830 #define BLURAY_KIT_PLAY 0x1
831 #define BLURAY_KIT_STOP 0x2
832 #define BLURAY_KIT_FFW 0x4
833 #define BLURAY_KIT_REW 0x8
834 #define BLURAY_KIT_TRACK_NEXT 0x10
835 #define BLURAY_KIT_TRACK_PREV 0x20
836 #define BLURAY_KIT_PAUSE 0x40
837 #define BLURAY_KIT_STILL_OFF 0x80
838 #define BLURAY_KIT_SEC_AUDIO 0x100
839 #define BLURAY_KIT_SEC_VIDEO 0x200
840 #define BLURAY_KIT_PG_TEXTST 0x400
841 
842 /* BD_EVENT_UO_MASK flags */
843 #define BLURAY_UO_MENU_CALL 0x1
844 #define BLURAY_UO_TITLE_SEARCH 0x2
845 
854 int bd_get_event(BLURAY *bd, BD_EVENT *event);
855 
856 
857 /*
858  * On-screen display
859  */
860 
861 struct bd_overlay_s; /* defined in overlay.h */
862 struct bd_argb_overlay_s; /* defined in overlay.h */
863 struct bd_argb_buffer_s; /* defined in overlay.h */
864 typedef void (*bd_overlay_proc_f)(void *, const struct bd_overlay_s * const);
865 typedef void (*bd_argb_overlay_proc_f)(void *, const struct bd_argb_overlay_s * const);
866 
886 void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func);
887 
903 void bd_register_argb_overlay_proc(BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, struct bd_argb_buffer_s *buf);
904 
905 
906 /*
907  * Playback with on-disc menus
908  */
909 
919 int bd_play(BLURAY *bd);
920 
933 int bd_play_title(BLURAY *bd, unsigned title);
934 
945 int bd_menu_call(BLURAY *bd, int64_t pts);
946 
959 int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event);
960 
968 int bd_read_skip_still(BLURAY *bd);
969 
979 BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle);
980 
990 int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect);
991 
992 
993 /*
994  * User interaction
995  */
996 
1004 void bd_set_scr(BLURAY *bd, int64_t pts);
1005 
1019 #define BLURAY_RATE_PAUSED 0
1020 #define BLURAY_RATE_NORMAL 90000
1021 int bd_set_rate(BLURAY *bd, uint32_t rate);
1022 
1033 int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key);
1034 
1047 int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y);
1048 
1049 
1050 /*
1051  * Testing and debugging
1052  */
1053 
1054 /* access to internal information */
1055 
1064 struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref);
1065 struct clpi_cl *bd_read_clpi(const char *clpi_file);
1066 
1073 void bd_free_clpi(struct clpi_cl *cl);
1074 
1075 
1076 struct mpls_pl;
1077 struct mpls_pl *bd_read_mpls(const char *mpls_file);
1078 void bd_free_mpls(struct mpls_pl *);
1079 
1080 struct mobj_objects;
1081 struct mobj_objects *bd_read_mobj(const char *mobj_file);
1082 void bd_free_mobj(struct mobj_objects *);
1083 
1084 struct bdjo_data;
1085 struct bdjo_data *bd_read_bdjo(const char *bdjo_file);
1086 void bd_free_bdjo(struct bdjo_data *);
1087 
1088 /* BD-J testing */
1089 
1090 int bd_start_bdj(BLURAY *bd, const char* start_object); // start BD-J from the specified BD-J object (should be a 5 character string)
1091 void bd_stop_bdj(BLURAY *bd); // shutdown BD-J and clean up resources
1092 
1106 int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size);
1107 
1119 int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration);
1120 
1129 struct mpls_pl* bd_get_title_mpls(BLURAY * bd);
1130 
1131 #ifdef __cplusplus
1132 }
1133 #endif
1134 
1135 #endif /* BLURAY_H_ */
uint32_t bd_get_current_chapter(BLURAY *bd)
void bd_set_scr(BLURAY *bd, int64_t pts)
void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func)
int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key)
int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter)
int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
Definition: bluray.h:270
BLURAY * bd_open(const char *device_path, const char *keyfile_path)
int bd_select_title(BLURAY *bd, uint32_t title)
int bd_get_main_title(BLURAY *bd)
int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
Definition: bluray.h:261
unsigned bd_get_current_angle(BLURAY *bd)
uint32_t bd_get_current_title(BLURAY *bd)
void bd_register_argb_overlay_proc(BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, struct bd_argb_buffer_s *buf)
int bd_play_title(BLURAY *bd, unsigned title)
int bd_open_disc(BLURAY *bd, const char *device_path, const char *keyfile_path)
int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration)
int bd_select_angle(BLURAY *bd, unsigned angle)
void bd_close(BLURAY *bd)
Definition: bluray.h:229
uint64_t bd_get_title_size(BLURAY *bd)
int bd_get_meta_file(BLURAY *bd, const char *file_name, void **data, int64_t *size)
struct clpi_cl * bd_get_clpi(BLURAY *bd, unsigned clip_ref)
Definition: bluray.h:289
Definition: bluray.h:72
int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value)
int bd_menu_call(BLURAY *bd, int64_t pts)
Definition: bluray.h:218
int bd_open_stream(BLURAY *bd, void *read_blocks_handle, int(*read_blocks)(void *handle, void *buf, int lba, int num_blocks))
const BLURAY_DISC_INFO * bd_get_disc_info(BLURAY *bd)
BLURAY_TITLE_INFO * bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle)
uint64_t bd_tell(BLURAY *bd)
int bd_read_skip_still(BLURAY *bd)
int bd_read(BLURAY *bd, unsigned char *buf, int len)
int64_t bd_seek_playitem(BLURAY *bd, unsigned clip_ref)
int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick)
uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length)
BLURAY_TITLE_INFO * bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle)
int bd_play(BLURAY *bd)
int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size)
Definition: bluray.h:253
uint64_t bd_tell_time(BLURAY *bd)
void bd_seamless_angle_change(BLURAY *bd, unsigned angle)
int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect)
int64_t bd_seek(BLURAY *bd, uint64_t pos)
Definition: bluray.h:62
struct mpls_pl * bd_get_title_mpls(BLURAY *bd)
void bd_get_version(int *major, int *minor, int *micro)
int bd_select_playlist(BLURAY *bd, uint32_t playlist)
int bd_get_event(BLURAY *bd, BD_EVENT *event)
void bd_free_title_info(BLURAY_TITLE_INFO *title_info)
void bd_free_clpi(struct clpi_cl *cl)
int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
Definition: bluray.h:814
int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter)
int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
BLURAY * bd_init(void)