libbluray | branch: master | hpi1 <[email protected]> | Mon Jun 20 14:10:49 2011 +0300| [f899a1af5b4e4b8d59685d333435633d61921272] | committer: hpi1
updated xine plugin: added support for PG overlay plane > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=f899a1af5b4e4b8d59685d333435633d61921272 --- player_wrappers/xine/input_bluray.c | 67 +++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 19 deletions(-) diff --git a/player_wrappers/xine/input_bluray.c b/player_wrappers/xine/input_bluray.c index 307e791..b8af52c 100644 --- a/player_wrappers/xine/input_bluray.c +++ b/player_wrappers/xine/input_bluray.c @@ -81,6 +81,8 @@ #define PKT_SIZE 192 #define TICKS_IN_MS 45 +#define MIN_TITLE_LENGTH 180 + typedef struct { input_class_t input_class; @@ -100,7 +102,7 @@ typedef struct { xine_stream_t *stream; xine_event_queue_t *event_queue; - xine_osd_t *osd; + xine_osd_t *osd[2]; bluray_input_class_t *class; @@ -131,11 +133,34 @@ typedef struct { } bluray_input_plugin_t; -static void close_overlay(bluray_input_plugin_t *this) +static void send_num_buttons(bluray_input_plugin_t *this, int n) +{ + xine_event_t event; + xine_ui_data_t data; + + event.type = XINE_EVENT_UI_NUM_BUTTONS; + event.data = &data; + event.data_length = sizeof(data); + data.num_buttons = n; + + xine_event_send(this->stream, &event); +} + +static void close_overlay(bluray_input_plugin_t *this, int plane) { - if (this->osd) { - xine_osd_free(this->osd); - this->osd = NULL; + if (plane < 0) { + close_overlay(this, 0); + close_overlay(this, 1); + return; + } + + if (plane < 2 && this->osd[plane]) { + xine_osd_free(this->osd[plane]); + this->osd[plane] = NULL; + if (plane == 1) { + send_num_buttons(this, 0); + this->menu_open = 0; + } } } @@ -148,20 +173,22 @@ static void overlay_proc(void *this_gen, const BD_OVERLAY * const ov) return; } - if (!ov || ov->plane == 1) - this->menu_open = 0; - if (!ov) { /* hide OSD */ - close_overlay(this); + close_overlay(this, -1); + return; + } + + if (ov->plane > 1) { return; } /* open xine OSD */ - if (!this->osd) { - this->osd = xine_osd_new(this->stream, 0, 0, 1920, 1080); + if (!this->osd[ov->plane]) { + this->osd[ov->plane] = xine_osd_new(this->stream, 0, 0, 1920, 1080); } + xine_osd_t *osd = this->osd[ov->plane]; if (!this->pg_enable) { _x_select_spu_channel(this->stream, -1); } @@ -175,7 +202,7 @@ static void overlay_proc(void *this_gen, const BD_OVERLAY * const ov) color[i] = (ov->palette[i].Y << 16) | (ov->palette[i].Cr << 8) | ov->palette[i].Cb; } - xine_osd_set_palette(this->osd, color, trans); + xine_osd_set_palette(osd, color, trans); } /* uncompress and draw bitmap */ @@ -188,7 +215,7 @@ static void overlay_proc(void *this_gen, const BD_OVERLAY * const ov) memset(img + i, rlep->color, rlep->len); } - xine_osd_draw_bitmap(this->osd, img, ov->x, ov->y, ov->w, ov->h, NULL); + xine_osd_draw_bitmap(osd, img, ov->x, ov->y, ov->w, ov->h, NULL); free(img); @@ -196,20 +223,22 @@ static void overlay_proc(void *this_gen, const BD_OVERLAY * const ov) if (ov->x == 0 && ov->y == 0 && ov->w == 1920 && ov->h == 1080) { /* Nothing to display, close OSD */ - close_overlay(this); + close_overlay(this, ov->plane); return; } /* wipe rect */ - xine_osd_draw_rect(this->osd, ov->x, ov->y, ov->x + ov->w - 1, ov->y + ov->h - 1, 0xff, 1); + xine_osd_draw_rect(osd, ov->x, ov->y, ov->x + ov->w - 1, ov->y + ov->h - 1, 0xff, 1); } /* display */ - xine_osd_show(this->osd, 0); + xine_osd_show(osd, 0); - if (ov->plane == 1) + if (ov->plane == 1) { this->menu_open = 1; + send_num_buttons(this, 1); + } } static void update_stream_info(bluray_input_plugin_t *this) @@ -950,7 +979,7 @@ static void bluray_plugin_dispose (input_plugin_t *this_gen) if (this->bdh) bd_register_overlay_proc(this->bdh, NULL, NULL); - close_overlay(this); + close_overlay(this, -1); if (this->event_queue) xine_event_dispose_queue(this->event_queue); @@ -1120,7 +1149,7 @@ static int bluray_plugin_open (input_plugin_t *this_gen) /* load title list */ - this->num_title_idx = bd_get_titles(this->bdh, TITLES_RELEVANT, 180); + this->num_title_idx = bd_get_titles(this->bdh, TITLES_RELEVANT, MIN_TITLE_LENGTH); LOGMSG("%d titles\n", this->num_title_idx); if (this->num_title_idx < 1) _______________________________________________ libbluray-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libbluray-devel
