libbluray
Data Structures | Macros | Typedefs | Enumerations | Functions
bluray.h File Reference

libbluray API More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  BLURAY_TITLE
 HDMV / BD-J title information. More...
 
struct  BLURAY_DISC_INFO
 BluRay disc information. More...
 
struct  BLURAY_STREAM_INFO
 Clip substream information. More...
 
struct  BLURAY_CLIP_INFO
 Clip information. More...
 
struct  BLURAY_TITLE_CHAPTER
 Chapter entry. More...
 
struct  BLURAY_TITLE_MARK
 Playmark information. More...
 
struct  BLURAY_TITLE_INFO
 Playlist information. More...
 
struct  BLURAY_SOUND_EFFECT
 Sound effect data. More...
 
struct  BD_EVENT
 Event. More...
 

Macros

#define TITLES_ALL   0
 all titles.
 
#define TITLES_FILTER_DUP_TITLE   0x01
 remove duplicate titles.
 
#define TITLES_FILTER_DUP_CLIP   0x02
 remove titles that have duplicate clips.
 
#define TITLES_RELEVANT    (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
 remove duplicate titles and clips
 
#define BD_AACS_CORRUPTED_DISC   -1
 Corrupt disc (missing/invalid files)
 
#define BD_AACS_NO_CONFIG   -2
 AACS configuration file missing

 
#define BD_AACS_NO_PK   -3
 No valid processing key found

 
#define BD_AACS_NO_CERT   -4
 No valid certificate found

 
#define BD_AACS_CERT_REVOKED   -5
 All certificates have been revoked

 
#define BD_AACS_MMC_FAILED   -6
 MMC (disc drive interaction) failed

 
#define BLURAY_AUDIO_STREAM   0
 Select audio stream

 
#define BLURAY_PG_TEXTST_STREAM   1
 Select subtitle stream

 
#define BD_ERROR_HDMV   1
 HDMV VM failed to play the title

 
#define BD_ERROR_BDJ   2
 BD-J failed to play the title

 
#define BD_ERROR_AACS   3
 AACS failed or not supported

 
#define BD_ERROR_BDPLUS   4
 BD+ failed or not supported

 
#define BLURAY_TITLE_FIRST_PLAY   0xffff
 "First Play" title started

 
#define BLURAY_TITLE_TOP_MENU   0
 "Top Menu" title started

 
#define BLURAY_KIT_PLAY   0x1
 BD-J requests to handle "Play" UO

 
#define BLURAY_KIT_STOP   0x2
 BD-J requests to handle "Stop" UO

 
#define BLURAY_KIT_FFW   0x4
 BD-J requests to handle "Fast Forward" UO

 
#define BLURAY_KIT_REW   0x8
 BD-J requests to handle "Reverse" UO

 
#define BLURAY_KIT_TRACK_NEXT   0x10
 BD-J requests to handle "Next Track" UO

 
#define BLURAY_KIT_TRACK_PREV   0x20
 BD-J requests to handle "Prev Track" UO

 
#define BLURAY_KIT_PAUSE   0x40
 BD-J requests to handle "Pause" UO

 
#define BLURAY_KIT_STILL_OFF   0x80
 BD-J requests to handle "Still Off" UO

 
#define BLURAY_KIT_SEC_AUDIO   0x100
 BD-J requests to handle "Sec. Audio" UO

 
#define BLURAY_KIT_SEC_VIDEO   0x200
 BD-J requests to handle "Sec. Video" UO

 
#define BLURAY_KIT_PG_TEXTST   0x400
 BD-J requests to handle "Subtitle" UO

 
#define BLURAY_UO_MENU_CALL   0x1
 "Menu Call" masked (not allowed)

 
#define BLURAY_UO_TITLE_SEARCH   0x2
 "Title Search" masked (not allowed)
 
#define BLURAY_RATE_PAUSED   0
 Set playback rate to PAUSED

 
#define BLURAY_RATE_NORMAL   90000
 Set playback rate to NORMAL

 

Typedefs

typedef struct bluray BLURAY
 This structure is opaque. More...
 
typedef void(* bd_overlay_proc_f) (void *handle, const struct bd_overlay_s *const event)
 YUV overlay handler function type. More...
 
typedef void(* bd_argb_overlay_proc_f) (void *handle, const struct bd_argb_overlay_s *const event)
 ARGB overlay handler function type. More...
 

Enumerations

enum  bd_stream_type_e {
  BLURAY_STREAM_TYPE_VIDEO_MPEG1 = 0x01 ,
  BLURAY_STREAM_TYPE_VIDEO_MPEG2 = 0x02 ,
  BLURAY_STREAM_TYPE_AUDIO_MPEG1 = 0x03 ,
  BLURAY_STREAM_TYPE_AUDIO_MPEG2 = 0x04 ,
  BLURAY_STREAM_TYPE_AUDIO_LPCM = 0x80 ,
  BLURAY_STREAM_TYPE_AUDIO_AC3 = 0x81 ,
  BLURAY_STREAM_TYPE_AUDIO_DTS = 0x82 ,
  BLURAY_STREAM_TYPE_AUDIO_TRUHD = 0x83 ,
  BLURAY_STREAM_TYPE_AUDIO_AC3PLUS = 0x84 ,
  BLURAY_STREAM_TYPE_AUDIO_DTSHD = 0x85 ,
  BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER = 0x86 ,
  BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea ,
  BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b ,
  BLURAY_STREAM_TYPE_VIDEO_HEVC = 0x24 ,
  BLURAY_STREAM_TYPE_SUB_PG = 0x90 ,
  BLURAY_STREAM_TYPE_SUB_IG = 0x91 ,
  BLURAY_STREAM_TYPE_SUB_TEXT = 0x92 ,
  BLURAY_STREAM_TYPE_AUDIO_AC3PLUS_SECONDARY = 0xa1 ,
  BLURAY_STREAM_TYPE_AUDIO_DTSHD_SECONDARY = 0xa2
}
 Stream video coding type.
 
