summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-18 01:19:20 +0100
committerwm4 <wm4@nowhere>2014-01-18 01:27:43 +0100
commit7f4a09bb8534dfafd83099d773adf2e33c64e267 (patch)
tree5b75791151f92e164fbd9badee47590d1164683d /video/out
parent92a9f11a0b4fda60c8880014be5920dcf3e95253 (diff)
downloadmpv-7f4a09bb8534dfafd83099d773adf2e33c64e267.tar.bz2
mpv-7f4a09bb8534dfafd83099d773adf2e33c64e267.tar.xz
sub: uglify OSD code path with locking
Do two things: 1. add locking to struct osd_state 2. make struct osd_state opaque While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses lots of osd_state (and osd_object) members. To make sure everything is accessed synchronously, I prefer making osd_state opaque, even if it means adding pretty dumb accessors. All of this is meant to allow running VO in their own threads. Eventually, VOs will request OSD on their own, which means osd_state will be accessed from foreign threads.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gl_osd.c4
-rw-r--r--video/out/vo_direct3d.c2
-rw-r--r--video/out/vo_image.c2
-rw-r--r--video/out/vo_lavc.c3
-rw-r--r--video/out/vo_sdl.c2
-rw-r--r--video/out/vo_vaapi.c2
-rw-r--r--video/out/vo_vdpau.c2
-rw-r--r--video/out/vo_wayland.c2
-rw-r--r--video/out/vo_x11.c2
-rw-r--r--video/out/vo_xv.c2
10 files changed, 12 insertions, 11 deletions
diff --git a/video/out/gl_osd.c b/video/out/gl_osd.c
index 99b64176ae..393619e554 100644
--- a/video/out/gl_osd.c
+++ b/video/out/gl_osd.c
@@ -282,7 +282,7 @@ void mpgl_osd_draw_cb(struct mpgl_osd *ctx,
{
struct draw_cb_closure c = {ctx, cb, cb_ctx};
reset(ctx);
- osd_draw(osd, res, osd->vo_pts, 0, ctx->formats, draw_cb, &c);
+ osd_draw(osd, res, osd_get_vo_pts(osd), 0, ctx->formats, draw_cb, &c);
}
void mpgl_osd_redraw_cb(struct mpgl_osd *ctx,
@@ -376,5 +376,5 @@ static void draw_legacy_cb(void *pctx, struct sub_bitmaps *imgs)
void mpgl_osd_draw_legacy(struct mpgl_osd *ctx, struct osd_state *osd,
struct mp_osd_res res)
{
- osd_draw(osd, res, osd->vo_pts, 0, ctx->formats, draw_legacy_cb, ctx);
+ osd_draw(osd, res, osd_get_vo_pts(osd), 0, ctx->formats, draw_legacy_cb, ctx);
}
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 6e189bc660..10539d4f18 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -1700,7 +1700,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
if (!priv->d3d_device)
return;
- osd_draw(osd, priv->osd_res, osd->vo_pts, 0, osd_fmt_supported,
+ osd_draw(osd, priv->osd_res, osd_get_vo_pts(osd), 0, osd_fmt_supported,
draw_osd_cb, priv);
}
diff --git a/video/out/vo_image.c b/video/out/vo_image.c
index c99eae49b4..f7f3a35822 100644
--- a/video/out/vo_image.c
+++ b/video/out/vo_image.c
@@ -97,7 +97,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
.display_par = sar / dar,
};
- osd_draw_on_image(osd, dim, osd->vo_pts, OSD_DRAW_SUB_ONLY, p->current);
+ osd_draw_on_image(osd, dim, osd_get_vo_pts(osd), OSD_DRAW_SUB_ONLY, p->current);
}
static void flip_page(struct vo *vo)
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index c0b317da94..8a784db37b 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -500,7 +500,8 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
mp_image_set_colorspace_details(vc->lastimg, &vc->colorspace);
- osd_draw_on_image(osd, dim, osd->vo_pts, OSD_DRAW_SUB_ONLY, vc->lastimg);
+ osd_draw_on_image(osd, dim, osd_get_vo_pts(osd), OSD_DRAW_SUB_ONLY,
+ vc->lastimg);
}
}
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 893279a8f4..3f743a17a4 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -727,7 +727,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
[SUBBITMAP_RGBA] = true,
};
- osd_draw(osd, vc->osd_res, osd->vo_pts, 0, osdformats, draw_osd_cb, vo);
+ osd_draw(osd, vc->osd_res, osd_get_vo_pts(osd), 0, osdformats, draw_osd_cb, vo);
}
static int preinit(struct vo *vo)
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index cd2768a3ea..4876c454d9 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -435,7 +435,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
for (int n = 0; n < MAX_OSD_PARTS; n++)
p->osd_parts[n].active = false;
- osd_draw(osd, *res, osd->vo_pts, 0, osd_formats, draw_osd_cb, p);
+ osd_draw(osd, *res, osd_get_vo_pts(osd), 0, osd_formats, draw_osd_cb, p);
}
static int get_displayattribtype(const char *name)
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 5a0d11206a..c93c3eb0a6 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -997,7 +997,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
[SUBBITMAP_RGBA] = true,
};
- osd_draw(osd, vc->osd_rect, osd->vo_pts, 0, formats, draw_osd_cb, vo);
+ osd_draw(osd, vc->osd_rect, osd_get_vo_pts(osd), 0, formats, draw_osd_cb, vo);
}
static int update_presentation_queue_status(struct vo *vo)
diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c
index 1d9025b245..3ab9246553 100644
--- a/video/out/vo_wayland.c
+++ b/video/out/vo_wayland.c
@@ -560,7 +560,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
{
struct priv *p = vo->priv;
struct mp_image img = buffer_get_mp_image(p, p->back_buffer);
- osd_draw_on_image(osd, p->osd, osd->vo_pts, 0, &img);
+ osd_draw_on_image(osd, p->osd, osd_get_vo_pts(osd), 0, &img);
}
static void flip_page(struct vo *vo)
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 8240f55b25..0da8715f5d 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -427,7 +427,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
struct mp_image img = get_x_buffer(p, p->current_buf);
- osd_draw_on_image(osd, p->osd, osd->vo_pts, 0, &img);
+ osd_draw_on_image(osd, p->osd, osd_get_vo_pts(osd), 0, &img);
}
static mp_image_t *get_screenshot(struct vo *vo)
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 046dc21d85..53a46cbe5a 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -622,7 +622,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
.display_par = 1.0 / vo->aspdat.par,
};
- osd_draw_on_image(osd, res, osd->vo_pts, 0, &img);
+ osd_draw_on_image(osd, res, osd_get_vo_pts(osd), 0, &img);
}
static void wait_for_completion(struct vo *vo, int max_outstanding)