aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/parseutils.h
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-02-16 08:52:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-02-18 19:52:30 +0100
commit40c3fe2c0873feed2a345032205560c4a816271f (patch)
treec4054eef6adff2f29cfb232fa2358c8be480ce27 /libavutil/parseutils.h
parent0ebf475494837edd07fa6f58c540364795f9551c (diff)
downloadffmpeg-40c3fe2c0873feed2a345032205560c4a816271f.tar.gz
Deprecate parse_date() in favor of av_parse_time().
The new av_parse_time() is created in libavutil/parseutils.h, all the internal functions used by parse_date are moved to libavutil/parseutils.c and made static. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit f6c7375a175ac649558aefab14f3895b2cb469aa)
Diffstat (limited to 'libavutil/parseutils.h')
-rw-r--r--libavutil/parseutils.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
index 2c99872289..517f125a63 100644
--- a/libavutil/parseutils.h
+++ b/libavutil/parseutils.h
@@ -72,4 +72,38 @@ int av_parse_video_rate(AVRational *rate, const char *str);
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
void *log_ctx);
+/**
+ * Parses timestr and returns in *time a corresponding number of
+ * microseconds.
+ *
+ * @param timeval puts here the number of microseconds corresponding
+ * to the string in timestr. If the string represents a duration, it
+ * is the number of microseconds contained in the time interval. If
+ * the string is a date, is the number of microseconds since 1st of
+ * January, 1970 up to the time of the parsed date. If timestr cannot
+ * be successfully parsed, set *time to INT64_MIN.
+
+ * @param datestr a string representing a date or a duration.
+ * - If a date the syntax is:
+ * @code
+ * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z]
+ * now
+ * @endcode
+ * If the value is "now" it takes the current time.
+ * Time is local time unless Z is appended, in which case it is
+ * interpreted as UTC.
+ * If the year-month-day part is not specified it takes the current
+ * year-month-day.
+ * - If a duration the syntax is:
+ * @code
+ * [-]HH[:MM[:SS[.m...]]]
+ * [-]S+[.m...]
+ * @endcode
+ * @param duration flag which tells how to interpret timestr, if not
+ * zero timestr is interpreted as a duration, otherwise as a date
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code otherwise
+ */
+int av_parse_time(int64_t *timeval, const char *timestr, int duration);
+
#endif /* AVUTIL_PARSEUTILS_H */