From f6c7375a175ac649558aefab14f3895b2cb469aa Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 16 Feb 2011 08:52:36 +0000 Subject: 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 --- libavutil/parseutils.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'libavutil/parseutils.h') 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 */ -- cgit v1.2.3