summaryrefslogtreecommitdiffstats
path: root/video/zimg.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-31 15:18:57 +0100
committerwm4 <wm4@nowhere>2019-10-31 15:26:03 +0100
commit835586513d026bcf1e7dec4693e07c28dda8cedd (patch)
treef96ce1fe2e8a474906ae09e9c9146d6e88030fd4 /video/zimg.c
parentc10ba5eb8e62d04ed80cad512cf4863dadee07f1 (diff)
downloadmpv-835586513d026bcf1e7dec4693e07c28dda8cedd.tar.bz2
mpv-835586513d026bcf1e7dec4693e07c28dda8cedd.tar.xz
sws_utils: shuffle around some shit
Purpose uncertain. I guess it's slightly better, maybe. The move of the sws/zimg options from VO opts (vo_opt_list) to the top-level option list is tricky. VO opts have some helper code in vo.c, that sends VOCTRL_SET_PANSCAN to the VO on every VO opts change. That's because updating certain VO options used to be this way (and not just the panscan option). This isn't needed anymore for sws/zimg options, so explicitly move them away.
Diffstat (limited to 'video/zimg.c')
-rw-r--r--video/zimg.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/video/zimg.c b/video/zimg.c
index 9b4aa0cbaa..7ea60531e1 100644
--- a/video/zimg.c
+++ b/video/zimg.c
@@ -85,14 +85,14 @@ struct mp_zimg_repack {
struct mp_image *mpi;
};
-void mp_zimg_set_from_cmdline(struct mp_zimg_context *ctx, struct mpv_global *g)
+static void mp_zimg_update_from_cmdline(struct mp_zimg_context *ctx)
{
- struct zimg_opts *opts = mp_get_config_group(NULL, g, &zimg_conf);
+ m_config_cache_update(ctx->opts_cache);
+
+ struct zimg_opts *opts = ctx->opts_cache->opts;
ctx->scaler = opts->scaler;
ctx->fast = opts->fast;
-
- talloc_free(opts);
}
static zimg_chroma_location_e mp_to_z_chroma(enum mp_chroma_location cl)
@@ -194,6 +194,17 @@ struct mp_zimg_context *mp_zimg_alloc(void)
return ctx;
}
+void mp_zimg_enable_cmdline_opts(struct mp_zimg_context *ctx,
+ struct mpv_global *g)
+{
+ if (ctx->opts_cache)
+ return;
+
+ ctx->opts_cache = m_config_cache_alloc(ctx, g, &zimg_conf);
+ destroy_zimg(ctx); // force update
+ mp_zimg_update_from_cmdline(ctx); // first update
+}
+
static void copy_rect(struct mp_image *dst, unsigned dst_mask,
struct mp_image *src, unsigned src_mask,
unsigned i, unsigned x0, unsigned x1)
@@ -538,6 +549,9 @@ bool mp_zimg_config(struct mp_zimg_context *ctx)
{
destroy_zimg(ctx);
+ if (ctx->opts_cache)
+ mp_zimg_update_from_cmdline(ctx);
+
ctx->zimg_src = talloc_zero(NULL, struct mp_zimg_repack);
ctx->zimg_src->pack = false;
ctx->zimg_src->fmt = ctx->src;
@@ -605,6 +619,7 @@ bool mp_zimg_config_image_params(struct mp_zimg_context *ctx)
{
if (ctx->zimg_src && mp_image_params_equal(&ctx->src, &ctx->zimg_src->fmt) &&
ctx->zimg_dst && mp_image_params_equal(&ctx->dst, &ctx->zimg_dst->fmt) &&
+ (!ctx->opts_cache || !m_config_cache_update(ctx->opts_cache)) &&
ctx->zimg_graph)
return true;
return mp_zimg_config(ctx);