[FFmpeg-devel] [PATCH] avformat/hls: add supporting EXT-X-DISCONTINUITY tag

Dongwon Kim dongwon00.kim at gmail.com
Fri Jul 17 04:09:22 EEST 2020


I modified setting AVFMT_TS_DISCONT flag on HLS input format depending on whether "EXT-X-DISCONTINUITY" existed or not in M3U8.
previous, commits are set "AVFMT_TS_DISCONT" flag unconditionally, whether "EXT-X-DISCONTINUITY" existed or not, as below
https://github.com/FFmpeg/FFmpeg/commit/d6ac6650b911f0957e69545d7fc25be6b7728705#diff-0e876d29bdcae30d9d256f04bc8795db

So, I added checking and parsing "EXT-X-DISCONTINUITY" syntax, and if only it exists then set AVFMT_TS_DISCONT flag.


On Fri, Jul 17, 2020 at 12:43:05AM +0000, Dongwon Kim wrote:
> Signed-off-by: Dongwon Kim <dongwon.kim at sk.com>
> ---
>  libavformat/hls.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c index ba17c4ed96..5e331ab68f 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -810,6 +810,8 @@ static int parse_playlist(HLSContext *c, const char *url,
>              ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,
>                                 &info);
>              new_rendition(c, &info, url);
> +        } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) {
> +            c->ctx->iformat->flags |= AVFMT_TS_DISCONT;
>          } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
>              ret = ensure_playlist(c, &pls, url);
>              if (ret < 0)
> @@ -2406,7 +2408,7 @@ AVInputFormat ff_hls_demuxer = {
>      .long_name      = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
>      .priv_class     = &hls_class,
>      .priv_data_size = sizeof(HLSContext),
> -    .flags          = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT,
> +    .flags          = AVFMT_NOGENSEARCH,
>      .read_probe     = hls_probe,
>      .read_header    = hls_read_header,
>      .read_packet    = hls_read_packet,
> --
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list