avformat/hlsenc: add warning for append_list and hls_init_time option
authorSteven Liu <lingjiujianke@gmail.com>
Tue, 30 Aug 2016 09:26:54 +0000 (17:26 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 31 Aug 2016 00:48:39 +0000 (02:48 +0200)
When use append_list mode, the hls_init_time set nouse,
Because the append_list only support append at the old m3u8 end
cannot set init segments durations at the middle of the list.
That's invalid. and show a warning message for user.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/hlsenc.c

index ab4a9bf..81b7efa 100644 (file)
@@ -812,6 +812,12 @@ static int hls_write_header(AVFormatContext *s)
 
     if (hls->flags & HLS_APPEND_LIST) {
         parse_playlist(s, s->filename);
+        if (hls->init_time > 0) {
+            av_log(s, AV_LOG_WARNING, "append_list mode does not support hls_init_time,"
+                   " hls_init_time value will have no effect\n");
+            hls->init_time = 0;
+            hls->recording_time = hls->time * AV_TIME_BASE;
+        }
     }
 
     if ((ret = hls_start(s)) < 0)