From 00f8ee573ba3ff75f3591137b68faf563affb343 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 13 Sep 2016 01:17:10 +0000 Subject: player: Apply new sub-speed values during playback --- DOCS/interface-changes.rst | 1 + player/command.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 5f30a9bb8c..c4b9d8d18d 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -20,6 +20,7 @@ Interface changes :: --- mpv 0.21.0 --- + - implement changing sub-speed during playback - deprecate _all_ --vo and --ao suboptions. Generally, all suboptions are replaced by global options, which do exactly the same. For example, "--vo=opengl:scale=nearest" turns into "--scale=nearest". In some cases, diff --git a/player/command.c b/player/command.c index 152e232d62..6e30489954 100644 --- a/player/command.c +++ b/player/command.c @@ -2942,6 +2942,26 @@ static int mp_property_sub_delay(void *ctx, struct m_property *prop, return property_osd_helper(mpctx, prop, action, arg); } +/// Subtitle speed (RW) +static int mp_property_sub_speed(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + struct MPOpts *opts = mpctx->opts; + switch (action) { + case M_PROPERTY_SET: { + opts->sub_speed = *(float *)arg; + struct track *track = mpctx->current_track[0][STREAM_SUB]; + struct dec_sub *sub = track ? track->d_sub : NULL; + if (sub) { + sub_control(track->d_sub, SD_CTRL_UPDATE_SPEED, NULL); + } + return M_PROPERTY_OK; + } + } + return property_osd_helper(mpctx, prop, action, arg); +} + static int mp_property_sub_pos(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3836,6 +3856,7 @@ static const struct m_property mp_properties_base[] = { {"sid", mp_property_sub}, {"secondary-sid", mp_property_sub2}, {"sub-delay", mp_property_sub_delay}, + {"sub-speed", mp_property_sub_speed}, {"sub-pos", mp_property_sub_pos}, {"sub-text", mp_property_sub_text}, {"sub-visibility", property_osd_helper}, -- cgit v1.2.3