From 47e92b2f884d4dd831e3e59ae9c692b460ef8dc3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 24 Aug 2013 19:37:34 +0200 Subject: video: handle video output levels with mp_image_params Until now, video output levels (obscure feature, like using TV screens that require RGB output in limited range, similar to YUY) still required handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE is not needed at all anymore in VOs that use the reconfig callback. The result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the colormatrix related properties (basically, for display on OSD). For other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config instead of twice. --- video/sws_utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'video/sws_utils.c') diff --git a/video/sws_utils.c b/video/sws_utils.c index db91434553..7adecc49fc 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -179,6 +179,14 @@ struct mp_sws_context *mp_sws_alloc(void *talloc_parent) // Optional, but possibly useful to avoid having to handle mp_sws_scale errors. int mp_sws_reinit(struct mp_sws_context *ctx) { + struct mp_image_params *src = &ctx->src; + struct mp_image_params *dst = &ctx->dst; + + // Neutralize unsupported or ignored parameters. + src->d_w = dst->d_w = 0; + src->d_h = dst->d_h = 0; + src->outputlevels = dst->outputlevels = MP_CSP_LEVELS_AUTO; + if (cache_valid(ctx)) return 0; @@ -187,9 +195,6 @@ int mp_sws_reinit(struct mp_sws_context *ctx) if (!ctx->sws) return -1; - struct mp_image_params *src = &ctx->src; - struct mp_image_params *dst = &ctx->dst; - mp_image_params_guess_csp(src); // sanitize colorspace/colorlevels mp_image_params_guess_csp(dst); -- cgit v1.2.3