enum  bd_video_format_e {
  BLURAY_VIDEO_FORMAT_480I = 1 ,
  BLURAY_VIDEO_FORMAT_576I = 2 ,
  BLURAY_VIDEO_FORMAT_480P = 3 ,
  BLURAY_VIDEO_FORMAT_1080I = 4 ,
  BLURAY_VIDEO_FORMAT_720P = 5 ,
  BLURAY_VIDEO_FORMAT_1080P = 6 ,
  BLURAY_VIDEO_FORMAT_576P = 7 ,
  BLURAY_VIDEO_FORMAT_2160P = 8
}
 Stream video format. More...
 
enum  bd_video_rate_e {
  BLURAY_VIDEO_RATE_24000_1001 = 1 ,
  BLURAY_VIDEO_RATE_24 = 2 ,
  BLURAY_VIDEO_RATE_25 = 3 ,
  BLURAY_VIDEO_RATE_30000_1001 = 4 ,
  BLURAY_VIDEO_RATE_50 = 6 ,
  BLURAY_VIDEO_RATE_60000_1001 = 7
}
 Stream video frame rate. More...
 
enum  bd_video_aspect_e {
  BLURAY_ASPECT_RATIO_4_3 = 2 ,
  BLURAY_ASPECT_RATIO_16_9 = 3
}
 Stream video aspect ratio.
 
enum  bd_audio_format_e {
  BLURAY_AUDIO_FORMAT_MONO = 1 ,
  BLURAY_AUDIO_FORMAT_STEREO = 3 ,
  BLURAY_AUDIO_FORMAT_MULTI_CHAN = 6 ,
  BLURAY_AUDIO_FORMAT_COMBO = 12
}
 Stream audio format.
 
enum  bd_audio_rate_e {
  BLURAY_AUDIO_RATE_48 = 1 ,
  BLURAY_AUDIO_RATE_96 = 4 ,
  BLURAY_AUDIO_RATE_192 = 5 ,
  BLURAY_AUDIO_RATE_192_COMBO = 12 ,
  BLURAY_AUDIO_RATE_96_COMBO = 14
}
 Stream audio rate.
 
enum  bd_char_code_e {
  BLURAY_TEXT_CHAR_CODE_UTF8 = 0x01 ,
  BLURAY_TEXT_CHAR_CODE_UTF16BE = 0x02 ,
  BLURAY_TEXT_CHAR_CODE_SHIFT_JIS = 0x03 ,
  BLURAY_TEXT_CHAR_CODE_EUC_KR = 0x04 ,
  BLURAY_TEXT_CHAR_CODE_GB18030_20001 = 0x05 ,
  BLURAY_TEXT_CHAR_CODE_CN_GB = 0x06 ,
  BLURAY_TEXT_CHAR_CODE_BIG5 = 0x07
}
 Text subtitle charset.
 
enum  bd_still_mode_e {
  BLURAY_STILL_NONE = 0x00 ,
  BLURAY_STILL_TIME = 0x01 ,
  BLURAY_STILL_INFINITE = 0x02
}
 Clip still mode type. More...
 
enum  bd_mark_type_e {
  BLURAY_MARK_ENTRY = 0x01 ,
  BLURAY_MARK_LINK = 0x02
}
 Mark type. More...
 
enum  bd_dynamic_range_type_e {
  BLURAY_DYNAMIC_RANGE_SDR = 0 ,
  BLURAY_DYNAMIC_RANGE_HDR10 = 1 ,
  BLURAY_DYNAMIC_RANGE_DOLBY_VISION = 2
}
 Clip dynamic range.
 
enum  bd_player_setting {
  BLURAY_PLAYER_SETTING_AUDIO_LANG = 16 ,
  BLURAY_PLAYER_SETTING_PG_LANG = 17 ,
  BLURAY_PLAYER_SETTING_MENU_LANG = 18 ,
  BLURAY_PLAYER_SETTING_COUNTRY_CODE = 19 ,
  BLURAY_PLAYER_SETTING_REGION_CODE = 20 ,
  BLURAY_PLAYER_SETTING_OUTPUT_PREFER = 21 ,
  BLURAY_PLAYER_SETTING_PARENTAL = 13 ,
  BLURAY_PLAYER_SETTING_AUDIO_CAP = 15 ,
  BLURAY_PLAYER_SETTING_VIDEO_CAP = 29 ,
  BLURAY_PLAYER_SETTING_DISPLAY_CAP = 23 ,
  BLURAY_PLAYER_SETTING_3D_CAP = 24 ,
  BLURAY_PLAYER_SETTING_UHD_CAP = 25 ,
  BLURAY_PLAYER_SETTING_UHD_DISPLAY_CAP = 26 ,
  BLURAY_PLAYER_SETTING_HDR_PREFERENCE = 27 ,
  BLURAY_PLAYER_SETTING_SDR_CONV_PREFER = 28 ,
  BLURAY_PLAYER_SETTING_TEXT_CAP = 30 ,
  BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31 ,
  BLURAY_PLAYER_SETTING_DECODE_PG = 0x100 ,
  BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE = 0x101 ,
  BLURAY_PLAYER_PERSISTENT_ROOT = 0x200 ,
  BLURAY_PLAYER_CACHE_ROOT = 0x201 ,
  BLURAY_PLAYER_JAVA_HOME = 0x202
}
 Player setting. More...
 
