aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2007-09-19 12:38:07 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2007-09-19 12:38:07 +0000
commitf94361612a69bea8afb4dde4c17a98f8fd915244 (patch)
tree47731875dd54268671016b5c5387e5a2ae425580 /ffmpeg.c
parent4ec45764a09b78e556e10cd65f2d2f5a57900990 (diff)
downloadffmpeg-f94361612a69bea8afb4dde4c17a98f8fd915244.tar.gz
Make parse_date return INT64_MIN in case of unparsable input.
Patch by Stefano Sabatini: [stefano sabatini-lala poste it] Original thread: [FFmpeg-devel] [PATCH] Enhace documentation forlibavformat/utils.c:parse_date Date: 08/17/2007 09:40 PM Originally committed as revision 10533 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 905c3427f7..0687780610 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2491,24 +2491,35 @@ static void opt_map_meta_data(const char *arg)
m->in_file = strtol(p, (char **)&p, 0);
}
+static int64_t parse_time_or_die(const char *timestr, int is_duration)
+{
+ int64_t us = parse_date(timestr, is_duration);
+ if (us == INT64_MIN) {
+ fprintf(stderr, "Invalid %s specification: %s\n",
+ is_duration ? "duration" : "date", timestr);
+ exit(1);
+ }
+ return us;
+}
+
static void opt_recording_time(const char *arg)
{
- recording_time = parse_date(arg, 1);
+ recording_time = parse_time_or_die(arg, 1);
}
static void opt_start_time(const char *arg)
{
- start_time = parse_date(arg, 1);
+ start_time = parse_time_or_die(arg, 1);
}
static void opt_rec_timestamp(const char *arg)
{
- rec_timestamp = parse_date(arg, 0) / 1000000;
+ rec_timestamp = parse_time_or_die(arg, 0) / 1000000;
}
static void opt_input_ts_offset(const char *arg)
{
- input_ts_offset = parse_date(arg, 1);
+ input_ts_offset = parse_time_or_die(arg, 1);
}
static enum CodecID find_codec_or_die(const char *name, int type, int encoder)