summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-20 09:46:15 +0100
committerwm4 <wm4@nowhere>2015-12-20 09:55:26 +0100
commit2da533bec362ea97db12ffe43173e374c7592254 (patch)
tree0fe7cb884dc416c25b4839d0d4360f5a808d5eac
parent127da1613ffa3cd3da5e8981e4a0acc08c5dd063 (diff)
downloadmpv-2da533bec362ea97db12ffe43173e374c7592254.tar.bz2
mpv-2da533bec362ea97db12ffe43173e374c7592254.tar.xz
vf_vapoursynth: fix everything
Broken by commit 0a0bb905. The changes to this filter were accidentally simply not tested, and it was obviously broken in a bunch of ways. Fixes #2616.
-rw-r--r--video/filter/vf_vapoursynth.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 57ffe4d535..5592e032e4 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -141,14 +141,8 @@ static void copy_mp_to_vs_frame_props_map(struct vf_priv_s *p, VSMap *map,
struct mp_image *img)
{
struct mp_image_params *params = &img->params;
- if (params->d_w > 0 && params->d_h > 0) {
- AVRational dar = {params->d_w, params->d_h};
- AVRational asp = {params->w, params->h};
- AVRational par = av_div_q(dar, asp);
-
- p->vsapi->propSetInt(map, "_SARNum", par.num, 0);
- p->vsapi->propSetInt(map, "_SARDen", par.den, 0);
- }
+ p->vsapi->propSetInt(map, "_SARNum", params->p_w, 0);
+ p->vsapi->propSetInt(map, "_SARDen", params->p_h, 0);
if (params->colorlevels) {
p->vsapi->propSetInt(map, "_ColorRange",
params->colorlevels == MP_CSP_LEVELS_TV, 0);
@@ -614,8 +608,11 @@ static int reinit_vs(struct vf_instance *vf)
if (p->vsapi->propSetNode(vars, "video_in", p->in_node, 0))
goto error;
- p->vsapi->propSetInt(vars, "video_in_dw", p->fmt_in.d_w, 0);
- p->vsapi->propSetInt(vars, "video_in_dh", p->fmt_in.d_h, 0);
+ int d_w, d_h;
+ mp_image_params_get_dsize(&p->fmt_in, &d_w, &d_h);
+
+ p->vsapi->propSetInt(vars, "video_in_dw", d_w, 0);
+ p->vsapi->propSetInt(vars, "video_in_dh", d_h, 0);
p->vsapi->propSetFloat(vars, "container_fps", vf->chain->container_fps, 0);
p->vsapi->propSetFloat(vars, "display_fps", vf->chain->display_fps, 0);
@@ -653,14 +650,17 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
{
struct vf_priv_s *p = vf->priv;
+ *out = *in;
p->fmt_in = *in;
if (reinit_vs(vf) < 0)
return -1;
const VSVideoInfo *vi = p->vsapi->getVideoInfo(p->out_node);
- fmt = mp_from_vs(vi->format->id);
- if (!fmt) {
+ out->w = vi->width;
+ out->h = vi->height;
+ out->imgfmt = mp_from_vs(vi->format->id);
+ if (!out->imgfmt) {
MP_FATAL(vf, "Unsupported output format.\n");
destroy_vs(vf);
return -1;
@@ -673,9 +673,6 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
return -1;
}
- *out = *in;
- out->w = vi->width;
- out->h = vi->height;
return 0;
}
@@ -720,8 +717,7 @@ static int vf_open(vf_instance_t *vf)
pthread_mutex_init(&p->lock, NULL);
pthread_cond_init(&p->wakeup, NULL);
- vf->reconfig = NULL;
- vf->config = config;
+ vf->reconfig = reconfig;
vf->filter_ext = filter_ext;
vf->filter_out = filter_out;
vf->needs_input = needs_input;