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

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Jul 17 04:39:54 EEST 2020


κΉ€λ™μ›λ‹˜(Dongwon Kim):
> 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
> 
You are modifying the AVInputFormat, not the AVFormatContext. The former
is shared among all AVFormatContexts for hls demuxing and it is actually
meant to be const (and may become const at the next major bump).

- Andreas


More information about the ffmpeg-devel mailing list