summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-15 23:33:33 +0200
committerwm4 <wm4@nowhere>2014-08-15 23:33:33 +0200
commit543ba6c114303c8c3a71b37864f6d901c41808eb (patch)
tree3735649107f6df38de3adaf9081ecb672546c7a3 /player/command.c
parent22a95290126398c1f416dbadaf596ba79c872996 (diff)
downloadmpv-543ba6c114303c8c3a71b37864f6d901c41808eb.tar.bz2
mpv-543ba6c114303c8c3a71b37864f6d901c41808eb.tar.xz
video: add VO framedropping mode
This mostly uses the same idea as with vo_vdpau.c, but much simplified. On X11, it tries to get the display framerate with XF86VM, and limits the frequency of new video frames against it. Note that this is an old extension, and is confirmed not to work correctly with multi-monitor setups. But we're using it because it was already around (it is also used by vo_vdpau). This attempts to predict the next vsync event by using the time of the last frame and the display FPS. Even if that goes completely wrong, the results are still relatively good. On other systems, or if the X11 code doesn't return a display FPS, a framerate of 1000 is assumed. This is infinite for all practical purposes, and means that only frames which are definitely too late are dropped. This probably has worse results, but is still useful. "--framedrop=yes" is basically replaced with "--framedrop=decoder". The old framedropping mode is kept around, and should perhaps be improved. Dropping on the decoder level is still useful if decoding itself is too slow.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index c0800d612d..9ca2ce8812 100644
--- a/player/command.c
+++ b/player/command.c
@@ -386,6 +386,16 @@ static int mp_property_drop_frame_cnt(void *ctx, struct m_property *prop,
return m_property_int_ro(action, arg, mpctx->drop_frame_cnt);
}
+static int mp_property_vo_drop_frame_count(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (!mpctx->d_video)
+ return M_PROPERTY_UNAVAILABLE;
+
+ return m_property_int_ro(action, arg, vo_get_drop_count(mpctx->video_out));
+}
+
/// Current position in percent (RW)
static int mp_property_percent_pos(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -2686,6 +2696,7 @@ static const struct m_property mp_properties[] = {
{"avsync", mp_property_avsync},
{"total-avsync-change", mp_property_total_avsync_change},
{"drop-frame-count", mp_property_drop_frame_cnt},
+ {"vo-drop-frame-count", mp_property_vo_drop_frame_count},
{"percent-pos", mp_property_percent_pos},
{"time-start", mp_property_time_start},
{"time-pos", mp_property_time_pos},