enum  bd_event_e {
  BD_EVENT_NONE = 0 ,
  BD_EVENT_ERROR = 1 ,
  BD_EVENT_READ_ERROR = 2 ,
  BD_EVENT_ENCRYPTED = 3 ,
  BD_EVENT_ANGLE = 4 ,
  BD_EVENT_TITLE = 5 ,
  BD_EVENT_PLAYLIST = 6 ,
  BD_EVENT_PLAYITEM = 7 ,
  BD_EVENT_CHAPTER = 8 ,
  BD_EVENT_PLAYMARK = 9 ,
  BD_EVENT_END_OF_TITLE = 10 ,
  BD_EVENT_AUDIO_STREAM = 11 ,
  BD_EVENT_IG_STREAM = 12 ,
  BD_EVENT_PG_TEXTST_STREAM = 13 ,
  BD_EVENT_PIP_PG_TEXTST_STREAM = 14 ,
  BD_EVENT_SECONDARY_AUDIO_STREAM = 15 ,
  BD_EVENT_SECONDARY_VIDEO_STREAM = 16 ,
  BD_EVENT_PG_TEXTST = 17 ,
  BD_EVENT_PIP_PG_TEXTST = 18 ,
  BD_EVENT_SECONDARY_AUDIO = 19 ,
  BD_EVENT_SECONDARY_VIDEO = 20 ,
  BD_EVENT_SECONDARY_VIDEO_SIZE = 21 ,
  BD_EVENT_PLAYLIST_STOP = 22 ,
  BD_EVENT_DISCONTINUITY = 23 ,
  BD_EVENT_SEEK = 24 ,
  BD_EVENT_STILL = 25 ,
  BD_EVENT_STILL_TIME = 26 ,
  BD_EVENT_SOUND_EFFECT = 27 ,
  BD_EVENT_IDLE = 28 ,
  BD_EVENT_POPUP = 29 ,
  BD_EVENT_MENU = 30 ,
  BD_EVENT_STEREOSCOPIC_STATUS = 31 ,
  BD_EVENT_KEY_INTEREST_TABLE = 32 ,
  BD_EVENT_UO_MASK_CHANGED = 33
}
 Event type. More...
 

Functions

void bd_get_version (int *major, int *minor, int *micro)
 Get libbluray version. More...
 
BLURAYbd_open (const char *device_path, const char *keyfile_path)
 Open BluRay disc. More...
 
BLURAYbd_init (void)
 Initialize BLURAY object. More...
 
int bd_open_disc (BLURAY *bd, const char *device_path, const char *keyfile_path)
 Open BluRay disc. More...
 
int bd_open_stream (BLURAY *bd, void *read_blocks_handle, int(*read_blocks)(void *handle, void *buf, int lba, int num_blocks))
 Open BluRay disc. More...
 
int bd_open_files (BLURAY *bd, void *handle, struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path), struct bd_file_s *(*open_file)(void *handle, const char *rel_path))
 Open BluRay disc. More...
 
void bd_close (BLURAY *bd)
 Close BluRay disc. More...
 
const BLURAY_DISC_INFObd_get_disc_info (BLURAY *bd)
 Get information about current BluRay disc. More...
 
const struct meta_dl * bd_get_meta (BLURAY *bd)
 Get meta information about current BluRay disc. More...
 
int bd_get_meta_file (BLURAY *bd, const char *file_name, void **data, int64_t *size)
 Read metadata file from BluRay disc. More...
 
uint32_t bd_get_titles (BLURAY *bd, uint8_t flags, uint32_t min_title_length)
 Get number of titles (playlists) More...
 
int bd_get_main_title (BLURAY *bd)
 Get main title Returned number is an index to the list created by bd_get_titles() More...
 
BLURAY_TITLE_INFObd_get_title_info (BLURAY *bd, uint32_t title_idx, unsigned angle)
 Get information about a title. More...
 
void bd_free_title_info (BLURAY_TITLE_INFO *title_info)
 Free BLURAY_TITLE_INFO object. More...
 
int bd_select_title (BLURAY *bd, uint32_t title)
 Select the title from the list created by bd_get_titles() More...
 
int bd_select_playlist (BLURAY *bd, uint32_t playlist)
 Select a playlist. More...
 
uint32_t bd_get_current_title (BLURAY *bd)
 Returns the current title index. More...
 
int bd_read (BLURAY *bd, unsigned char *buf, int len)
 Read from currently selected title file, decrypt if possible. More...
 
int64_t bd_seek (BLURAY *bd, uint64_t pos)
 Seek to pos in currently selected title. More...
 
int64_t bd_seek_time (BLURAY *bd, uint64_t tick)
 Seek to specific time in 90Khz ticks. More...
 
int64_t bd_seek_chapter (BLURAY *bd, unsigned chapter)
 Seek to a chapter. More...
 
int64_t bd_seek_mark (BLURAY *bd, unsigned mark)
 Seek to a playmark. More...
 
int64_t bd_seek_playitem (BLURAY *bd, unsigned clip_ref)
 Seek to a playitem. More...
 
int bd_select_angle (BLURAY *bd, unsigned angle)
 Set the angle to play. More...
 
void bd_seamless_angle_change (BLURAY *bd, unsigned angle)
 Initiate seamless angle change. More...
 
void bd_select_stream (BLURAY *bd, uint32_t stream_type, uint32_t stream_id, uint32_t enable_flag)
 Select stream (PG / TextST track) More...
 
int64_t bd_chapter_pos (BLURAY *bd, unsigned chapter)
 Find the byte position of a chapter. More...
 
uint32_t bd_get_current_chapter (BLURAY *bd)
 Get the current chapter. More...
 
uint64_t bd_get_title_size (BLURAY *bd)
 Returns file size in bytes of currently selected title, 0 in no title selected. More...
 
unsigned bd_get_current_angle (BLURAY *bd)
 Return the current angle. More...
 
uint64_t bd_tell (BLURAY *bd)
 Return current pos. More...
 
uint64_t bd_tell_time (BLURAY *bd)
 Return current time. More...
 
int bd_set_player_setting (BLURAY *bd, uint32_t idx, uint32_t value)
 Update player setting. More...
 
