Fixes Ticket4495
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -40,6 +40,7 @@ |
40 | 40 |
#include "libavutil/parseutils.h" |
41 | 41 |
#include "libavutil/pixdesc.h" |
42 | 42 |
#include "libavutil/pixfmt.h" |
43 |
+#include "libavutil/time_internal.h" |
|
43 | 44 |
|
44 | 45 |
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\ |
45 | 46 |
{\ |
... | ... |
@@ -2237,6 +2238,7 @@ loop_end: |
2237 | 2237 |
char type, *val; |
2238 | 2238 |
const char *stream_spec; |
2239 | 2239 |
int index = 0, j, ret = 0; |
2240 |
+ char now_time[256]; |
|
2240 | 2241 |
|
2241 | 2242 |
val = strchr(o->metadata[i].u.str, '='); |
2242 | 2243 |
if (!val) { |
... | ... |
@@ -2246,6 +2248,17 @@ loop_end: |
2246 | 2246 |
} |
2247 | 2247 |
*val++ = 0; |
2248 | 2248 |
|
2249 |
+ if (!strcmp(o->metadata[i].u.str, "creation_time") && |
|
2250 |
+ !strcmp(val, "now")) { |
|
2251 |
+ time_t now = time(0); |
|
2252 |
+ struct tm *ptm, tmbuf; |
|
2253 |
+ ptm = localtime_r(&now, &tmbuf); |
|
2254 |
+ if (ptm) { |
|
2255 |
+ if (strftime(now_time, sizeof(now_time), "%Y-%m-%d %H:%M:%S", ptm)) |
|
2256 |
+ val = now_time; |
|
2257 |
+ } |
|
2258 |
+ } |
|
2259 |
+ |
|
2249 | 2260 |
parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec); |
2250 | 2261 |
if (type == 's') { |
2251 | 2262 |
for (j = 0; j < oc->nb_streams; j++) { |