mirror of
https://github.com/mpv-player/mpv
synced 2025-02-02 21:21:33 +00:00
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.
This commit is contained in:
parent
127da1613f
commit
2da533bec3
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user