mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 02:09:52 +00:00
command: make display-fps property writable
Has the same function as setting the option. This commit changes the property in a bunch of other ways. For example if the VO is not created, it will return the option value.
This commit is contained in:
parent
11888a9270
commit
8baf773d0e
@ -1452,7 +1452,7 @@ Property list
|
|||||||
Names of the displays that the mpv window covers. On X11, these
|
Names of the displays that the mpv window covers. On X11, these
|
||||||
are the xrandr names (LVDS1, HDMI1, DP1, VGA1, etc.).
|
are the xrandr names (LVDS1, HDMI1, DP1, VGA1, etc.).
|
||||||
|
|
||||||
``display-fps``
|
``display-fps`` (RW)
|
||||||
The refresh rate of the current display. Currently, this is the lowest 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
|
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. It's not necessarily
|
APIs (e.g. xrandr on X11). It is not the measured FPS. It's not necessarily
|
||||||
|
@ -2574,14 +2574,16 @@ static int mp_property_display_fps(void *ctx, struct m_property *prop,
|
|||||||
int action, void *arg)
|
int action, void *arg)
|
||||||
{
|
{
|
||||||
MPContext *mpctx = ctx;
|
MPContext *mpctx = ctx;
|
||||||
|
double fps = mpctx->opts->frame_drop_fps;
|
||||||
struct vo *vo = mpctx->video_out;
|
struct vo *vo = mpctx->video_out;
|
||||||
if (!vo)
|
if (vo)
|
||||||
return M_PROPERTY_UNAVAILABLE;
|
fps = vo_get_display_fps(vo);
|
||||||
|
if (action == M_PROPERTY_SET) {
|
||||||
double fps = vo_get_display_fps(vo);
|
int ret = mp_property_generic_option(mpctx, prop, action, arg);
|
||||||
if (fps < 1)
|
if (vo)
|
||||||
return M_PROPERTY_UNAVAILABLE;
|
vo_event(vo, VO_EVENT_WIN_STATE);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return m_property_double_ro(action, arg, fps);
|
return m_property_double_ro(action, arg, fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user