Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-21 05:52:08 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-06-21 05:57:20 +0300
commit54649cbda890b54dad0e76ae8886cb291be58a03 (patch)
tree35f288ffdc4b6026dd764c4dd1170720f38230e7
parentf98c3ec5c68d14d7c93c2f9775be4583f7905554 (diff)
ffmpeg_opt: Fix handling of creation_time now
Fixes Ticket4495 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffmpeg_opt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 69222dea7e..a74640560b 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -40,6 +40,7 @@
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
+#include "libavutil/time_internal.h"
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
@@ -2237,6 +2238,7 @@ loop_end:
char type, *val;
const char *stream_spec;
int index = 0, j, ret = 0;
+ char now_time[256];
val = strchr(o->metadata[i].u.str, '=');
if (!val) {
@@ -2246,6 +2248,17 @@ loop_end:
}
*val++ = 0;
+ if (!strcmp(o->metadata[i].u.str, "creation_time") &&
+ !strcmp(val, "now")) {
+ time_t now = time(0);
+ struct tm *ptm, tmbuf;
+ ptm = localtime_r(&now, &tmbuf);
+ if (ptm) {
+ if (strftime(now_time, sizeof(now_time), "%Y-%m-%d %H:%M:%S", ptm))
+ val = now_time;
+ }
+ }
+
parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
if (type == 's') {
for (j = 0; j < oc->nb_streams; j++) {