You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
ffmpeg_opt: Fix handling of creation_time now
Fixes Ticket4495 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
13
ffmpeg_opt.c
13
ffmpeg_opt.c
@@ -40,6 +40,7 @@
|
|||||||
#include "libavutil/parseutils.h"
|
#include "libavutil/parseutils.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "libavutil/pixfmt.h"
|
#include "libavutil/pixfmt.h"
|
||||||
|
#include "libavutil/time_internal.h"
|
||||||
|
|
||||||
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
|
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
|
||||||
{\
|
{\
|
||||||
@@ -2237,6 +2238,7 @@ loop_end:
|
|||||||
char type, *val;
|
char type, *val;
|
||||||
const char *stream_spec;
|
const char *stream_spec;
|
||||||
int index = 0, j, ret = 0;
|
int index = 0, j, ret = 0;
|
||||||
|
char now_time[256];
|
||||||
|
|
||||||
val = strchr(o->metadata[i].u.str, '=');
|
val = strchr(o->metadata[i].u.str, '=');
|
||||||
if (!val) {
|
if (!val) {
|
||||||
@@ -2246,6 +2248,17 @@ loop_end:
|
|||||||
}
|
}
|
||||||
*val++ = 0;
|
*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);
|
parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
|
||||||
if (type == 's') {
|
if (type == 's') {
|
||||||
for (j = 0; j < oc->nb_streams; j++) {
|
for (j = 0; j < oc->nb_streams; j++) {
|
||||||
|
Reference in New Issue
Block a user