From 534b08e6ba924f96dfb9edc4a564d7596db35574 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 18 Nov 2014 21:33:15 +0100 Subject: command: add an ab_loop command As suggested in #1241; to make using the feature easier. Also add better OSD-formatting for the ab-loop-a/b properties. --- player/command.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'player') diff --git a/player/command.c b/player/command.c index 0041364c8d..0559221322 100644 --- a/player/command.c +++ b/player/command.c @@ -3527,6 +3527,8 @@ static const struct property_osd_display { { "tv-hue", "Hue", .osd_progbar = OSD_HUE}, { "tv-saturation", "Saturation", .osd_progbar = OSD_SATURATION }, { "tv-contrast", "Contrast", .osd_progbar = OSD_CONTRAST }, + { "ab-loop-a", "A-B loop point A"}, + { "ab-loop-b", "A-B loop point B"}, // By default, don't display the following properties on OSD { "pause", NULL }, { "fullscreen", NULL }, @@ -4420,6 +4422,24 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_nav_user_input(mpctx, cmd->args[0].v.s); break; + case MP_CMD_AB_LOOP: { + double now = get_current_time(mpctx); + int r = 0; + if (opts->ab_loop[0] == MP_NOPTS_VALUE) { + r = mp_property_do("ab-loop-a", M_PROPERTY_SET, &now, mpctx); + show_property_osd(mpctx, "ab-loop-a", on_osd); + } else if (opts->ab_loop[1] == MP_NOPTS_VALUE) { + r = mp_property_do("ab-loop-b", M_PROPERTY_SET, &now, mpctx); + show_property_osd(mpctx, "ab-loop-b", on_osd); + } else { + now = MP_NOPTS_VALUE; + r = mp_property_do("ab-loop-a", M_PROPERTY_SET, &now, mpctx); + r = mp_property_do("ab-loop-b", M_PROPERTY_SET, &now, mpctx); + set_osd_msg(mpctx, osdl, osd_duration, "Clear A-B loop"); + } + return r > 0; + } + case MP_CMD_VO_CMDLINE: if (mpctx->video_out) { char *s = cmd->args[0].v.s; -- cgit v1.2.3