[FFmpeg-devel] [PATCH] Allow MM:SS format for duration

Clément Bœsch ubitux at gmail.com
Thu Feb 21 21:29:59 CET 2013


On Fri, Feb 22, 2013 at 01:55:14AM +0530, Senthilnathan Maadasamy wrote:
> On Wed, Feb 20, 2013 at 8:24 PM, Stefano Sabatini <stefasab at gmail.com>wrote:
> 
> > On date Wednesday 2013-02-20 09:57:58 +0530, Senthilnathan Maadasamy
> > encoded:
> > > Fixes ticket 2258
> > >          if (!q) {
> > > +            /* parse timestr as MM:SS */
> > > +            q = av_small_strptime(p, "%M:%S", &dt);
> > > +            dt.tm_hour = 0;
> > > +        }
> > > +        if (!q) {
> > >              /* parse timestr as S+ */
> >
> > Looks reasonable.
> >
> > Please also update documenation in doc/syntax.texi and in the function
> > doxy.
> >
> 
> Updated patch below:
> 
> Signed-off-by: Senthilnathan M <senthilnathan.maadasamy at gmail.com>
> ---
>  doc/syntax.texi        |    2 +-
>  libavutil/parseutils.c |    5 +++++
>  libavutil/parseutils.h |    2 +-
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/syntax.texi b/doc/syntax.texi
> index 4dddc3c..af93c90 100644
> --- a/doc/syntax.texi
> +++ b/doc/syntax.texi
> @@ -98,7 +98,7 @@ year-month-day.
> 
>  The accepted syntax is:
>  @example
> -[-]HH:MM:SS[.m...]
> +[-][HH]:MM:SS[.m...]
>  [-]S+[.m...]
>  @end example
> 

The ':' are supposed to be part of the [ ] scope AFAICT.

> diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> index 73e400a..c67f971 100644
> --- a/libavutil/parseutils.c
> +++ b/libavutil/parseutils.c
> @@ -588,6 +588,11 @@ int av_parse_time(int64_t *timeval, const char
> *timestr, int duration)
>          /* parse timestr as HH:MM:SS */
>          q = av_small_strptime(p, "%J:%M:%S", &dt);
>          if (!q) {
> +            /* parse timestr as MM:SS */
> +            q = av_small_strptime(p, "%M:%S", &dt);
> +            dt.tm_hour = 0;
> +        }
> +        if (!q) {
>              /* parse timestr as S+ */
>              dt.tm_sec = strtol(p, (void *)&q, 10);
>              if (q == p) /* the parsing didn't succeed */
> diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
> index 1f56a7a..b2cde51 100644
> --- a/libavutil/parseutils.h
> +++ b/libavutil/parseutils.h
> @@ -122,7 +122,7 @@ int av_parse_color(uint8_t *rgba_color, const char
> *color_string, int slen,
>   * year-month-day.
>   * - If a duration the syntax is:
>   * @code
> - * [-]HH:MM:SS[.m...]]]
> + * [-][HH]:MM:SS[.m...]]]

Ditto.

>   * [-]S+[.m...]
>   * @endcode
>   * @param duration flag which tells how to interpret timestr, if not

BTW, using git format-patch is simpler for the commiter (since it contains
the commit message, authorship etc. and can be applied and pushed
directly.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130221/698c4b15/attachment.asc>


More information about the ffmpeg-devel mailing list