diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-02-16 08:52:36 +0000 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-02-16 23:39:56 +0000 |
commit | f6c7375a175ac649558aefab14f3895b2cb469aa (patch) | |
tree | 759bc4cc9757e5d1d9ab5d0cb661c96862d87737 /libavutil/parseutils.h | |
parent | 610219a598095f938705f200dfe3946455ef871a (diff) | |
download | ffmpeg-f6c7375a175ac649558aefab14f3895b2cb469aa.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>
Diffstat (limited to 'libavutil/parseutils.h')
-rw-r--r-- | libavutil/parseutils.h | 34 |
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 */ |