Skip to content

Commit

Permalink
libmythbluray: Upstream updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McNamara committed Jul 15, 2011
1 parent 42e35ff commit d5a069e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
6 changes: 5 additions & 1 deletion mythtv/libs/libmythbluray/bluray.c
Expand Up @@ -2195,7 +2195,11 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event)
_queue_initial_psr_events(bd);
}

return _get_event(bd, event);
if (event) {
return _get_event(bd, event);
}

return 0;
}

/*
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbluray/bluray.h
Expand Up @@ -251,7 +251,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick);
* @param bd BLURAY object
* @param buf buffer to read data into
* @param len size of data to be read
* @return size of data read, -1 if error
* @return size of data read, -1 if error, 0 if EOF
*/
int bd_read(BLURAY *bd, unsigned char *buf, int len);

Expand Down Expand Up @@ -512,7 +512,7 @@ typedef struct {
* Get event from libbluray event queue.
*
* @param bd BLURAY object
* @param event next BD_EVENT from event queue
* @param event next BD_EVENT from event queue, NULL to initialize event queue
* @return 1 on success, 0 if no events
*/
int bd_get_event(BLURAY *bd, BD_EVENT *event);
Expand Down
33 changes: 18 additions & 15 deletions mythtv/libs/libmythbluray/decoders/graphics_controller.c
Expand Up @@ -366,7 +366,7 @@ static void _clear_osd(GRAPHICS_CONTROLLER *gc, int plane)
{
_clear_osd_area(gc, plane, 0, 0, 1920, 1080);

if (plane) {
if (plane == BD_OVERLAY_IG) {
gc->ig_drawn = 0;
} else {
gc->pg_drawn = 0;
Expand All @@ -377,26 +377,31 @@ static void _clear_bog_area(GRAPHICS_CONTROLLER *gc, BOG_DATA *bog_data)
{
if (gc->ig_drawn && bog_data->w && bog_data->h) {

_clear_osd_area(gc, 1, bog_data->x, bog_data->y, bog_data->w, bog_data->h);
_clear_osd_area(gc, BD_OVERLAY_IG, bog_data->x, bog_data->y, bog_data->w, bog_data->h);

bog_data->x = bog_data->y = bog_data->w = bog_data->h = 0;
}
}

static void _select_button(GRAPHICS_CONTROLLER *gc, uint32_t button_id)
{
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
}

static void _select_page(GRAPHICS_CONTROLLER *gc, uint16_t page_id)
{
bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, page_id);
_clear_osd(gc, 1);
_clear_osd(gc, BD_OVERLAY_IG);
_reset_page_state(gc);

uint16_t button_id = _find_selected_button_id(gc);
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
_select_button(gc, button_id);
}

static void _gc_reset(GRAPHICS_CONTROLLER *gc)
{
_clear_osd(gc, 0);
_clear_osd(gc, 1);
_clear_osd(gc, BD_OVERLAY_PG);
_clear_osd(gc, BD_OVERLAY_IG);

gc->popup_visible = 0;

Expand Down Expand Up @@ -568,7 +573,7 @@ static void _render_button(GRAPHICS_CONTROLLER *gc, BD_IG_BUTTON *button, BD_PG_
}

ov.pts = -1;
ov.plane = 1; /* IG */
ov.plane = BD_OVERLAY_IG;

ov.x = bog_data->x = button->x_pos;
ov.y = bog_data->y = button->y_pos;
Expand Down Expand Up @@ -598,7 +603,7 @@ static void _render_page(GRAPHICS_CONTROLLER *gc,
if (s->ics->interactive_composition.ui_model == IG_UI_MODEL_POPUP && !gc->popup_visible) {
GC_TRACE("_render_page(): popup menu not visible\n");

_clear_osd(gc, 1);
_clear_osd(gc, BD_OVERLAY_IG);

return;
}
Expand Down Expand Up @@ -637,8 +642,6 @@ static void _render_page(GRAPHICS_CONTROLLER *gc,

_render_button(gc, button, palette, BTN_SELECTED, &gc->bog_data[ii]);

bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, selected_button_id);

if (button->auto_action_flag && cmds) {
cmds->num_nav_cmds = button->num_nav_cmds;
cmds->nav_cmds = button->nav_cmds;
Expand Down Expand Up @@ -749,7 +752,7 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
/* render page ? */
if (new_btn_id != cur_btn_id || activated_btn_id >= 0) {

bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, new_btn_id);
_select_button(gc, new_btn_id);

_render_page(gc, activated_btn_id, cmds);

Expand Down Expand Up @@ -833,7 +836,7 @@ static void _set_button_page(GRAPHICS_CONTROLLER *gc, uint32_t param)

if (button) {
gc->bog_data[bog_idx].enabled_button = button_id;
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
_select_button(gc, button_id);
}

_render_page(gc, 0xffff, NULL);
Expand Down Expand Up @@ -892,14 +895,14 @@ static void _update_selected_button(GRAPHICS_CONTROLLER *gc)
/* special case: triggered only after enable button disables selected button */
if (button_id & 0x10000) {
button_id &= 0xffff;
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
_select_button(gc, button_id);
GC_TRACE("_update_selected_button() -> #%d [last enabled]\n", button_id);
return;
}

if (button_id == 0xffff) {
button_id = _find_selected_button_id(gc);
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
_select_button(gc, button_id);
}
}

Expand Down Expand Up @@ -958,7 +961,7 @@ static int _mouse_move(GRAPHICS_CONTROLLER *gc, unsigned x, unsigned y, GC_NAV_C
}

if (new_btn_id != 0xffff) {
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, new_btn_id);
_select_button(gc, new_btn_id);

_render_page(gc, -1, cmds);
}
Expand Down
7 changes: 6 additions & 1 deletion mythtv/libs/libmythbluray/decoders/overlay.h
Expand Up @@ -26,6 +26,11 @@
extern "C" {
#endif

typedef enum {
BD_OVERLAY_PG = 0, /* Presentation Graphics plane */
BD_OVERLAY_IG = 1, /* Interactive Graphics plane (on top of PG plane) */
} bd_overlay_plane_e;

typedef struct bd_pg_palette_entry_s {
uint8_t Y;
uint8_t Cr;
Expand All @@ -40,7 +45,7 @@ typedef struct bd_pg_rle_elem_s {

typedef struct bd_overlay_s {
int64_t pts;
uint8_t plane; /* 0 - PG, 1 - IG */
uint8_t plane; /* bd_overlay_plane_e */

uint16_t x;
uint16_t y;
Expand Down

0 comments on commit d5a069e

Please sign in to comment.