diff options
author | wm4 <wm4@nowhere> | 2014-03-30 07:21:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-30 07:21:25 +0200 |
commit | 8487bb2c549283d340ee73310b1a58b13f746864 (patch) | |
tree | 7db8e84c28aa9a1b72e207137a126d029037c64d /player | |
parent | bdc936af059a9136d907885a3b7de189f4cde3d5 (diff) | |
parent | fb47f2f9402567eb7ecda7e5ec83e0c1915632c1 (diff) | |
download | mpv-8487bb2c549283d340ee73310b1a58b13f746864.tar.bz2 mpv-8487bb2c549283d340ee73310b1a58b13f746864.tar.xz |
Merge remote-tracking branch 'mpv/pr/676'
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 2 | ||||
-rw-r--r-- | player/core.h | 2 | ||||
-rw-r--r-- | player/discnav.c (renamed from player/dvdnav.c) | 62 |
3 files changed, 46 insertions, 20 deletions
diff --git a/player/command.c b/player/command.c index 8cc7e8120b..d22382c7fb 100644 --- a/player/command.c +++ b/player/command.c @@ -3333,7 +3333,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_input_disable_section(mpctx->input, cmd->args[0].v.s); break; - case MP_CMD_DVDNAV: + case MP_CMD_DISCNAV: mp_nav_user_input(mpctx, cmd->args[0].v.s); break; diff --git a/player/core.h b/player/core.h index 55c526b4cc..1d16a0e005 100644 --- a/player/core.h +++ b/player/core.h @@ -371,7 +371,7 @@ void mp_write_watch_later_conf(struct MPContext *mpctx); struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx, struct playlist *playlist); -// dvdnav.c +// discnav.c void mp_nav_init(struct MPContext *mpctx); void mp_nav_reset(struct MPContext *mpctx); void mp_nav_destroy(struct MPContext *mpctx); diff --git a/player/dvdnav.c b/player/discnav.c index 12ce5b621b..990f882d87 100644 --- a/player/dvdnav.c +++ b/player/discnav.c @@ -24,7 +24,7 @@ #include "common/common.h" #include "input/input.h" -#include "stream/stream_dvdnav.h" +#include "stream/discnav.h" #include "sub/dec_sub.h" #include "sub/osd.h" @@ -46,6 +46,8 @@ struct mp_nav_state { int vidsize[2]; int subsize[2]; struct sub_bitmap *hi_elem; + struct sub_bitmap *overlays[2]; + struct sub_bitmap outputs[3]; }; static inline bool is_valid_size(int size[2]) { @@ -84,12 +86,12 @@ void mp_nav_init(struct MPContext *mpctx) return; mpctx->nav_state = talloc_zero(NULL, struct mp_nav_state); - mpctx->nav_state->log = mp_log_new(mpctx->nav_state, mpctx->log, "dvdnav"); + mpctx->nav_state->log = mp_log_new(mpctx->nav_state, mpctx->log, "discnav"); MP_VERBOSE(mpctx->nav_state, "enabling\n"); - mp_input_enable_section(mpctx->input, "dvdnav", 0); - mp_input_set_section_mouse_area(mpctx->input, "dvdnav-menu", + mp_input_enable_section(mpctx->input, "discnav", 0); + mp_input_set_section_mouse_area(mpctx->input, "discnav-menu", INT_MIN, INT_MIN, INT_MAX, INT_MAX); } @@ -105,7 +107,7 @@ void mp_nav_reset(struct MPContext *mpctx) nav->nav_menu = false; nav->nav_draining = false; nav->nav_still_frame = 0; - mp_input_disable_section(mpctx->input, "dvdnav-menu"); + mp_input_disable_section(mpctx->input, "discnav-menu"); // Prevent demuxer init code to seek to the "start" mpctx->stream->start_pos = stream_tell(mpctx->stream); stream_control(mpctx->stream, STREAM_CTRL_RESUME_CACHE, NULL); @@ -116,8 +118,8 @@ void mp_nav_destroy(struct MPContext *mpctx) osd_set_nav_highlight(mpctx->osd, NULL); if (!mpctx->nav_state) return; - mp_input_disable_section(mpctx->input, "dvdnav"); - mp_input_disable_section(mpctx->input, "dvdnav-menu"); + mp_input_disable_section(mpctx->input, "discnav"); + mp_input_disable_section(mpctx->input, "discnav-menu"); talloc_free(mpctx->nav_state); mpctx->nav_state = NULL; } @@ -186,10 +188,10 @@ void mp_handle_nav(struct MPContext *mpctx) case MP_NAV_EVENT_MENU_MODE: nav->nav_menu = ev->u.menu_mode.enable; if (nav->nav_menu) { - mp_input_enable_section(mpctx->input, "dvdnav-menu", + mp_input_enable_section(mpctx->input, "discnav-menu", MP_INPUT_ON_TOP); } else { - mp_input_disable_section(mpctx->input, "dvdnav-menu"); + mp_input_disable_section(mpctx->input, "discnav-menu"); } break; case MP_NAV_EVENT_HIGHLIGHT: { @@ -207,6 +209,17 @@ void mp_handle_nav(struct MPContext *mpctx) osd_set_nav_highlight(mpctx->osd, mpctx); break; } + case MP_NAV_EVENT_OVERLAY: { + osd_set_nav_highlight(mpctx->osd, NULL); + for (int i = 0; i < 2; i++) { + if (nav->overlays[i]) + talloc_free(nav->overlays[i]); + nav->overlays[i] = talloc_steal(nav, ev->u.overlay.images[i]); + } + update_resolution(mpctx); + osd_set_nav_highlight(mpctx->osd, mpctx); + break; + } default: ; // ignore } talloc_free(ev); @@ -265,13 +278,26 @@ void mp_nav_get_highlight(void *priv, struct mp_osd_res res, nav->subsize[1] = sizes[1]; } - sub->x = nav->highlight[0]; - sub->y = nav->highlight[1]; - sub->w = MPCLAMP(nav->highlight[2] - sub->x, 0, sizes[0]); - sub->h = MPCLAMP(nav->highlight[3] - sub->y, 0, sizes[1]); - sub->stride = sub->w * 4; - out_imgs->format = SUBBITMAP_RGBA; - out_imgs->parts = sub; - out_imgs->num_parts = sub->w > 0 && sub->h > 0 && nav->hi_visible; - osd_rescale_bitmaps(out_imgs, sizes[0], sizes[1], res, -1); + out_imgs->num_parts = 0; + + if (nav->hi_visible) { + sub->x = nav->highlight[0]; + sub->y = nav->highlight[1]; + sub->w = MPCLAMP(nav->highlight[2] - sub->x, 0, sizes[0]); + sub->h = MPCLAMP(nav->highlight[3] - sub->y, 0, sizes[1]); + sub->stride = sub->w * 4; + if (sub->w > 0 && sub->h > 0) + nav->outputs[out_imgs->num_parts++] = *sub; + } + + if (nav->overlays[0]) + nav->outputs[out_imgs->num_parts++] = *nav->overlays[0]; + if (nav->overlays[1]) + nav->outputs[out_imgs->num_parts++] = *nav->overlays[1]; + + if (out_imgs->num_parts) { + out_imgs->parts = nav->outputs; + out_imgs->format = SUBBITMAP_RGBA; + osd_rescale_bitmaps(out_imgs, sizes[0], sizes[1], res, -1); + } } |