summaryrefslogtreecommitdiffstats
path: root/video/out/vo_xv.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-29 00:25:08 +0100
committerwm4 <wm4@nowhere>2014-03-29 00:25:08 +0100
commitbd0618f01f1331c1ba0a3b2bb65975b5a21fe2e2 (patch)
treeaa7ecd5d7a7662130c8a25d3dd569ac6c50624c2 /video/out/vo_xv.c
parentfdeda359f7b060ec0a926eccb86c01b736a1ee16 (diff)
downloadmpv-bd0618f01f1331c1ba0a3b2bb65975b5a21fe2e2.tar.bz2
mpv-bd0618f01f1331c1ba0a3b2bb65975b5a21fe2e2.tar.xz
video/out: remove legacy colorspace stuff
Reduce most dependencies on struct mp_csp_details, which was a bad first attempt at dealing with colorspace stuff. Instead, consistently use mp_image_params. Code which retrieves colorspace matrices from csputils.c still uses this type, though.
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r--video/out/vo_xv.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index d9995ffa96..cab43c8f92 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -87,7 +87,7 @@ struct xvctx {
uint32_t image_width;
uint32_t image_height;
uint32_t image_format;
- struct mp_csp_details cached_csp;
+ int cached_csp;
struct mp_rect src_rect;
struct mp_rect dst_rect;
uint32_t max_width, max_height; // zero means: not set
@@ -392,11 +392,10 @@ static void xv_draw_colorkey(struct vo *vo, const struct mp_rect *rc)
static void read_xv_csp(struct vo *vo)
{
struct xvctx *ctx = vo->priv;
- struct mp_csp_details *cspc = &ctx->cached_csp;
- *cspc = (struct mp_csp_details) MP_CSP_DETAILS_DEFAULTS;
+ ctx->cached_csp = 0;
int bt709_enabled;
if (xv_get_eq(vo, ctx->xv_port, "bt_709", &bt709_enabled))
- cspc->format = bt709_enabled == 100 ? MP_CSP_BT_709 : MP_CSP_BT_601;
+ ctx->cached_csp = bt709_enabled == 100 ? MP_CSP_BT_709 : MP_CSP_BT_601;
}
static void resize(struct vo *vo)
@@ -476,6 +475,9 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
ctx->current_buf = 0;
ctx->current_ip_buf = 0;
+ int is_709 = params->colorspace == MP_CSP_BT_709;
+ xv_set_eq(vo, ctx->xv_port, "bt_709", is_709 * 200 - 100);
+ read_xv_csp(vo);
resize(vo);
@@ -603,7 +605,12 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
img.stride[n] = xv_image->pitches[sn];
}
- mp_image_set_colorspace_details(&img, &ctx->cached_csp);
+ if (vo->params) {
+ struct mp_image_params params = *vo->params;
+ if (ctx->cached_csp)
+ params.colorspace = ctx->cached_csp;
+ mp_image_set_attributes(&img, &params);
+ }
return img;
}
@@ -842,18 +849,12 @@ static int control(struct vo *vo, uint32_t request, void *data)
struct voctrl_get_equalizer_args *args = data;
return xv_get_eq(vo, ctx->xv_port, args->name, args->valueptr);
}
- case VOCTRL_SET_YUV_COLORSPACE:;
- struct mp_csp_details* given_cspc = data;
- int is_709 = given_cspc->format == MP_CSP_BT_709;
- xv_set_eq(vo, ctx->xv_port, "bt_709", is_709 * 200 - 100);
- read_xv_csp(vo);
- vo->want_redraw = true;
- return true;
- case VOCTRL_GET_YUV_COLORSPACE:;
- struct mp_csp_details* cspc = data;
+ case VOCTRL_GET_COLORSPACE: {
+ struct mp_image_params *params = data;
read_xv_csp(vo);
- *cspc = ctx->cached_csp;
+ params->colorspace = ctx->cached_csp;
return true;
+ }
case VOCTRL_REDRAW_FRAME:
redraw_frame(vo);
return true;