diff mbox

[FFmpeg-devel] avformat/hlsenc: save the EXT-X-DISCONTINUITY from old list

Message ID 20161205234754.14668-1-lq@chinaffmpeg.org
State Accepted
Commit 6b95da9af91cd912561aa25593d6a41caa071963
Headers show

Commit Message

Steven Liu Dec. 5, 2016, 11:47 p.m. UTC
when use fix ticket 2nd problem.

command line test step:
rm -rf output*;./ffmpeg  -i ~/Movies/objectC/facebook.mp4 -an -c:v copy
-f hls -hls_time 4 -hls_list_size 5 -hls_flags +delete_segments
-hls_flags +append_list -hls_flags +omit_endlist -hls_flags
+discont_start -t 50 output.m3u8
./ffmpeg -i ~/Movies/objectC/facebook.mp4 -an -c:v libx264 -g 4 -f hls
-hls_time 4 -hls_list_size 5 -hls_flags +delete_segments -hls_flags
+append_list -hls_flags +omit_endlist -hls_flags +discont_start -t 5
output.m3u8
./ffmpeg -i ~/Movies/objectC/facebook.mp4 -an -c:v libx264 -g 4 -f hls
-hls_time 4 -hls_list_size 5 -hls_flags +delete_segments -hls_flags
+append_list -hls_flags +omit_endlist -hls_flags +discont_start -t 5
output.m3u8

result:
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:5
 #EXT-X-MEDIA-SEQUENCE:6
 #EXTINF:4.120000,
 output6.ts
 #EXT-X-DISCONTINUITY
 #EXTINF:4.000000,
 output7.ts
 #EXTINF:0.960000,
 output8.ts
 #EXT-X-DISCONTINUITY
 #EXTINF:4.000000,
 output9.ts
 #EXTINF:0.960000,
 output10.ts

Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Steven Liu Dec. 6, 2016, 11:46 p.m. UTC | #1
2016-12-06 7:47 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:

> when use fix ticket 2nd problem.
>
> command line test step:
> rm -rf output*;./ffmpeg  -i ~/Movies/objectC/facebook.mp4 -an -c:v copy
> -f hls -hls_time 4 -hls_list_size 5 -hls_flags +delete_segments
> -hls_flags +append_list -hls_flags +omit_endlist -hls_flags
> +discont_start -t 50 output.m3u8
> ./ffmpeg -i ~/Movies/objectC/facebook.mp4 -an -c:v libx264 -g 4 -f hls
> -hls_time 4 -hls_list_size 5 -hls_flags +delete_segments -hls_flags
> +append_list -hls_flags +omit_endlist -hls_flags +discont_start -t 5
> output.m3u8
> ./ffmpeg -i ~/Movies/objectC/facebook.mp4 -an -c:v libx264 -g 4 -f hls
> -hls_time 4 -hls_list_size 5 -hls_flags +delete_segments -hls_flags
> +append_list -hls_flags +omit_endlist -hls_flags +discont_start -t 5
> output.m3u8
>
> result:
>  #EXTM3U
>  #EXT-X-VERSION:3
>  #EXT-X-TARGETDURATION:5
>  #EXT-X-MEDIA-SEQUENCE:6
>  #EXTINF:4.120000,
>  output6.ts
>  #EXT-X-DISCONTINUITY
>  #EXTINF:4.000000,
>  output7.ts
>  #EXTINF:0.960000,
>  output8.ts
>  #EXT-X-DISCONTINUITY
>  #EXTINF:4.000000,
>  output9.ts
>  #EXTINF:0.960000,
>  output10.ts
>
> Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 0e55a31..acf3a30 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -459,6 +459,9 @@ static int parse_playlist(AVFormatContext *s, const
> char *url)
>          read_chomp_line(in, line, sizeof(line));
>          if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
>              hls->sequence = atoi(ptr);
> +        } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) {
> +            is_segment = 1;
> +            hls->discontinuity = 1;
>          } else if (av_strstart(line, "#EXTINF:", &ptr)) {
>              is_segment = 1;
>              hls->duration = atof(ptr);
> --
> 1.7.1
>
>
Applied!




Thanks
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 0e55a31..acf3a30 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -459,6 +459,9 @@  static int parse_playlist(AVFormatContext *s, const char *url)
         read_chomp_line(in, line, sizeof(line));
         if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
             hls->sequence = atoi(ptr);
+        } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) {
+            is_segment = 1;
+            hls->discontinuity = 1;
         } else if (av_strstart(line, "#EXTINF:", &ptr)) {
             is_segment = 1;
             hls->duration = atof(ptr);