diff mbox

[FFmpeg-devel] avformat/hlsenc: remove duplicate operation at hls_write_header

Message ID 20181212073924.85962-1-lq@chinaffmpeg.org
State Accepted
Commit cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b
Headers show

Commit Message

Liu Steven Dec. 12, 2018, 7:39 a.m. UTC
the options have set when avformat_init_output at hls_mux_init

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Liu Steven Dec. 24, 2018, 5:28 a.m. UTC | #1
> 在 2018年12月12日,下午3:39,Steven Liu <lq@chinaffmpeg.org> 写道:
> 
> the options have set when avformat_init_output at hls_mux_init
> 
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
> libavformat/hlsenc.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index bdd2a113bd..03a32b65d8 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -787,7 +787,7 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
> 
>        av_dict_copy(&options, hls->format_options, 0);
>        av_dict_set(&options, "fflags", "-autobsf", 0);
> -        av_dict_set(&options, "movflags", "frag_custom+dash+delay_moov", 0);
> +        av_dict_set(&options, "movflags", "+frag_custom+dash+delay_moov", AV_DICT_APPEND);
>        ret = avformat_init_output(oc, &options);
>        if (ret < 0)
>            return ret;
> @@ -2079,15 +2079,9 @@ static int hls_write_header(AVFormatContext *s)
>    for (i = 0; i < hls->nb_varstreams; i++) {
>        vs = &hls->var_streams[i];
> 
> -        av_dict_copy(&options, hls->format_options, 0);
> -        ret = avformat_write_header(vs->avf, &options);
> -        if (av_dict_count(options)) {
> -            av_log(s, AV_LOG_ERROR, "Some of provided format options in '%s' are not recognized\n", hls->format_options_str);
> -            ret = AVERROR(EINVAL);
> -            av_dict_free(&options);
> -            goto fail;
> -        }
> -        av_dict_free(&options);
> +        ret = avformat_write_header(vs->avf, NULL);
> +        if (ret < 0)
> +            return ret;
>        //av_assert0(s->nb_streams == hls->avf->nb_streams);
>        for (j = 0; j < vs->nb_streams; j++) {
>            AVStream *inner_st;
> -- 
> 2.15.2 (Apple Git-101.1)

pushed


Thanks
>
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index bdd2a113bd..03a32b65d8 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -787,7 +787,7 @@  static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
 
         av_dict_copy(&options, hls->format_options, 0);
         av_dict_set(&options, "fflags", "-autobsf", 0);
-        av_dict_set(&options, "movflags", "frag_custom+dash+delay_moov", 0);
+        av_dict_set(&options, "movflags", "+frag_custom+dash+delay_moov", AV_DICT_APPEND);
         ret = avformat_init_output(oc, &options);
         if (ret < 0)
             return ret;
@@ -2079,15 +2079,9 @@  static int hls_write_header(AVFormatContext *s)
     for (i = 0; i < hls->nb_varstreams; i++) {
         vs = &hls->var_streams[i];
 
-        av_dict_copy(&options, hls->format_options, 0);
-        ret = avformat_write_header(vs->avf, &options);
-        if (av_dict_count(options)) {
-            av_log(s, AV_LOG_ERROR, "Some of provided format options in '%s' are not recognized\n", hls->format_options_str);
-            ret = AVERROR(EINVAL);
-            av_dict_free(&options);
-            goto fail;
-        }
-        av_dict_free(&options);
+        ret = avformat_write_header(vs->avf, NULL);
+        if (ret < 0)
+            return ret;
         //av_assert0(s->nb_streams == hls->avf->nb_streams);
         for (j = 0; j < vs->nb_streams; j++) {
             AVStream *inner_st;