Classes | Defines | Typedefs | Enumerations | Functions

src/libbluray/bluray.h File Reference

#include <stdint.h>

Go to the source code of this file.

Classes

struct  bd_stream_info
struct  bd_clip
struct  bd_chapter
struct  bd_mark
struct  bd_title_info
struct  bd_sound_effect
struct  BLURAY_DISC_INFO
struct  BD_EVENT

Defines

#define TITLES_ALL   0
#define TITLES_FILTER_DUP_TITLE   0x01
#define TITLES_FILTER_DUP_CLIP   0x02
#define TITLES_RELEVANT   (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
#define BD_AACS_CORRUPTED_DISC   -1
#define BD_AACS_NO_CONFIG   -2
#define BD_AACS_NO_PK   -3
#define BD_AACS_NO_CERT   -4
#define BD_AACS_CERT_REVOKED   -5
#define BD_AACS_MMC_FAILED   -6
#define BLURAY_TITLE_FIRST_PLAY   0xffff
#define BLURAY_TITLE_TOP_MENU   0

Typedefs

typedef struct bluray BLURAY
typedef struct bd_stream_info BLURAY_STREAM_INFO
typedef struct bd_clip BLURAY_CLIP_INFO
typedef struct bd_chapter BLURAY_TITLE_CHAPTER
typedef struct bd_mark BLURAY_TITLE_MARK
typedef struct bd_title_info BLURAY_TITLE_INFO
typedef struct bd_sound_effect BLURAY_SOUND_EFFECT
typedef void(* bd_overlay_proc_f )(void *, const struct bd_overlay_s *const)
typedef void(* bd_argb_overlay_proc_f )(void *, const struct bd_argb_overlay_s *const)

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_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
}
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
}
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
}
enum  bd_video_aspect_e { BLURAY_ASPECT_RATIO_4_3 = 2, BLURAY_ASPECT_RATIO_16_9 = 3 }
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 }
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
}
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
}
enum  bd_still_mode_e { BLURAY_STILL_NONE = 0x00, BLURAY_STILL_TIME = 0x01, BLURAY_STILL_INFINITE = 0x02 }
enum  bd_player_setting {
  BLURAY_PLAYER_SETTING_PARENTAL = 13, BLURAY_PLAYER_SETTING_AUDIO_CAP = 15, 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_DISPLAY_CAP = 23, BLURAY_PLAYER_SETTING_3D_CAP = 24, BLURAY_PLAYER_SETTING_VIDEO_CAP = 29, BLURAY_PLAYER_SETTING_TEXT_CAP = 30,
  BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31, BLURAY_PLAYER_SETTING_DECODE_PG = 0x100
}
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 = 30, BD_EVENT_END_OF_TITLE = 9, BD_EVENT_AUDIO_STREAM = 10,
  BD_EVENT_IG_STREAM = 11, BD_EVENT_PG_TEXTST_STREAM = 12, BD_EVENT_PIP_PG_TEXTST_STREAM = 13, BD_EVENT_SECONDARY_AUDIO_STREAM = 14,
  BD_EVENT_SECONDARY_VIDEO_STREAM = 15, BD_EVENT_PG_TEXTST = 16, BD_EVENT_PIP_PG_TEXTST = 17, BD_EVENT_SECONDARY_AUDIO = 18,
  BD_EVENT_SECONDARY_VIDEO = 19, BD_EVENT_SECONDARY_VIDEO_SIZE = 20, BD_EVENT_DISCONTINUITY = 28, BD_EVENT_SEEK = 21,
  BD_EVENT_STILL = 22, BD_EVENT_STILL_TIME = 23, BD_EVENT_SOUND_EFFECT = 24, BD_EVENT_IDLE = 29,
  BD_EVENT_POPUP = 25, BD_EVENT_MENU = 26, BD_EVENT_STEREOSCOPIC_STATUS = 27
}

Functions

