summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2017-02-25 11:23:50 +0800
committerSteven Liu <lq@chinaffmpeg.org>2017-02-25 11:23:50 +0800
commit3aef2fceff3205605aed19f8a81b56db56496631 (patch)
tree35820dd0e2eaff15db0737542f32f45967499afa /libavformat
parentf73ef3748e837d220771d1186f4f5abb8f551123 (diff)
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: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hlsenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 023870534f..9cf621125c 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1027,7 +1027,8 @@ static const char * get_default_pattern_localtime_fmt(void)
struct tm *p, tmbuf;
p = localtime_r(&t, &tmbuf);
// 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)