diff options
author | Dudemanguy <random342@airmail.cc> | 2023-08-10 20:15:04 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-08-13 19:58:20 +0000 |
commit | a177fb6188e735da3536109105ec55a51b3b863c (patch) | |
tree | 3e0951b5e031056b16db31d942ee461d980293ea /video | |
parent | c62b45ec2ab020dad04a95aff3c85aab631b1f32 (diff) | |
download | mpv-a177fb6188e735da3536109105ec55a51b3b863c.tar.bz2 mpv-a177fb6188e735da3536109105ec55a51b3b863c.tar.xz |
vf_vapoursynth: save display resolution as a variable
mpv has a generic method for getting the display resolution, so we can
save it in vf_vapoursynth without too much trouble. Unfortunately, the
resolution won't actually be available in many cases (like my own)
because the windowing backend doesn't actually know it yet. It looks
like at least windows always returns the default monitor (maybe we
should do something similar for x11 and wayland), so there's at least
some value. Of course, this still has a bunch of pitfalls like not being
able to cope with multi monitor setups at all but so does display_fps.
As an aside, the vapoursynth API this uses apparently requires R26 (an
ancient version anyway), so bump the build to compensate for this.
Fixes #11510
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/vf_vapoursynth.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c index 953b46f274..861c4457bd 100644 --- a/video/filter/vf_vapoursynth.c +++ b/video/filter/vf_vapoursynth.c @@ -666,12 +666,20 @@ static int reinit_vs(struct priv *p, struct mp_image *input) struct mp_stream_info *info = mp_filter_find_stream_info(p->f); double container_fps = input->nominal_fps; double display_fps = 0; + int64_t display_res[2] = {0}; if (info) { if (info->get_display_fps) display_fps = info->get_display_fps(info); + if (info->get_display_res) { + int tmp[2] = {0}; + info->get_display_res(info, tmp); + display_res[0] = tmp[0]; + display_res[1] = tmp[1]; + } } p->vsapi->propSetFloat(vars, "container_fps", container_fps, 0); p->vsapi->propSetFloat(vars, "display_fps", display_fps, 0); + p->vsapi->propSetIntArray(vars, "display_res", display_res, 2); if (p->drv->load(p, vars) < 0) goto error; |