void bd_get_version (int *major, int *minor, int *micro)
uint32_t bd_get_titles (BLURAY *bd, uint8_t flags, uint32_t min_title_length)
BLURAY_TITLE_INFObd_get_title_info (BLURAY *bd, uint32_t title_idx, unsigned angle)
BLURAY_TITLE_INFObd_get_playlist_info (BLURAY *bd, uint32_t playlist, unsigned angle)
void bd_free_title_info (BLURAY_TITLE_INFO *title_info)
BLURAY * bd_open (const char *device_path, const char *keyfile_path)
void bd_close (BLURAY *bd)
int64_t bd_seek (BLURAY *bd, uint64_t pos)
int64_t bd_seek_time (BLURAY *bd, uint64_t tick)
int bd_read (BLURAY *bd, unsigned char *buf, int len)
int bd_read_skip_still (BLURAY *bd)
int64_t bd_seek_chapter (BLURAY *bd, unsigned chapter)
int64_t bd_chapter_pos (BLURAY *bd, unsigned chapter)
uint32_t bd_get_current_chapter (BLURAY *bd)
int64_t bd_seek_mark (BLURAY *bd, unsigned mark)
int64_t bd_seek_playitem (BLURAY *bd, unsigned clip_ref)
int bd_select_playlist (BLURAY *bd, uint32_t playlist)
int bd_select_title (BLURAY *bd, uint32_t title)
int bd_select_angle (BLURAY *bd, unsigned angle)
void bd_seamless_angle_change (BLURAY *bd, unsigned angle)
uint64_t bd_get_title_size (BLURAY *bd)
uint32_t bd_get_current_title (BLURAY *bd)
unsigned bd_get_current_angle (BLURAY *bd)
uint64_t bd_tell (BLURAY *bd)
uint64_t bd_tell_time (BLURAY *bd)
const BLURAY_DISC_INFObd_get_disc_info (BLURAY *)
int bd_set_player_setting (BLURAY *bd, uint32_t idx, uint32_t value)
int bd_set_player_setting_str (BLURAY *bd, uint32_t idx, const char *s)
int bd_start_bdj (BLURAY *bd, const char *start_object)
void bd_stop_bdj (BLURAY *bd)
int bd_get_event (BLURAY *bd, BD_EVENT *event)
int bd_play (BLURAY *bd)
int bd_read_ext (BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
int bd_play_title (BLURAY *bd, unsigned title)
int bd_menu_call (BLURAY *bd, int64_t pts)
void bd_register_overlay_proc (BLURAY *bd, void *handle, bd_overlay_proc_f func)
void bd_register_argb_overlay_proc (BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, struct bd_argb_buffer_s *buf)
void bd_set_scr (BLURAY *bd, int64_t pts)
int bd_user_input (BLURAY *bd, int64_t pts, uint32_t key)
int bd_mouse_select (BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
int bd_get_sound_effect (BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect)
struct meta_dl * bd_get_meta (BLURAY *bd)
struct clpi_cl * bd_get_clpi (BLURAY *bd, unsigned clip_ref)
void bd_free_clpi (struct clpi_cl *cl)

Detailed Description

external API header


Define Documentation

#define TITLES_ALL   0

all titles.

#define TITLES_FILTER_DUP_CLIP   0x02

remove titles that have duplicate clips.

#define TITLES_FILTER_DUP_TITLE   0x01

remove duplicate titles.

#define TITLES_RELEVANT   (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)

remove duplicate titles and clips


Function Documentation

int64_t bd_chapter_pos ( BLURAY *  bd,
unsigned  chapter 
)

Find the byte position of a chapter

Parameters:
bd BLURAY object
chapter chapter to find position of
Returns:
seek position of chapter start
void bd_close ( BLURAY *  bd  ) 

Free libbluray objects

Parameters:
bd BLURAY object
void bd_free_clpi ( struct clpi_cl *  cl  ) 

Free CLPI_CL object

Parameters:
cl CLPI_CL objects
void bd_free_title_info ( BLURAY_TITLE_INFO title_info  ) 

Free BLURAY_TITLE_INFO object

Parameters:
title_info BLURAY_TITLE_INFO object
struct clpi_cl* bd_get_clpi ( BLURAY *  bd,
unsigned  clip_ref 
) [read]

Get copy of clip information for requested playitem.

Parameters:
bd BLURAY objects
clip_ref requested playitem number
Returns:
pointer to allocated CLPI_CL object on success, NULL on error
unsigned bd_get_current_angle ( BLURAY *  bd  ) 

Return the current angle

Parameters:
bd BLURAY object
Returns:
current angle
uint32_t bd_get_current_chapter ( BLURAY *  bd  ) 

Get the current chapter

Parameters:
bd BLURAY object
Returns:
current chapter
uint32_t bd_get_current_title ( BLURAY *  bd  ) 

Returns the current title index

Parameters:
bd BLURAY object
Returns:
current title index
const BLURAY_DISC_INFO* bd_get_disc_info ( BLURAY *   ) 

Get information about current BluRay disc

Parameters:
bd BLURAY object
Returns:
pointer to BLURAY_DISC_INFO object, NULL on error
int bd_get_event ( BLURAY *  bd,
BD_EVENT event 
)

Get event from libbluray event queue.

Parameters:
bd BLURAY object
event next BD_EVENT from event queue, NULL to initialize event queue
Returns:
1 on success, 0 if no events
struct meta_dl* bd_get_meta ( BLURAY *  bd  )  [read]

Get meta information about the bluray disc.

Parameters:
bd BLURAY object
Returns:
META_DL (disclib) object, NULL on error
BLURAY_TITLE_INFO* bd_get_playlist_info ( BLURAY *  bd,
uint32_t  playlist,
unsigned  angle 
)

Get information about a playlist

Parameters:
bd BLURAY object
playlist playlist number
angle angle number (chapter offsets and clip size depend on selected angle)
Returns:
allocated BLURAY_TITLE_INFO object, NULL on error
int bd_get_sound_effect ( BLURAY *  bd,
unsigned  sound_id,
struct bd_sound_effect effect 
)

Get sound effect

Parameters:
bd BLURAY object
effect_id sound effect id (0...N)
effect sound effect data
Returns:
<0 when no effects, 0 when id out of range, 1 on success
BLURAY_TITLE_INFO* bd_get_title_info ( BLURAY *  bd,
uint32_t  title_idx,
unsigned  angle 
)

Get information about a title

Parameters:
bd BLURAY object
title_idx title index number
angle angle number (chapter offsets and clip size depend on selected angle)
Returns:
allocated BLURAY_TITLE_INFO object, NULL on error
uint64_t bd_get_title_size ( BLURAY *  bd  ) 

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

Parameters:
bd BLURAY object
Returns:
file size in bytes of currently selected title, 0 if no title selected
uint32_t bd_get_titles ( BLURAY *  bd,
uint8_t  flags,
uint32_t  min_title_length 
)

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:
bd BLURAY object
flags title flags
min_title_length filter out titles shorter than min_title_length seconds
Returns:
number of titles found
void bd_get_version ( int *  major,
int *  minor,
int *  micro 
)

Get library version

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:
bd BLURAY object
pts current playback position (1/90000s) or -1
Returns:
1 on success, 0 if error
int bd_mouse_select ( BLURAY *  bd,
int64_t  pts,
uint16_t  x,
uint16_t  y 
)

Select menu button at location (x,y).

Parameters:
bd BLURAY object
pts current playback position (1/90000s) or -1
x mouse pointer x-position
y mouse pointer y-position
Returns:
<0 on error, 0 when mouse is outside of buttons, 1 when mouse is inside button
BLURAY* bd_open ( const char *  device_path,
const char *  keyfile_path 
)

Initializes libbluray objects

Parameters:
device_path path to mounted Blu-ray disc or device
keyfile_path path to KEYDB.cfg (may be NULL)
Returns:
allocated BLURAY object, NULL if error
int bd_play ( BLURAY *  bd  ) 

Start playing disc in navigation mode (using on-disc menus).

Playback is started from "First Play" title.

Parameters:
bd BLURAY object
Returns:
1 on success, 0 if error
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:
bd BLURAY object
title title number from disc index
Returns:
1 on success, 0 if error
int bd_read ( BLURAY *  bd,
unsigned char *  buf,
int  len 
)

Read from currently selected title file, decrypt if possible

Parameters:
bd BLURAY object
buf buffer to read data into
len size of data to be read
Returns:
size of data read, -1 if error, 0 if EOF
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:
bd BLURAY object
buf buffer to read data into
len size of data to be read
event next 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
int bd_read_skip_still ( BLURAY *  bd  ) 

Continue reading after still mode clip

Parameters:
bd BLURAY object
Returns:
0 on error
void bd_register_argb_overlay_proc ( BLURAY *  bd,
void *  handle,
bd_argb_overlay_proc_f  func,
struct bd_argb_buffer_s *  buf 
)

Register ARGB overlay graphics handler function.

BD-J graphics can be acquired only with this function.

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:
bd BLURAY object
handle application-specific handle that will be passed to handler function
func handler function pointer
buf optional application-allocated frame buffer
Returns:
1 on success, 0 if error
void bd_register_overlay_proc ( BLURAY *  bd,
void *  handle,
bd_overlay_proc_f  func 
)

Register YUV overlay graphics handler function.

Only compressed YUV HDMV overlays will be passed to this function. 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:
bd BLURAY object
handle application-specific handle that will be passed to handler function
func handler function pointer
Returns:
1 on success, 0 if error
void bd_seamless_angle_change ( BLURAY *  bd,
unsigned  angle 
)

Initiate seamless angle change

Parameters:
bd BLURAY object
angle angle to change to
int64_t bd_seek ( BLURAY *  bd,
uint64_t  pos 
)

Seek to pos in currently selected title

Parameters:
bd BLURAY object
pos position to seek to
Returns:
current seek position
int64_t bd_seek_chapter ( BLURAY *  bd,
unsigned  chapter 
)

Seek to a chapter. First chapter is 0

Parameters:
bd BLURAY object
chapter chapter to seek to
Returns:
current seek position
int64_t bd_seek_mark ( BLURAY *  bd,
unsigned  mark 
)

Seek to a playmark. First mark is 0

Parameters:
bd BLURAY object
mark playmark to seek to
Returns:
current seek position
int64_t bd_seek_playitem ( BLURAY *  bd,
unsigned  clip_ref 
)

Seek to a playitem.

Parameters:
bd BLURAY object
playitem to seek to
Returns:
current seek position
int64_t bd_seek_time ( BLURAY *  bd,
uint64_t  tick 
)

Seek to specific time in 90Khz ticks

Parameters:
bd BLURAY ojbect
tick tick count
Returns:
current seek position
int bd_select_angle ( BLURAY *  bd,
unsigned  angle 
)

Set the angle to play

Parameters:
bd BLURAY object
angle angle to play
Returns:
1 on success, 0 if error
int bd_select_playlist ( BLURAY *  bd,
uint32_t  playlist 
)

Select a playlist

Parameters:
bd BLURAY object
playlist playlist to select
Returns:
1 on success, 0 if error
int bd_select_title ( BLURAY *  bd,
uint32_t  title 
)

Select the title from the list created by bd_get_titles()

Parameters:
bd BLURAY object
title title to select
Returns:
1 on success, 0 if error
int bd_set_player_setting ( BLURAY *  bd,
uint32_t  idx,
uint32_t  value 
)

Update player setting registers

Parameters:
bd BLURAY object
idx Player setting register
value New value for player setting register
Returns:
1 on success, 0 on error (invalid setting)
void bd_set_scr ( BLURAY *  bd,
int64_t  pts 
)

Update current pts.

Parameters:
bd BLURAY object
pts current playback position (1/90000s) or -1
uint64_t bd_tell ( BLURAY *  bd  ) 

Return current pos

Parameters:
bd BLURAY object
Returns:
current seek position
uint64_t bd_tell_time ( BLURAY *  bd  ) 

Return current time

Parameters:
bd BLURAY object
Returns:
current time
int bd_user_input ( BLURAY *  bd,
int64_t  pts,
uint32_t  key 
)

Pass user input to graphics controller. Keys are defined in libbluray/keys.h. Current pts can be updated by using BD_VK_NONE key. This is required for animated menus.

Parameters:
bd BLURAY object
pts current playback position (1/90000s) or -1
key input key
Returns:
<0 on error, 0 on success, >0 if selection/activation changed
 All Classes Files Functions Defines