summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-25 20:32:29 +0100
committerwm4 <wm4@nowhere>2013-09-15 02:51:19 +0200
commitaa43405020e2e710b8b431633b6750e92897c6b9 (patch)
treee3de3c8dd988e14d8a77fc9adada81821780d417 /mpvcore
parent58cff195e7d17b348d9ddf5e472420063a9717cc (diff)
downloadmpv-aa43405020e2e710b8b431633b6750e92897c6b9.tar.bz2
mpv-aa43405020e2e710b8b431633b6750e92897c6b9.tar.xz
screenshot: make it possible to format playback time in various ways
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/screenshot.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mpvcore/screenshot.c b/mpvcore/screenshot.c
index b7697e913b..0afa88182b 100644
--- a/mpvcore/screenshot.c
+++ b/mpvcore/screenshot.c
@@ -186,6 +186,23 @@ static char *create_fname(struct MPContext *mpctx, char *template,
talloc_free(t);
break;
}
+ case 'w': {
+ if (template[0] != '{')
+ 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));
+ if (!s)
+ goto error_exit;
+ append_filename(&res, s);
+ talloc_free(s);
+ talloc_free(fmt);
+ template = end + 1;
+ break;
+ }
case 't': {
char tfmt = *template;
if (!tfmt)