int bd_set_player_setting_str (BLURAY *bd, uint32_t idx, const char *value)
 Update player setting (string) More...
 
int bd_get_event (BLURAY *bd, BD_EVENT *event)
 Get event from libbluray event queue. More...
 
const char * bd_event_name (uint32_t event)
 Get name of event. More...
 
void bd_register_overlay_proc (BLURAY *bd, void *handle, bd_overlay_proc_f func)
 Register handler for compressed YUV overlays. More...
 
void bd_register_argb_overlay_proc (BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, struct bd_argb_buffer_s *buf)
 Register handler for ARGB overlays. More...
 
int bd_play (BLURAY *bd)
 Start playing disc with on-disc menus. More...
 
int bd_play_title (BLURAY *bd, unsigned title)
 Play a title (from disc index). More...
 
int bd_menu_call (BLURAY *bd, int64_t pts)
 Open BluRay disc Top Menu. More...
 
int bd_read_ext (BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
 Read from currently playing title. More...
 
int bd_read_skip_still (BLURAY *bd)
 Continue reading after still mode clip. More...
 
BLURAY_TITLE_INFObd_get_playlist_info (BLURAY *bd, uint32_t playlist, unsigned angle)
 Get information about a playlist. More...
 
int bd_get_sound_effect (BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect)
 Get sound effect. More...
 
void bd_set_scr (BLURAY *bd, int64_t pts)
 Update current pts. More...
 
int bd_set_rate (BLURAY *bd, uint32_t rate)
 Set current playback rate. More...
 
int bd_user_input (BLURAY *bd, int64_t pts, uint32_t key)
 Pass user input to graphics controller or BD-J. More...
 
int bd_mouse_select (BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
 Select menu button at location (x,y). More...
 
struct clpi_cl * bd_get_clpi (BLURAY *bd, unsigned clip_ref)
 Get copy of clip information for requested playitem. More...
 
struct clpi_cl * bd_read_clpi (const char *clpi_file)
 Testing/debugging: Parse clip information (CLPI) file.
 
void bd_free_clpi (struct clpi_cl *cl)
 Free CLPI_CL object. More...
 
struct mpls_pl * bd_read_mpls (const char *mpls_file)
 Testing/debugging: Parse playlist (MPLS) file.
 
void bd_free_mpls (struct mpls_pl *)
 Testing/debugging: Free parsed playlist.
 
struct mobj_objects * bd_read_mobj (const char *mobj_file)
 Testing/debugging: Parse movie objects (MOBJ) file.
 
void bd_free_mobj (struct mobj_objects *)
 Testing/debugging: Free parsed movie objects.
 
struct bdjo_data * bd_read_bdjo (const char *bdjo_file)
 Testing/debugging: Parse BD-J object file (BDJO)
 
void bd_free_bdjo (struct bdjo_data *)
 Testing/debugging: Free parsed BDJO object.
 
int bd_start_bdj (BLURAY *bd, const char *start_object)
 Testing/debugging: start BD-J from the specified BD-J object (should be a 5 character string)
 
void bd_stop_bdj (BLURAY *bd)
 Testing/debugging: shutdown BD-J and clean up resources.
 
int bd_read_file (BLURAY *bd, const char *path, void **data, int64_t *size)
 Read a file from BluRay Virtual File System. More...
 
struct bd_dir_sbd_open_dir (BLURAY *bd, const char *dir)
 Open a directory from BluRay Virtual File System. More...
 
struct bd_file_sbd_open_file_dec (BLURAY *bd, const char *path)
 Open a file from BluRay Virtual File System. More...
 

Detailed Description

libbluray API

Typedef Documentation

◆ bd_argb_overlay_proc_f

typedef void(* bd_argb_overlay_proc_f) (void *handle, const struct bd_argb_overlay_s *const event)

ARGB overlay handler function type.

Parameters
handleopaque handle that was given to bd_register_argb_overlay_proc()
eventBD_ARGB_OVERLAY event

◆ bd_overlay_proc_f

typedef void(* bd_overlay_proc_f) (void *handle, const struct bd_overlay_s *const event)

YUV overlay handler function type.

Parameters
handleopaque handle that was given to bd_register_overlay_proc()
eventBD_OVERLAY event

◆ BLURAY

typedef struct bluray BLURAY

This structure is opaque.

It represents a libbluray instance.

Enumeration Type Documentation

◆ bd_event_e

enum bd_event_e

Event type.

Enumerator
BD_EVENT_NONE 

no pending events

BD_EVENT_ERROR 

Fatal error.

Playback can't be continued.

BD_EVENT_READ_ERROR 

Reading of .m2ts aligned unit failed.

Next call to read will try next block.

BD_EVENT_ENCRYPTED 

.m2ts file is encrypted and can't be played

BD_EVENT_ANGLE 

current angle, 1...N

BD_EVENT_TITLE 

current title, 1...N (0 = top menu)

BD_EVENT_PLAYLIST 

current playlist (xxxxx.mpls)

BD_EVENT_PLAYITEM 

current play item, 0...N-1

BD_EVENT_CHAPTER 

current chapter, 1...N

BD_EVENT_PLAYMARK 

playmark reached

BD_EVENT_END_OF_TITLE 

end of title reached

BD_EVENT_AUDIO_STREAM 

1..32, 0xff = none

BD_EVENT_IG_STREAM 

1..32

BD_EVENT_PG_TEXTST_STREAM 

1..255, 0xfff = none

BD_EVENT_PIP_PG_TEXTST_STREAM 

1..255, 0xfff = none

BD_EVENT_SECONDARY_AUDIO_STREAM 

1..32, 0xff = none

BD_EVENT_SECONDARY_VIDEO_STREAM 

1..32, 0xff = none

BD_EVENT_PG_TEXTST 

0 - disable, 1 - enable

BD_EVENT_PIP_PG_TEXTST 

0 - disable, 1 - enable

BD_EVENT_SECONDARY_AUDIO 

0 - disable, 1 - enable

BD_EVENT_SECONDARY_VIDEO 

0 - disable, 1 - enable

BD_EVENT_SECONDARY_VIDEO_SIZE 

0 - PIP, 0xf - fullscreen

BD_EVENT_PLAYLIST_STOP 

HDMV VM or JVM stopped playlist playback.

Flush all buffers.

BD_EVENT_DISCONTINUITY 

discontinuity in the stream (non-seamless connection).

Reset demuxer PES buffers. new timestamp (45 kHz)

BD_EVENT_SEEK 

HDMV VM or JVM seeked the stream.

Next read() will return data from new position. Flush all buffers. new media time (45 kHz)

BD_EVENT_STILL 

still playback (pause)

0 - off, 1 - on

BD_EVENT_STILL_TIME 

Still playback for n seconds (reached end of still mode play item).

Playback continues by calling bd_read_skip_still(). 0 = infinite ; 1...300 = seconds

BD_EVENT_SOUND_EFFECT 

Play sound effect.

effect ID

BD_EVENT_IDLE 

Nothing to do.

Playlist is not playing, but title applet is running. Application should not call bd_read*() immediately again to avoid busy loop.

BD_EVENT_POPUP 

Pop-Up menu available.

0 - no, 1 - yes

BD_EVENT_MENU 

Interactive menu visible.

0 - no, 1 - yes

BD_EVENT_STEREOSCOPIC_STATUS 

3D

0 - 2D, 1 - 3D

BD_EVENT_KEY_INTEREST_TABLE 

BD-J key interest table changed.

bitmask, BLURAY_KIT_*

BD_EVENT_UO_MASK_CHANGED 

UO mask changed.

bitmask, BLURAY_UO_*

◆ bd_mark_type_e

Mark type.

Enumerator
BLURAY_MARK_ENTRY 

entry mark for chapter search

BLURAY_MARK_LINK 

link point

◆ bd_player_setting

Player setting.

Enumerator
BLURAY_PLAYER_SETTING_AUDIO_LANG 

Initial audio language.

String (ISO 639-2/T).

BLURAY_PLAYER_SETTING_PG_LANG 

Initial PG/SPU language.

String (ISO 639-2/T).

BLURAY_PLAYER_SETTING_MENU_LANG 

Initial menu language.

String (ISO 639-2/T).

BLURAY_PLAYER_SETTING_COUNTRY_CODE 

Player country code.

String (ISO 3166-1/alpha-2).

BLURAY_PLAYER_SETTING_REGION_CODE 

Player region code.

Integer.

BLURAY_PLAYER_SETTING_OUTPUT_PREFER 

Output mode preference.

Integer.

BLURAY_PLAYER_SETTING_PARENTAL 

Age for parental control.

Integer.

BLURAY_PLAYER_SETTING_AUDIO_CAP 

Audio capability.

Bit mask.

BLURAY_PLAYER_SETTING_VIDEO_CAP 

Video capability.

Bit mask.

BLURAY_PLAYER_SETTING_DISPLAY_CAP 

Display capability.

Bit mask.

BLURAY_PLAYER_SETTING_3D_CAP 

3D capability.

Bit mask.

BLURAY_PLAYER_SETTING_UHD_CAP 

UHD capability.


BLURAY_PLAYER_SETTING_UHD_DISPLAY_CAP 

UHD display capability.


BLURAY_PLAYER_SETTING_HDR_PREFERENCE 

HDR preference.


BLURAY_PLAYER_SETTING_SDR_CONV_PREFER 

SDR conversion preference.


BLURAY_PLAYER_SETTING_TEXT_CAP 

Text Subtitle capability.

Bit mask.

BLURAY_PLAYER_SETTING_PLAYER_PROFILE 

Player profile and version.

BLURAY_PLAYER_SETTING_DECODE_PG 

Enable/disable PG (subtitle) decoder.

Integer. Default: disabled.

BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE 

Enable/disable BD-J persistent storage.

Integer. Default: enabled.

BLURAY_PLAYER_PERSISTENT_ROOT 

Root path to the BD_J persistent storage location.

String.

BLURAY_PLAYER_CACHE_ROOT 

Root path to the BD_J cache storage location.

String.

BLURAY_PLAYER_JAVA_HOME 

Location of JRE.

String. Default: NULL (autodetect).

◆ bd_still_mode_e

Clip still mode type.

Enumerator
BLURAY_STILL_NONE 

No still (normal playback)

BLURAY_STILL_TIME 

Still playback for fixed time.

BLURAY_STILL_INFINITE 

Infinite still.

◆ bd_video_format_e

Stream video format.

Enumerator
BLURAY_VIDEO_FORMAT_480I 

ITU-R BT.601-5.

BLURAY_VIDEO_FORMAT_576I 

ITU-R BT.601-4.

BLURAY_VIDEO_FORMAT_480P 

SMPTE 293M.

BLURAY_VIDEO_FORMAT_1080I 

SMPTE 274M.

BLURAY_VIDEO_FORMAT_720P 

SMPTE 296M.

BLURAY_VIDEO_FORMAT_1080P 

SMPTE 274M.

BLURAY_VIDEO_FORMAT_576P 

ITU-R BT.1358.

BLURAY_VIDEO_FORMAT_2160P 

BT.2020.

◆ bd_video_rate_e

Stream video frame rate.

Enumerator
BLURAY_VIDEO_RATE_24000_1001 

23.976 Hz

BLURAY_VIDEO_RATE_24 

24 Hz

BLURAY_VIDEO_RATE_25 

25 Hz

BLURAY_VIDEO_RATE_30000_1001 

29.97 Hz

BLURAY_VIDEO_RATE_50 

50 Hz

BLURAY_VIDEO_RATE_60000_1001 

59.94 Hz

Function Documentation

◆ bd_chapter_pos()

int64_t bd_chapter_pos ( BLURAY bd,
unsigned  chapter 
)

Find the byte position of a chapter.

Parameters
bdBLURAY object
chapterchapter to find position of
Returns
seek position of chapter start

◆ bd_close()

void bd_close ( BLURAY bd)

Close BluRay disc.

Parameters
bdBLURAY object

◆ bd_event_name()

const char* bd_event_name ( uint32_t  event)

Get name of event.

Parameters
eventevent type (bd_event_e)
Returns
1 on success, 0 if no events

◆ bd_free_clpi()

void bd_free_clpi ( struct clpi_cl *  cl)

Free CLPI_CL object.

Parameters
clCLPI_CL objects

◆ bd_free_title_info()

void bd_free_title_info ( BLURAY_TITLE_INFO title_info)

Free BLURAY_TITLE_INFO object.

Parameters
title_infoBLURAY_TITLE_INFO object

◆ bd_get_clpi()

struct clpi_cl* bd_get_clpi ( BLURAY bd,
unsigned  clip_ref 
)

Get copy of clip information for requested playitem.

Parameters
bdBLURAY objects
clip_refrequested playitem number
Returns
pointer to allocated CLPI_CL object on success, NULL on error

◆ bd_get_current_angle()

unsigned bd_get_current_angle ( BLURAY bd)

Return the current angle.

Parameters
bdBLURAY object
Returns
current angle

◆ bd_get_current_chapter()

uint32_t bd_get_current_chapter ( BLURAY bd)

Get the current chapter.

Parameters
bdBLURAY object
Returns
current chapter

◆ bd_get_current_title()

uint32_t bd_get_current_title ( BLURAY bd)

Returns the current title index.

Parameters
bdBLURAY object
Returns
current title index

◆ bd_get_disc_info()

const BLURAY_DISC_INFO* bd_get_disc_info ( BLURAY bd)

Get information about current BluRay disc.

Parameters
bdBLURAY object
Returns
pointer to BLURAY_DISC_INFO object, NULL on error

◆ bd_get_event()

int bd_get_event ( BLURAY bd,
BD_EVENT event 
)

Get event from libbluray event queue.

Parameters
bdBLURAY object
eventnext BD_EVENT from event queue, NULL to initialize event queue
Returns
1 on success, 0 if no events

◆ bd_get_main_title()

int bd_get_main_title ( BLURAY bd)

Get main title Returned number is an index to the list created by bd_get_titles()

Parameters
bdBLURAY object
Returns
title index of main title, -1 on error

◆ bd_get_meta()

const struct meta_dl* bd_get_meta ( BLURAY bd)

Get meta information about current BluRay disc.

Meta information is optional in BluRay discs. If information is provided in multiple languages, currently selected language (BLURAY_PLAYER_SETTING_MENU_LANG) is used.

Referenced thumbnail images should be read with bd_get_meta_file().

Parameters
bdBLURAY object
Returns
META_DL (disclib) object, NULL on error

◆ bd_get_meta_file()

int bd_get_meta_file ( BLURAY bd,
const char *  file_name,
void **  data,
int64_t *  size 
)

Read metadata file from BluRay disc.

Allocate large enough memory block and read file contents. Caller must free the memory block with free().

Parameters
bdBLURAY object
file_namename of metadata file
datawhere to store pointer to file data
sizewhere to store file size
Returns
1 on success, 0 on error

◆ bd_get_playlist_info()

BLURAY_TITLE_INFO* bd_get_playlist_info ( BLURAY bd,
uint32_t  playlist,
unsigned  angle 
)

Get information about a playlist.

Parameters
bdBLURAY object
playlistplaylist number
angleangle number (chapter offsets and clip size depend on selected angle)
Returns
allocated BLURAY_TITLE_INFO object, NULL on error

◆ bd_get_sound_effect()

int bd_get_sound_effect ( BLURAY bd,
unsigned  sound_id,
struct bd_sound_effect *  effect 
)

Get sound effect.

Parameters
bdBLURAY object
sound_idsound effect id (0...N)
effectsound effect data
Returns
<0 when no effects, 0 when id out of range, 1 on success

◆ bd_get_title_info()

BLURAY_TITLE_INFO* bd_get_title_info ( BLURAY bd,
uint32_t  title_idx,
unsigned  angle 
)

Get information about a title.

Parameters
bdBLURAY object
title_idxtitle index number
angleangle number (chapter offsets and clip size depend on selected angle)
Returns
allocated BLURAY_TITLE_INFO object, NULL on error

◆ bd_get_title_size()

uint64_t bd_get_title_size ( BLURAY bd)

Returns file size in bytes of currently selected title, 0 in no title selected.

Parameters
bdBLURAY object
Returns
file size in bytes of currently selected title, 0 if no title selected

◆ bd_get_titles()

uint32_t bd_get_titles ( BLURAY bd,
uint8_t  flags,
uint32_t  min_title_length 
)

Get number of titles (playlists)

This must be called after bd_open() and before bd_select_title(). Populates the title list in BLURAY. Filtering of the returned list is controled through title flags

Parameters
bdBLURAY object
flagstitle flags
min_title_lengthfilter out titles shorter than min_title_length seconds
Returns
number of titles found

◆ bd_get_version()

void bd_get_version ( int *  major,
int *  minor,
int *  micro 
)

Get libbluray version.

Get the version of libbluray (runtime)

See also bluray-version.h

Parameters
majorwhere to store major version
minorwhere to store minor version
microwhere to store micro version

◆ bd_init()

BLURAY* bd_init ( void  )

Initialize BLURAY object.

Resulting object can be passed to following bd_open_??? functions.

Returns
allocated BLURAY object, NULL if error

◆ bd_menu_call()

int bd_menu_call ( BLURAY bd,
int64_t  pts 
)

Open BluRay disc Top Menu.

Current pts is needed for resuming playback when menu is closed.

Parameters
bdBLURAY object
ptscurrent playback position (1/90000s) or -1
Returns
1 on success, 0 if error

◆ bd_mouse_select()

int bd_mouse_select ( BLURAY bd,
int64_t  pts,
uint16_t  x,
uint16_t  y 
)

Select menu button at location (x,y).

This function has no effect with BD-J menus.

Parameters
bdBLURAY object
ptscurrent playback position (1/90000s) or -1
xmouse pointer x-position
ymouse pointer y-position
Returns
<0 on error, 0 when mouse is outside of buttons, 1 when mouse is inside button

◆ bd_open()

BLURAY* bd_open ( const char *  device_path,
const char *  keyfile_path 
)

Open BluRay disc.

Shortcut for bd_open_disc(bd_init(), device_path, keyfile_path)

Parameters
device_pathpath to mounted Blu-ray disc, device or image file
keyfile_pathpath to KEYDB.cfg (may be NULL)
Returns
allocated BLURAY object, NULL if error

◆ bd_open_dir()

struct bd_dir_s* bd_open_dir ( BLURAY bd,
const char *  dir 
)

Open a directory from BluRay Virtual File System.

Caller must close with dir->close().

Parameters
bdBLURAY object
dirtarget directory (relative to disc root)
Returns
BD_DIR_H *, NULL if failed

◆ bd_open_disc()

int bd_open_disc ( BLURAY bd,
const char *  device_path,
const char *  keyfile_path 
)

Open BluRay disc.

Parameters
bdBLURAY object
device_pathpath to mounted Blu-ray disc, device or image file
keyfile_pathpath to KEYDB.cfg (may be NULL)
Returns
1 on success, 0 if error

◆ bd_open_file_dec()

struct bd_file_s* bd_open_file_dec ( BLURAY bd,
const char *  path 
)

Open a file from BluRay Virtual File System.

encrypted streams are decrypted, and because of how decryption works, it can only seek to (N*6144) bytes, and read 6144 bytes at a time. DO NOT mix any play functionalities with these functions. It might cause broken stream. In general, accessing mutiple file on disk at the same time is a bad idea.

Caller must close with file->close().

Parameters
bdBLURAY object
pathpath to the file (relative to disc root)
Returns
BD_FILE_H *, NULL if failed

◆ bd_open_files()

int bd_open_files ( BLURAY bd,
void *  handle,
struct bd_dir_s *(*)(void *handle, const char *rel_path)  open_dir,
struct bd_file_s *(*)(void *handle, const char *rel_path)  open_file 
)

Open BluRay disc.

Parameters
bdBLURAY object
handleopaque handle for open_dir and open_file
open_dirfunction used to open a directory
open_filefunction used to open a file
Returns
1 on success, 0 if error

◆ bd_open_stream()

int bd_open_stream ( BLURAY bd,
void *  read_blocks_handle,
int(*)(void *handle, void *buf, int lba, int num_blocks)  read_blocks 
)

Open BluRay disc.

Parameters
bdBLURAY object
read_blocks_handleopaque handle for read_blocks
read_blocksfunction used to read disc blocks
Returns
1 on success, 0 if error

◆ bd_play()

int bd_play ( BLURAY bd)

Start playing disc with on-disc menus.

Playback is started from "First Play" title.

Parameters
bdBLURAY object
Returns
1 on success, 0 if error

◆ bd_play_title()

int bd_play_title ( BLURAY bd,
unsigned  title 
)

Play a title (from disc index).

Title 0 = Top Menu Title 0xffff = First Play title Number of titles can be found from BLURAY_DISC_INFO.

Parameters
bdBLURAY object
titletitle number from disc index
Returns
1 on success, 0 if error

◆ bd_read()

int bd_read ( BLURAY bd,
unsigned char *  buf,
int  len 
)

Read from currently selected title file, decrypt if possible.

Parameters
bdBLURAY object
bufbuffer to read data into
lensize of data to be read
Returns
size of data read, -1 if error, 0 if EOF

◆ bd_read_ext()

int bd_read_ext ( BLURAY bd,
unsigned char *  buf,
int  len,
BD_EVENT event 
)

Read from currently playing title.

When playing disc in navigation mode this function must be used instead of bd_read().

Parameters
bdBLURAY object
bufbuffer to read data into
lensize of data to be read
eventnext BD_EVENT from event queue (BD_EVENT_NONE if no events)
Returns
size of data read, -1 if error, 0 if event needs to be handled first, 0 if end of title was reached

◆ bd_read_file()

int bd_read_file ( BLURAY bd,
const char *  path,
void **  data,
int64_t *  size 
)

Read a file from BluRay Virtual File System.

Allocate large enough memory block and read file contents. Caller must free the memory block with free().

Parameters
bdBLURAY object
pathpath to the file (relative to disc root)
datawhere to store pointer to allocated data
sizewhere to store file size
Returns
1 on success, 0 on error

◆ bd_read_skip_still()

int bd_read_skip_still ( BLURAY bd)

Continue reading after still mode clip.

Parameters
bdBLURAY object
Returns
0 on error

◆ bd_register_argb_overlay_proc()

void bd_register_argb_overlay_proc ( BLURAY bd,
void *  handle,
bd_argb_overlay_proc_f  func,
struct bd_argb_buffer_s *  buf 
)

Register handler for ARGB overlays.

ARGB overlays are used with BD-J (Java) menus.

Callback function can be called at any time by a thread created by Java VM. No more than single call for each overlay plane are executed in paraller.

Parameters
bdBLURAY object
handleapplication-specific handle that will be passed to handler function
funchandler function pointer
bufoptional application-allocated frame buffer
Returns
1 on success, 0 if error

◆ bd_register_overlay_proc()

void bd_register_overlay_proc ( BLURAY bd,
void *  handle,
bd_overlay_proc_f  func 
)

Register handler for compressed YUV overlays.

Compressed YUV overlays are used with presentation graphics (subtitles) and HDMV mode menus. This function can be used when player does not support full-screen ARGB overlays or player can optimize drawing of compressed overlays, color space conversion etc.

Callback function is called from application thread context while bd_*() functions are called.

Note that BD-J mode outputs only ARGB graphics.

Parameters
bdBLURAY object
handleapplication-specific handle that will be passed to handler function
funchandler function pointer
Returns
1 on success, 0 if error

◆ bd_seamless_angle_change()

void bd_seamless_angle_change ( BLURAY bd,
unsigned  angle 
)

Initiate seamless angle change.

Parameters
bdBLURAY object
angleangle to change to

◆ bd_seek()

int64_t bd_seek ( BLURAY bd,
uint64_t  pos 
)

Seek to pos in currently selected title.

Parameters
bdBLURAY object
posposition to seek to
Returns
current seek position

◆ bd_seek_chapter()

int64_t bd_seek_chapter ( BLURAY bd,
unsigned  chapter 
)

Seek to a chapter.

First chapter is 0

Parameters
bdBLURAY object
chapterchapter to seek to
Returns
current seek position

◆ bd_seek_mark()

int64_t bd_seek_mark ( BLURAY bd,
unsigned  mark 
)

Seek to a playmark.

First mark is 0

Parameters
bdBLURAY object
markplaymark to seek to
Returns
current seek position

◆ bd_seek_playitem()

int64_t bd_seek_playitem ( BLURAY bd,
unsigned  clip_ref 
)

Seek to a playitem.

Parameters
bdBLURAY object
clip_refplayitem to seek to
Returns
current seek position

◆ bd_seek_time()

int64_t bd_seek_time ( BLURAY bd,
uint64_t  tick 
)

Seek to specific time in 90Khz ticks.

Parameters
bdBLURAY ojbect
ticktick count
Returns
current seek position

◆ bd_select_angle()

int bd_select_angle ( BLURAY bd,
unsigned  angle 
)

Set the angle to play.

Parameters
bdBLURAY object
angleangle to play
Returns
1 on success, 0 if error

◆ bd_select_playlist()

int bd_select_playlist ( BLURAY bd,
uint32_t  playlist 
)

Select a playlist.

Parameters
bdBLURAY object
playlistplaylist to select
Returns
1 on success, 0 if error

◆ bd_select_stream()

void bd_select_stream ( BLURAY bd,
uint32_t  stream_type,
uint32_t  stream_id,
uint32_t  enable_flag 
)

Select stream (PG / TextST track)

When playing with on-disc menus:

Stream selection is controlled by on-disc menus. If user can change stream selection also in player GUI, this function should be used to keep on-disc menus in sync with player GUI.

When playing the disc without on-disc menus:

Initial stream selection is done using preferred language settings. This function can be used to override automatic stream selection. Without on-disc menus selecting the stream is useful only when using libbluray internal decoders or the stream is stored in a sub-path.

Parameters
bdBLURAY object
stream_typeBLURAY_AUDIO_STREAM or BLURAY_PG_TEXTST_STREAM
stream_idstream number (1..N)
enable_flagset to 0 to disable streams of this type

◆ bd_select_title()

int bd_select_title ( BLURAY bd,
uint32_t  title 
)

Select the title from the list created by bd_get_titles()

Parameters
bdBLURAY object
titletitle to select
Returns
1 on success, 0 if error

◆ bd_set_player_setting()

int bd_set_player_setting ( BLURAY bd,
uint32_t  idx,
uint32_t  value 
)

Update player setting.

Bit masks and enumeration values are defined in player_settings.h.

Parameters
bdBLURAY object
idxPlayer setting to update
valueNew value for player setting
Returns
1 on success, 0 on error (invalid setting)

◆ bd_set_player_setting_str()

int bd_set_player_setting_str ( BLURAY bd,
uint32_t  idx,
const char *  value 
)

Update player setting (string)

Parameters
bdBLURAY object
idxPlayer setting to update
valueNew value for player setting
Returns
1 on success, 0 on error (invalid setting)

◆ bd_set_rate()

int bd_set_rate ( BLURAY bd,
uint32_t  rate 
)

Set current playback rate.

Notify BD-J media player when user changes playback rate (ex. pauses playback). Changing rate may fail if corresponding UO is masked or playlist is not playing.

Parameters
bdBLURAY object
ratecurrent playback rate * 90000 (0 = paused, 90000 = normal)
Returns
<0 on error, 0 on success

◆ bd_set_scr()

void bd_set_scr ( BLURAY bd,
int64_t  pts 
)

Update current pts.

Parameters
bdBLURAY object
ptscurrent playback position (1/90000s) or -1

◆ bd_tell()

uint64_t bd_tell ( BLURAY bd)

Return current pos.

Parameters
bdBLURAY object
Returns
current seek position

◆ bd_tell_time()

uint64_t bd_tell_time ( BLURAY bd)

Return current time.

Parameters
bdBLURAY object
Returns
current time

◆ bd_user_input()

int bd_user_input ( BLURAY bd,
int64_t  pts,
uint32_t  key 
)

Pass user input to graphics controller or BD-J.

Keys are defined in libbluray/keys.h.

Two user input models are supported:

  • Single event when a key is typed once.
  • Separate events when key is pressed and released. VD_VK_KEY_PRESSED, BD_VK_TYPED and BD_VK_KEY_RELEASED are or'd with the key.
Parameters
bdBLURAY object
ptscurrent playback position (1/90000s) or -1
keyinput key (
See also
keys.h)
Returns
<0 on error, 0 on success, >0 if selection/activation changed