summaryrefslogtreecommitdiffstats
path: root/video/sws_utils.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-24 19:37:34 +0200
committerwm4 <wm4@nowhere>2013-08-24 19:40:18 +0200
commit47e92b2f884d4dd831e3e59ae9c692b460ef8dc3 (patch)
tree545d089a4a1be158c135fd43eaa33d4d93538925 /video/sws_utils.c
parentba4654b72977b915e5f09d23ce02e099c2bd9d0f (diff)
downloadmpv-47e92b2f884d4dd831e3e59ae9c692b460ef8dc3.tar.bz2
mpv-47e92b2f884d4dd831e3e59ae9c692b460ef8dc3.tar.xz
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.
Diffstat (limited to 'video/sws_utils.c')
-rw-r--r--video/sws_utils.c11
1 files changed, 8 insertions, 3 deletions
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);