Skip to content
Commits on Source (4)
......@@ -315,49 +315,77 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
{
MPLS_STN *stn = &clip->title->pl->play_item[clip->ref].stn;
uint32_t audio_lang = 0;
uint32_t psr_val;
bd_psr_write(bd->regs, PSR_PLAYITEM, clip->ref);
bd_psr_write(bd->regs, PSR_TIME, clip->in_time);
/* Update selected audio and subtitle stream PSRs when not using menus.
* Selection is based on language setting PSRs and clip STN.
*/
/* Validate selected audio, subtitle and IG stream PSRs when using menus */
{
uint32_t psr_val;
/* Validate selected audio, subtitle and IG stream PSRs */
if (stn->num_audio) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_PRIMARY_AUDIO_ID);
if (psr_val == 0 || psr_val > stn->num_audio) {
_update_stream_psr_by_lang(bd->regs,
PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0,
stn->audio, stn->num_audio,
&audio_lang, 0);
} else {
audio_lang = str_to_uint32((const char *)stn->audio[psr_val - 1].lang, 3);
}
bd_psr_unlock(bd->regs);
}
if (stn->num_pg) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_PG_STREAM) & 0xfff;
if ((psr_val == 0) || (psr_val > stn->num_pg)) {
_update_stream_psr_by_lang(bd->regs,
PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000,
stn->pg, stn->num_pg,
NULL, audio_lang);
}
bd_psr_unlock(bd->regs);
}
if (stn->num_ig && bd->title_type != title_undef) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_IG_STREAM_ID);
if ((psr_val == 0) || (psr_val > stn->num_ig)) {
bd_psr_write(bd->regs, PSR_IG_STREAM_ID, 1);
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Selected IG stream 1 (stream %d not available)\n", psr_val);
}
bd_psr_unlock(bd->regs);
}
}
static void _update_playlist_psrs(BLURAY *bd)
{
NAV_CLIP *clip = bd->st0.clip;
bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
if (clip && bd->title_type == title_undef) {
/* Initialize selected audio and subtitle stream PSRs when not using menus.
* Selection is based on language setting PSRs and clip STN.
*/
MPLS_STN *stn = &clip->title->pl->play_item[clip->ref].stn;
uint32_t audio_lang = 0;
/* make sure clip is up-to-date before STREAM events are triggered */
bd_psr_write(bd->regs, PSR_PLAYITEM, clip->ref);
if (stn->num_audio) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_PRIMARY_AUDIO_ID);
if (psr_val == 0 || psr_val > stn->num_audio) {
_update_stream_psr_by_lang(bd->regs,
PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0,
stn->audio, stn->num_audio,
&audio_lang, 0);
} else {
audio_lang = str_to_uint32((const char *)stn->audio[psr_val - 1].lang, 3);
}
bd_psr_unlock(bd->regs);
_update_stream_psr_by_lang(bd->regs,
PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0,
stn->audio, stn->num_audio,
&audio_lang, 0);
}
if (stn->num_pg) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_PG_STREAM) & 0xfff;
if ((psr_val == 0) || (psr_val > stn->num_pg)) {
_update_stream_psr_by_lang(bd->regs,
PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000,
stn->pg, stn->num_pg,
NULL, audio_lang);
}
bd_psr_unlock(bd->regs);
}
if (stn->num_ig && bd->title_type != title_undef) {
bd_psr_lock(bd->regs);
psr_val = bd_psr_read(bd->regs, PSR_IG_STREAM_ID);
if ((psr_val == 0) || (psr_val > stn->num_ig)) {
bd_psr_write(bd->regs, PSR_IG_STREAM_ID, 1);
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Selected IG stream 1 (stream %d not available)\n", psr_val);
}
bd_psr_unlock(bd->regs);
_update_stream_psr_by_lang(bd->regs,
PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000,
stn->pg, stn->num_pg,
NULL, audio_lang);
}
}
}
......@@ -2341,12 +2369,11 @@ static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
bd->end_of_playlist = 0;
bd->st0.ig_pid = 0;
bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
// Get the initial clip of the playlist
bd->st0.clip = nav_next_clip(bd->title, NULL);
_update_playlist_psrs(bd);
if (_open_m2ts(bd, &bd->st0)) {
BD_DEBUG(DBG_BLURAY, "Title %s selected\n", f_name);
......@@ -3369,7 +3396,7 @@ int bd_menu_call(BLURAY *bd, int64_t pts)
static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
{
BD_DEBUG(DBG_BLURAY, "HDMV event: %d %d\n", hev->event, hev->param);
BD_DEBUG(DBG_BLURAY, "HDMV event: %s(%d): %d\n", hdmv_event_str(hev->event), hev->event, hev->param);
switch (hev->event) {
case HDMV_EVENT_TITLE:
......@@ -3425,7 +3452,7 @@ static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
case HDMV_EVENT_END:
case HDMV_EVENT_NONE:
default:
//default:
break;
}
}
......
......@@ -301,6 +301,28 @@ static void _fetch_operands(HDMV_VM *p, MOBJ_CMD *cmd, uint32_t *dst, uint32_t *
* event queue
*/
const char *hdmv_event_str(hdmv_event_e event)
{
switch (event) {
#define EVENT_ENTRY(e) case e : return #e
EVENT_ENTRY(HDMV_EVENT_NONE);
EVENT_ENTRY(HDMV_EVENT_END);
EVENT_ENTRY(HDMV_EVENT_IG_END);
EVENT_ENTRY(HDMV_EVENT_TITLE);
EVENT_ENTRY(HDMV_EVENT_PLAY_PL);
EVENT_ENTRY(HDMV_EVENT_PLAY_PI);
EVENT_ENTRY(HDMV_EVENT_PLAY_PM);
EVENT_ENTRY(HDMV_EVENT_PLAY_STOP);
EVENT_ENTRY(HDMV_EVENT_STILL);
EVENT_ENTRY(HDMV_EVENT_SET_BUTTON_PAGE);
EVENT_ENTRY(HDMV_EVENT_ENABLE_BUTTON);
EVENT_ENTRY(HDMV_EVENT_DISABLE_BUTTON);
EVENT_ENTRY(HDMV_EVENT_POPUP_OFF);
#undef EVENT_ENTRY
}
return "???";
}
static int _get_event(HDMV_VM *p, HDMV_EVENT *ev)
{
if (p->event[0].event != HDMV_EVENT_NONE) {
......@@ -325,7 +347,7 @@ static int _queue_event(HDMV_VM *p, hdmv_event_e event, uint32_t param)
}
}
BD_DEBUG(DBG_HDMV|DBG_CRIT, "_queue_event(%d, %d): queue overflow !\n", event, param);
BD_DEBUG(DBG_HDMV|DBG_CRIT, "_queue_event(%d:%s, %d): queue overflow !\n", event, hdmv_event_str(event), param);
return -1;
}
......
......@@ -60,6 +60,8 @@ typedef struct hdmv_vm_event_s {
uint32_t param;
} HDMV_EVENT;
BD_PRIVATE const char *hdmv_event_str(hdmv_event_e event);
/*
*
*/
......