[FFmpeg-devel] [PATCH] lavu/parseutils: accept %h for hours >= 24.
Stefano Sabatini
stefasab at gmail.com
Sat Dec 1 18:10:48 CET 2012
On date Saturday 2012-12-01 17:00:32 +0100, Nicolas George encoded:
> Allow to parse durations >= 24:00:00.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavutil/parseutils.c | 5 +++--
> libavutil/parseutils.h | 2 ++
> libavutil/version.h | 2 +-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
>
> This is the other suggested solution, but I must say I prefer the other one
> (adding an argument to the internal implementation of strptime) by far.
>
> Does anyone else have an opinion?
I like this one because it provides more functionality, the other one
was possibly simpler but was also introducing another level of
indirection.
>
>
> diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> index a335978..2a23262 100644
> --- a/libavutil/parseutils.c
> +++ b/libavutil/parseutils.c
> @@ -454,7 +454,8 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
> c = *fmt++;
> switch(c) {
> case 'H':
> - val = date_get_num(&p, 0, 23, 2);
> + case 'h':
> + val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
Same consideration as Michael, %h is already taken by the standard
strptime. After checking the man strptime manpage, we have:
f g* i k l o q r s* u* v z* E F* G* J K L N O P Q V* Z*
where "*" marks the GNU extensions, %i or %J may be good candidates.
[...]
Looks good otherwise.
--
FFmpeg = Frenzy Formidable Marvellous Pitiless Exxagerate Guru
More information about the ffmpeg-devel
mailing list