Commit 3aef2fce authored by Hendrik Leppkes's avatar Hendrik Leppkes Committed by Steven Liu

avformat/hlsenc: don't use %s for strftime on msvc

MSVC doesn't support the %s time format, and instead of returning an
error the invalid parameter handler is invoked which (by default)
terminates the process.

Reviewed-by:Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parent f73ef374
...@@ -1027,7 +1027,8 @@ static const char * get_default_pattern_localtime_fmt(void) ...@@ -1027,7 +1027,8 @@ static const char * get_default_pattern_localtime_fmt(void)
struct tm *p, tmbuf; struct tm *p, tmbuf;
p = localtime_r(&t, &tmbuf); p = localtime_r(&t, &tmbuf);
// no %s support when strftime returned error or left format string unchanged // no %s support when strftime returned error or left format string unchanged
return (!strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; // also no %s support on MSVC, which invokes the invalid parameter handler on unsupported format strings, instead of returning an error
return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts";
} }
static int hls_write_header(AVFormatContext *s) static int hls_write_header(AVFormatContext *s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment