summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorxylosper <darklin20@gmail.com>2014-03-29 00:00:02 +0900
committerxylosper <darklin20@gmail.com>2014-03-29 23:31:46 +0900
commit8cee8279ad4b8aaf5c89056db5a1f9e3575f8eee (patch)
tree85c82898db43d664f8fa87a06975045578708466 /player
parentcd2d4ebf3b05e9cfefbb868e45ed71728178a99c (diff)
downloadmpv-8cee8279ad4b8aaf5c89056db5a1f9e3575f8eee.tar.bz2
mpv-8cee8279ad4b8aaf5c89056db5a1f9e3575f8eee.tar.xz
stream_bluray: implement navigation interface for Blu-ray stream
This commit introduces new stream protocols: bdnav(and others). bdnav stream shares lots of codes with original bluray stream, so it's not separated in different source file. Major difference from bluray is that bdnav does not support longest title because there is no way to query that information. bdnav://menu and bdnav://first correspond to top menu title and first play title respectively, though they often point same title. Also, binary position based seeking has been removed, because it didn't have no point.
Diffstat (limited to 'player')
-rw-r--r--player/dvdnav.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/player/dvdnav.c b/player/dvdnav.c
index 12ce5b621b..ecd141ceef 100644
--- a/player/dvdnav.c
+++ b/player/dvdnav.c
@@ -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]) {
@@ -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);
+ }
}