[FFmpeg-devel] [PATCH] lavu/parseutils: accept hours>=24 for durations.
Michael Niedermayer
michaelni at gmx.at
Sat Dec 1 16:17:28 CET 2012
On Sat, Dec 01, 2012 at 04:04:22PM +0100, Nicolas George wrote:
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavutil/parseutils.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> index a335978..a3d5434 100644
> --- a/libavutil/parseutils.c
> +++ b/libavutil/parseutils.c
> @@ -436,7 +436,8 @@ static int date_get_num(const char **pp,
> return val;
> }
>
> -char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
> +static char *av_small_strptime_int(const char *p, const char *fmt,
> + struct tm *dt, int hour_max)
> {
> int c, val;
>
> @@ -454,7 +455,7 @@ 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);
> + val = date_get_num(&p, 0, hour_max, 2);
> if (val == -1)
> return NULL;
> dt->tm_hour = val;
> @@ -503,6 +504,11 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
> }
> }
>
> +char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
> +{
> + return av_small_strptime_int(p, fmt, dt, 23);
> +}
If we want to add extensions to our strptime then this can be done
cleanly through new %X fields, libcs do that too.
No need for a new function
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121201/3a50dda0/attachment.asc>
More information about the ffmpeg-devel
mailing list