From 574bd127ecadb6d7cbcad9aea2187b05a433dda1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Mar 2015 14:50:56 +0100 Subject: command: add display-fps property Requested. Untested; leaving that to the users. --- player/command.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index ebc0024faf..1d872eacb7 100644 --- a/player/command.c +++ b/player/command.c @@ -2600,6 +2600,21 @@ static int mp_property_win_minimized(void *ctx, struct m_property *prop, return m_property_flag_ro(action, arg, state & VO_WIN_STATE_MINIMIZED); } +static int mp_property_display_fps(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + struct vo *vo = mpctx->video_out; + if (!vo) + return M_PROPERTY_UNAVAILABLE; + + double fps = 0; + if (vo_control(vo, VOCTRL_GET_DISPLAY_FPS, &fps) < 1 || fps <= 0) + return M_PROPERTY_UNAVAILABLE; + + return m_property_double_ro(action, arg, fps); +} + static int mp_property_display_names(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3507,6 +3522,7 @@ static const struct m_property mp_properties[] = { {"window-minimized", mp_property_win_minimized}, {"display-names", mp_property_display_names}, + {"display-fps", mp_property_display_fps}, {"mpv-version", mp_property_version}, {"mpv-configuration", mp_property_configuration}, @@ -3550,7 +3566,7 @@ static const char *const *const mp_event_property_change[] = { E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle", "demuxer-cache-duration", "demuxer-cache-idle", "paused-for-cache"), E(MP_EVENT_WIN_RESIZE, "window-scale"), - E(MP_EVENT_WIN_STATE, "window-minimized", "display-names"), + E(MP_EVENT_WIN_STATE, "window-minimized", "display-names", "display-fps"), E(MP_EVENT_AUDIO_DEVICES, "audio-device-list"), E(MP_EVENT_DETECTED_AUDIO_DEVICE, "audio-out-detected-device"), }; -- cgit v1.2.3