Anton Khirnov <an...@khirnov.net> writes:

> It's an XSI extension, not available on some supported systems.
> ---
>  configure            |    2 ++
>  libavformat/dvenc.c  |    5 +++++
>  libavformat/gxfenc.c |    5 +++++
>  libavformat/movenc.c |    5 +++++
>  libavformat/mxfenc.c |    5 +++++
>  5 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 02bcd09..596b603 100755
> --- a/configure
> +++ b/configure
> @@ -1105,6 +1105,7 @@ HAVE_LIST="
>      poll_h
>      setrlimit
>      strerror_r
> +    strptime
>      strtok_r
>      struct_addrinfo
>      struct_ipv6_mreq
> @@ -2775,6 +2776,7 @@ check_func  mmap
>  check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
>  check_func  setrlimit
>  check_func  strerror_r
> +check_func  strptime
>  check_func  strtok_r
>  check_func_headers io.h setmode
>  check_func_headers lzo/lzo1x.h lzo1x_999_compress

configure parts OK

> diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
> index 1e59bd9..d419248 100644
> --- a/libavformat/dvenc.c
> +++ b/libavformat/dvenc.c
> @@ -344,9 +344,14 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s)
>      else
>  #endif
>      if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
> +#if HAVE_STRPTIME
>          struct tm time = {0};
>          strptime(t->value, "%Y - %m - %dT%T", &time);
>          c->start_time = mktime(&time);
> +#else
> +        av_log(s, AV_LOG_WARNING, "Strptime unavailable on this system, 
> cannot write "
> +                                  "creation timestamp.\n");
> +#endif

Two things:

- Do not capitalise strptime (or any other function names).
- This #if block is repeated several times.  It would make sense turning
  it into a function.

-- 
Måns Rullgård
m...@mansr.com
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to