summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-03 15:17:13 +0200
committerwm4 <wm4@nowhere>2014-05-03 15:17:13 +0200
commitbc07c86da56d02cb36f7271d233d69cce5bb7113 (patch)
treeb6fe4bec43e2709258f06baf94eef942680a6c24 /video
parent4bd9bdf5c904f6e79877f5de39b97bf809d7032d (diff)
downloadmpv-bc07c86da56d02cb36f7271d233d69cce5bb7113.tar.bz2
mpv-bc07c86da56d02cb36f7271d233d69cce5bb7113.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vapoursynth.c10
1 files changed, 8 insertions, 2 deletions
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 <VSScript.h>
#include <VSHelper.h>
+#include <libavutil/rational.h>
+
#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",