From bc07c86da56d02cb36f7271d233d69cce5bb7113 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 3 May 2014 15:17:13 +0200 Subject: vf_vapoursynth: fix aspect ratio passed to vapoursynth This was recently either changed or clarified in vapoursynth. Pass the aspect ratio as pixel aspect to VS. --- video/filter/vf_vapoursynth.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c index 4b9b879c9b..9ec9ae9e2a 100644 --- a/video/filter/vf_vapoursynth.c +++ b/video/filter/vf_vapoursynth.c @@ -26,6 +26,8 @@ #include #include +#include + #include "common/msg.h" #include "options/m_option.h" @@ -111,8 +113,12 @@ static void copy_mp_to_vs_frame_props(struct vf_priv_s *p, VSMap *map, { struct mp_image_params *params = &img->params; if (params->d_w > 0 && params->d_h > 0) { - p->vsapi->propSetInt(map, "_SARNum", params->d_w, 0); - p->vsapi->propSetInt(map, "_SARDen", 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); } if (params->colorlevels) { p->vsapi->propSetInt(map, "_ColorRange", -- cgit v1.2.3