>From 15952b6cb38ac2f532a2f35d50e9dc4f8320c1c5 Mon Sep 17 00:00:00 2001 From: Matthijs Tempels <matth...@townsville.nl> Date: Wed, 28 Jan 2015 13:59:54 +0100 Subject: [PATCH] Added the %t option to the filename pattern to add a yyyyMMdd_HHmmssfff pattern to the filename
--- libavformat/utils.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index f6df49b..b57136a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3805,11 +3805,13 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) { const char *p; char *q, buf1[20], c; - int nd, len, percentd_found; + int nd, len, percentd_found, percentt_found; + struct timeval tv; q = buf; p = path; percentd_found = 0; + percentt_found = 0; for (;;) { c = *p++; if (c == '\0') @@ -3836,6 +3838,20 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) memcpy(q, buf1, len); q += len; break; + case 't': + if (percentt_found) + goto fail; + percentt_found = 1; + gettimeofday(&tv, NULL); + int milli = tv.tv_usec / 1000; + strftime(buf1, sizeof(buf1), "%Y%m%d_%H%M%S", localtime(&tv.tv_sec)); + sprintf(buf1, "%s%03d", buf1, milli); + len = strlen(buf1); + if ((q - buf + len) > buf_size - 1) + goto fail; + memcpy(q, buf1, len); + q += len; + break; default: goto fail; } -- 2.1.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel