Commit 5febceef authored by hpi1's avatar hpi1

Added support for sound effects in HDMV menus

parent 857d0e3a
????-??-??:
- Support for sound effects in HDMV menus
- Fixes to HDMV menu decoding
- Distribute BD-J code
......
# 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])
......
......@@ -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;
}
/*
*
*/
......
......@@ -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);
/*
*
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment