aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Cosoleto <cosoleto@gmail.com>2009-02-08 22:03:54 +0000
committerRobert Swain <robert.swain@gmail.com>2009-02-08 22:03:54 +0000
commitced06bd8fe152e00aaa5552480a606287844fc65 (patch)
tree350d0b546eb6fe151b4193da1ad600f5a2fef5d5
parentf9e5b9420ea6355b4ae466eb155f6f2abd929393 (diff)
downloadffmpeg-ced06bd8fe152e00aaa5552480a606287844fc65.tar.gz
Add the ability to set the timestamp to the current time by specifying 'now'
as the time Patch by Francesco Cosoleto ( cosoleto gmail com ) Originally committed as revision 17076 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c2
-rw-r--r--libavformat/utils.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index db0eafd8f0..3817050c9b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3769,7 +3769,7 @@ static const OptionDef options[] = {
{ "itsoffset", OPT_FUNC2 | HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
{ "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
{ "title", HAS_ARG | OPT_STRING, {(void*)&str_title}, "set the title", "string" },
- { "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)&opt_rec_timestamp}, "set the timestamp", "time" },
+ { "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)&opt_rec_timestamp}, "set the timestamp ('now' to set the current time)", "time" },
{ "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" },
{ "copyright", HAS_ARG | OPT_STRING, {(void*)&str_copyright}, "set the copyright", "string" },
{ "comment", HAS_ARG | OPT_STRING, {(void*)&str_comment}, "set the comment", "string" },
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4f098d9344..417a7e35e8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2908,6 +2908,9 @@ int64_t parse_date(const char *datestr, int duration)
p = datestr;
q = NULL;
if (!duration) {
+ if (!strncasecmp(datestr, "now", len))
+ return (int64_t) now * 1000000;
+
/* parse the year-month-day part */
for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
q = small_strptime(p, date_fmt[i], &dt);