2016-12-31 19:16 GMT+08:00 Bodecs Bela <bode...@vivanet.hu>: > > > 2016.12.31. 11:48 keltezéssel, Steven Liu írta: > >> 2016-12-31 1:24 GMT+08:00 Bodecs Bela <bode...@vivanet.hu>: >> >> 2016.12.30. 18:11 keltezéssel, Moritz Barsnick írta: >>> >>> On Fri, Dec 30, 2016 at 15:38:25 +0100, Bodecs Bela wrote: >>>> >>>> is not available on all system/environment. This patch checks %s >>>>> availabilty at runtine and alter the default format string if >>>>> necessary. >>>>> >>>>> You forgot to add the patch. >>>> >>>> please, forgive me. I attached it now. >>> >>> >>> Moritz >>>> _______________________________________________ >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> Bela >>> >>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> Signed-off-by: Bela Bodecs <bode...@vivanet.hu> >>> >> --- >> libavformat/hlsenc.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >> index c9d8e3c..76b85e8 100644 >> --- a/libavformat/hlsenc.c >> +++ b/libavformat/hlsenc.c >> @@ -829,13 +829,22 @@ fail: >> return err; >> } >> >> +static const char * get_default_pattern_localtime_fmt(void) >> +{ >> + char b[21]; >> + time_t t = time(NULL); >> + struct tm *p, tmbuf; >> + p = localtime_r(&t, &tmbuf); >> + return (strftime(b, sizeof(b), "%s", p) > 2) ? "-%s.ts" : >> "-%Y%m%d%H%I%S.ts"; >> Why check strftime result bigger than 2,not 1 not 3? >> > I have faced different strftime behaviours on two different environments > where unknown specifier was in format string. > On one of them strftime returned 0, this was the expected return value by > me. > But on the other one, strftime returned 2 and put unknown specifier (%s) > as is into the result buffer. > So >2 will handle each cases. In normal behaviour, nowadays, length of > seconds string will be always longer than 2. > Should I put a comment about it into the code?
Maybe add a comment for the value 2 is better. > > > +} >> + >> static int hls_write_header(AVFormatContext *s) >> { >> HLSContext *hls = s->priv_data; >> int ret, i; >> char *p; >> const char *pattern = "%d.ts"; >> - const char *pattern_localtime_fmt = "-%s.ts"; >> + const char *pattern_localtime_fmt = >> get_default_pattern_localtime_fmt(); >> const char *vtt_pattern = "%d.vtt"; >> AVDictionary *options = NULL; >> int basename_size; >> > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel