diff options
-rw-r--r-- | DOCS/man/vf.rst | 6 | ||||
-rw-r--r-- | filters/f_output_chain.c | 8 | ||||
-rw-r--r-- | filters/filter.h | 1 | ||||
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | video/filter/vf_vapoursynth.c | 8 |
5 files changed, 25 insertions, 2 deletions
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index f6842490cd..bd3254e557 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -583,6 +583,12 @@ Available mpv-only filters are: ``display_fps`` Refresh rate of the current display. Note that this value can be 0. + ``display_res`` + Resolution of the current display. This is an integer array with the + first entry corresponding to the width and the second entry coresponding + to the height. These values can be 0. Note that this will not respond to + monitor changes and may not work on all platforms. + ``vavpp`` VA-API video post processing. Requires the system to support VA-API, i.e. Linux/BSD only. Works with ``--vo=vaapi`` and ``--vo=gpu`` only. diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c index de01c954d7..b9ee7060cc 100644 --- a/filters/f_output_chain.c +++ b/filters/f_output_chain.c @@ -357,6 +357,13 @@ static double get_display_fps(struct mp_stream_info *i) return res; } +static void get_display_res(struct mp_stream_info *i, int *res) +{ + struct chain *p = i->priv; + if (p->vo) + vo_control(p->vo, VOCTRL_GET_DISPLAY_RES, res); +} + void mp_output_chain_set_vo(struct mp_output_chain *c, struct vo *vo) { struct chain *p = c->f->priv; @@ -617,6 +624,7 @@ static void create_video_things(struct chain *p) p->stream_info.priv = p; p->stream_info.get_display_fps = get_display_fps; + p->stream_info.get_display_res = get_display_res; p->f->stream_info = &p->stream_info; diff --git a/filters/filter.h b/filters/filter.h index 35a4afac83..8820199a42 100644 --- a/filters/filter.h +++ b/filters/filter.h @@ -398,6 +398,7 @@ struct mp_stream_info { void *priv; // for use by whoever implements the callbacks double (*get_display_fps)(struct mp_stream_info *i); + void (*get_display_res)(struct mp_stream_info *i, int *res); struct mp_hwdec_devices *hwdec_devs; struct osd_state *osd; diff --git a/meson.build b/meson.build index c49ee8f739..cbeec06d64 100644 --- a/meson.build +++ b/meson.build @@ -747,8 +747,8 @@ if features['uchardet'] dependencies += uchardet endif -vapoursynth = dependency('vapoursynth', version: '>= 24', required: get_option('vapoursynth')) -vapoursynth_script = dependency('vapoursynth-script', version: '>= 23', +vapoursynth = dependency('vapoursynth', version: '>= 26', required: get_option('vapoursynth')) +vapoursynth_script = dependency('vapoursynth-script', version: '>= 26', required: get_option('vapoursynth')) features += {'vapoursynth': vapoursynth.found() and vapoursynth_script.found()} if features['vapoursynth'] 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; |