libbluray | branch: master | hpi1 <[email protected]> | Wed Dec 7 16:17:26 2011 +0200| [5febceefba27fa084ff6b07c1d2f253b3533a222] | committer: hpi1
Added support for sound effects in HDMV menus > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=5febceefba27fa084ff6b07c1d2f253b3533a222 --- ChangeLog | 1 + configure.ac | 6 +++--- src/libbluray/bluray.c | 36 ++++++++++++++++++++++++++++++++++++ src/libbluray/bluray.h | 18 ++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8807d24..006e4b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ ????-??-??: + - Support for sound effects in HDMV menus - Fixes to HDMV menu decoding - Distribute BD-J code diff --git a/configure.ac b/configure.ac index 756032b..6005949 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # library version number m4_define([bluray_major], 0) m4_define([bluray_minor], 2) -m4_define([bluray_micro], 1) +m4_define([bluray_micro], 2) m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro]) # shared library version (.so version) @@ -12,9 +12,9 @@ m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro]) # # Library file name will be libbluray.so.(current-age).age.revision # -m4_define([lt_current], 1) +m4_define([lt_current], 2) m4_define([lt_revision], 0) -m4_define([lt_age], 0) +m4_define([lt_age], 1) # initilization AC_INIT([libbluray], bluray_version, [http://www.videolan.org/developers/libbluray.html]) diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index bd90184..1ad36d0 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -34,6 +34,7 @@ #include "bdnav/index_parse.h" #include "bdnav/meta_parse.h" #include "bdnav/clpi_parse.h" +#include "bdnav/sound_parse.h" #include "hdmv/hdmv_vm.h" #include "decoders/graphics_controller.h" #include "file/file.h" @@ -141,6 +142,7 @@ struct bluray { /* graphics */ GRAPHICS_CONTROLLER *graphics_controller; + SOUND_DATA *sound_effects; }; #define DL_CALL(lib,func,param,...) \ @@ -557,6 +559,9 @@ static int _run_gc(BLURAY *bd, gc_ctrl_e msg, uint32_t param) hdmv_vm_set_object(bd->hdmv_vm, cmds.num_nav_cmds, cmds.nav_cmds); bd->hdmv_suspended = !hdmv_vm_running(bd->hdmv_vm); } + if (cmds.sound_id_ref >= 0 && cmds.sound_id_ref < 0xff) { + _queue_event(bd, (BD_EVENT){BD_EVENT_SOUND_EFFECT, cmds.sound_id_ref}); + } } return result; @@ -933,6 +938,7 @@ void bd_close(BLURAY *bd) gc_free(&bd->graphics_controller); indx_free(&bd->index); + sound_free(&bd->sound_effects); bd_registers_free(bd->regs); _free_event_queue(bd); @@ -2292,6 +2298,36 @@ void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func) } } +int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, BLURAY_SOUND_EFFECT *effect) +{ + if (!bd || !effect) { + return -1; + } + + if (!bd->sound_effects) { + + char *file = str_printf("%s/BDMV/AUXDATA/sound.bdmv", bd->device_path); + bd->sound_effects = sound_parse(file); + X_FREE(file); + + if (!bd->sound_effects) { + return -1; + } + } + + if (sound_id < bd->sound_effects->num_sounds) { + SOUND_OBJECT *o = &bd->sound_effects->sounds[sound_id]; + + effect->num_channels = o->num_channels; + effect->num_frames = o->num_frames; + effect->samples = (const int16_t *)o->samples; + + return 1; + } + + return 0; +} + /* * */ diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h index 7dddb58..2619860 100644 --- a/src/libbluray/bluray.h +++ b/src/libbluray/bluray.h @@ -168,6 +168,12 @@ typedef struct bd_title_info { BLURAY_TITLE_CHAPTER *chapters; } BLURAY_TITLE_INFO; +typedef struct bd_sound_effect { + uint8_t num_channels; /* 1 - mono, 2 - stereo */ + uint32_t num_frames; + const int16_t *samples; /* 48000 Hz, 16 bit LPCM. interleaved if stereo */ +} BLURAY_SOUND_EFFECT; + /** * Get library version * @@ -507,6 +513,7 @@ typedef enum { /* Still playback for n seconds (reached end of still mode play item) */ BD_EVENT_STILL_TIME, /* 0 = infinite ; 1...300 = seconds */ + BD_EVENT_SOUND_EFFECT, /* effect ID */ } bd_event_e; typedef struct { @@ -624,6 +631,17 @@ 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); +/** + * + * Get sound effect + * + * @param bd BLURAY object + * @param effect_id sound effect id (0...N) + * @param effect sound effect data + * @return <0 when no effects, 0 when id out of range, 1 on success + */ +int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, struct bd_sound_effect *effect); + /* * */ _______________________________________________ libbluray-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libbluray-devel
