summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-10 14:50:56 +0100
committerwm4 <wm4@nowhere>2015-03-10 14:50:56 +0100
commit574bd127ecadb6d7cbcad9aea2187b05a433dda1 (patch)
tree555391f837e0109322ae00fb47e45518b581334f
parenteff265c1400f6795e284d4e7c9054cf288d6c0cf (diff)
downloadmpv-574bd127ecadb6d7cbcad9aea2187b05a433dda1.tar.bz2
mpv-574bd127ecadb6d7cbcad9aea2187b05a433dda1.tar.xz
command: add display-fps property
Requested. Untested; leaving that to the users.
-rw-r--r--DOCS/man/input.rst7
-rw-r--r--player/command.c18
2 files changed, 24 insertions, 1 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 2ff994a604..ae5e017d4f 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1339,6 +1339,13 @@ Property list
Names of the displays that the mpv window covers. On X11, these
are the xrandr names (LVDS1, HDMI1, DP1, VGA1, etc.).
+``display-fps``
+ The refresh rate of the current display. Currently, this is the lowest FPS
+ of any display covered by the video, as retrieved by the underlying system
+ APIs (e.g. xrandr on X11). It is not the measured FPS or the FPS set with
+ ``--display-fps``. It's not necessarily available on all platforms. Note
+ that any of the listed facts may change any time without a warning.
+
``video-aspect`` (RW)
Video aspect, see ``--video-aspect``.
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"),
};