diff options
author | wm4 <wm4@nowhere> | 2013-05-15 02:17:47 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-07 18:00:34 +0200 |
commit | c185b0ba4a09eab1bf969e40acc660454921f460 (patch) | |
tree | cd90cd1c42b897cfa48b084488d9e93b061535b2 /core/input | |
parent | b15143b7e0df6d9f6d0dc072e89d1c86d41f52d4 (diff) | |
download | mpv-c185b0ba4a09eab1bf969e40acc660454921f460.tar.bz2 mpv-c185b0ba4a09eab1bf969e40acc660454921f460.tar.xz |
command: replace some show_ commands with properties
show_chapters, show_tracks, and show_playlist are killed and replaced
with the properties chapter-list, track-list, and playlist. The code
and the output of these stays the same, this is just moving a lot of
code around and reducing the number of properties.
The "old" commands will still be supported for a while (to avoid making
everyone angry), so handle them with the legacy layer. Add something to
suppress printing the legacy warnings for these commands.
Diffstat (limited to 'core/input')
-rw-r--r-- | core/input/input.c | 29 | ||||
-rw-r--r-- | core/input/input.h | 4 |
2 files changed, 15 insertions, 18 deletions
diff --git a/core/input/input.c b/core/input/input.c index 8bc877ce79..2d7569c8e9 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -204,10 +204,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_VF, "vf", { ARG_STRING, ARG_STRING } }, - { MP_CMD_SHOW_CHAPTERS, "show_chapters", }, - { MP_CMD_SHOW_TRACKS, "show_tracks", }, - { MP_CMD_SHOW_PLAYLIST, "show_playlist", }, - { MP_CMD_VO_CMDLINE, "vo_cmdline", { ARG_STRING } }, {0} @@ -258,8 +254,12 @@ static const struct legacy_cmd legacy_cmds[] = { {"osd_show_text", "show_text"}, {"osd_show_property_text", "show_text"}, {"osd_show_progression", "show_progress"}, - {"show_chapters_osd", "show_chapters"}, - {"show_tracks_osd", "show_tracks"}, + {"show_chapters_osd", "show_text ${chapter-list}"}, + {"!show_chapters", "show_text ${chapter-list}"}, + {"show_tracks_osd", "show_text ${track-list}"}, + {"!show_tracks", "show_text ${track-list}"}, + {"!show_playlist", "show_text ${playlist}"}, + // Approximate (can fail if user added additional whitespace) {"pt_step 1", "playlist_next"}, {"pt_step -1", "playlist_prev"}, @@ -826,14 +826,15 @@ mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc) str = bstr_lstrip(str); for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) { - size_t old_len = strlen(entry->old); - if (bstrcasecmp(bstr_splice(str, 0, old_len), - (bstr) {(char *)entry->old, old_len}) == 0) - { - mp_tmsg(MSGT_INPUT, MSGL_WARN, "Warning: command '%s' is " - "deprecated, replaced with '%s' at %s.\n", - entry->old, entry->new, loc); - bstr s = bstr_cut(str, old_len); + bstr old = bstr0(entry->old); + bool silent = bstr_eatstart0(&old, "!"); + if (bstrcasecmp(bstr_splice(str, 0, old.len), old) == 0) { + if (!silent) { + mp_tmsg(MSGT_INPUT, MSGL_WARN, "Warning: command '%.*s' is " + "deprecated, replaced with '%s' at %s.\n", + BSTR_P(old), entry->new, loc); + } + bstr s = bstr_cut(str, old.len); str = bstr0(talloc_asprintf(tmp, "%s%.*s", entry->new, BSTR_P(s))); start = str; break; diff --git a/core/input/input.h b/core/input/input.h index 944debd847..b9bc295646 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -81,10 +81,6 @@ enum mp_command_type { /// Video filter commands MP_CMD_VF, - MP_CMD_SHOW_CHAPTERS, - MP_CMD_SHOW_TRACKS, - MP_CMD_SHOW_PLAYLIST, - /// Video output commands MP_CMD_VO_CMDLINE, }; |