diff options
author | wm4 <wm4@nowhere> | 2013-09-15 19:07:35 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-15 19:07:35 +0200 |
commit | 9aa206a90efcb6c2f21e460a6c5fcfdcc3b9f841 (patch) | |
tree | f9df02bec97ac18d8068f15320ef1fee0a8ba4d7 /mpvcore | |
parent | 884c179177063ad81cf7a7242c01767f46cd1cf8 (diff) | |
download | mpv-9aa206a90efcb6c2f21e460a6c5fcfdcc3b9f841.tar.bz2 mpv-9aa206a90efcb6c2f21e460a6c5fcfdcc3b9f841.tar.xz |
screenshot: change %w format to be more like %t
Instead of containing a format string within %w{...}, simply allow %w
to specify one item of a time format string. This is simpler, more like
other format specifiers (%t), and probably easier to use too.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/screenshot.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mpvcore/screenshot.c b/mpvcore/screenshot.c index 0afa88182b..161bfac1e5 100644 --- a/mpvcore/screenshot.c +++ b/mpvcore/screenshot.c @@ -187,20 +187,16 @@ static char *create_fname(struct MPContext *mpctx, char *template, break; } case 'w': { - if (template[0] != '{') + char tfmt = *template; + if (!tfmt) goto error_exit; template++; - char *end = strchr(template, '}'); - if (!end) - goto error_exit; - char *fmt = talloc_strndup(res, template, end - template); - char *s = mp_format_time_fmt(fmt, get_current_time(mpctx)); + char fmtstr[] = {'%', tfmt, '\0'}; + char *s = mp_format_time_fmt(fmtstr, get_current_time(mpctx)); if (!s) goto error_exit; append_filename(&res, s); talloc_free(s); - talloc_free(fmt); - template = end + 1; break; } case 't': { |