summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-16 20:10:05 +0100
committerwm4 <wm4@nowhere>2012-11-16 21:21:16 +0100
commit4e8e7d91ddbea584fb42e0d1049e16c5957392b1 (patch)
treed5926964461704f69fcd0d5e12cef061da52e94a /core
parent7a1396b6ca73d5db194dcc6cebc5ad92e9b22c89 (diff)
downloadmpv-4e8e7d91ddbea584fb42e0d1049e16c5957392b1.tar.bz2
mpv-4e8e7d91ddbea584fb42e0d1049e16c5957392b1.tar.xz
command: export A/V sync difference as "avsync" property
This is the same as on the status line after the "A-V: ".
Diffstat (limited to 'core')
-rw-r--r--core/command.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/command.c b/core/command.c
index a9cba1800c..2346a9e821 100644
--- a/core/command.c
+++ b/core/command.c
@@ -285,6 +285,14 @@ static int mp_property_length(m_option_t *prop, int action, void *arg,
return m_property_double_ro(prop, action, arg, len);
}
+static int mp_property_avsync(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ if (!mpctx->sh_audio || !mpctx->sh_video)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_double_ro(prop, action, arg, mpctx->last_av_difference);
+}
+
/// Current position in percent (RW)
static int mp_property_percent_pos(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
@@ -1383,6 +1391,7 @@ static const m_option_t mp_properties[] = {
M_OPT_MIN, 0, 0, NULL },
{ "length", mp_property_length, CONF_TYPE_TIME,
M_OPT_MIN, 0, 0, NULL },
+ { "avsync", mp_property_avsync, CONF_TYPE_DOUBLE },
{ "percent-pos", mp_property_percent_pos, CONF_TYPE_INT,
M_OPT_RANGE, 0, 100, NULL },
{ "time-pos", mp_property_time_pos, CONF_TYPE_TIME,