[FFmpeg-devel] [PATCH 3/3] parseutils: add av_parse_time() test.

Stefano Sabatini stefasab at gmail.com
Mon Apr 23 00:40:21 CEST 2012


On date Tuesday 2012-04-17 12:41:04 +0200, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavutil/parseutils.c    |   51 ++++++++++++++++++++++++++++++++++++++++++++-
>  tests/ref/fate/parseutils |   12 ++++++++++
>  2 files changed, 62 insertions(+), 1 deletions(-)
[...]
> +Testing av_parse_time()
> +(now is 2012-03-17 09:14:13 +0100, local time is UTC+1)
> +now                      ->     1331972053.000000 = 2012-03-17T08:14:13Z
> +12:35:46                 ->     1331984146.000000 = 2012-03-17T11:35:46Z
> +2000-12-20 0:02:47.5z    ->      977270567.500000 = 2000-12-20T00:02:47Z
> +2000-12-20T010247.6      ->      977270567.600000 = 2000-12-20T00:02:47Z
> +2:34:56.79               ->           +9296790000
> +-1:23:45.67              ->           -5025670000
> +42.1729                  ->             +42172900
> +-1729.42                 ->           -1729420000

> +12:34                    -> error

According to docs:
 * - If a duration the syntax is:
 * @code
 * [-]HH[:MM[:SS[.m...]]]
 * [-]S+[.m...]

which is ambiguous since 42 may mean either 42 hours or 42
seconds. You may interpret 12:34 like 12 hours and 34 minutes because
of the presence of ":", in each case the documentation should be fixed
(not in this patch of course).

(BTW I have a pending patch for extending the syntax so that may be
written as "12h34m", which is a bit more readable/less ambiguous).
-- 
FFmpeg = Fostering and Frightening Most Powerful Evil Guru


More information about the ffmpeg-devel mailing list