diff mbox series

[FFmpeg-devel,v2,2/4] avformat/hls: relay programs to child muxers

Message ID 20230209105519.1814-2-ffmpeg@gyani.pro
State New
Headers show
Series [FFmpeg-devel,v2,1/4] avformat: add av_program_copy() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Gyan Doshi Feb. 9, 2023, 10:55 a.m. UTC
---
 libavformat/hlsenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andreas Rheinhardt Feb. 16, 2023, 6:57 a.m. UTC | #1
Gyan Doshi:
> ---
>  libavformat/hlsenc.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 39df9becc7..0b66efad3e 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -907,6 +907,12 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
>          st->id = vs->streams[i]->id;
>      }
>  
> +    for (i = 0; i < s->nb_programs; i++) {
> +        ret = av_program_copy(oc, s, s->programs[i]->id, 0);
> +        if (ret < 0)
> +            av_log(s, AV_LOG_WARNING, "unable to transfer program %d to child muxer\n", s->programs[i]->id);
> +    }
> +
>      vs->start_pos = 0;
>      vs->new_start = 1;
>  

You intent to add this loop (including the error message) three times;
once is enough.

- Andreas
Gyan Doshi Feb. 16, 2023, 8 a.m. UTC | #2
On 2023-02-16 12:27 pm, Andreas Rheinhardt wrote:
> Gyan Doshi:
>> ---
>>   libavformat/hlsenc.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 39df9becc7..0b66efad3e 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -907,6 +907,12 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
>>           st->id = vs->streams[i]->id;
>>       }
>>   
>> +    for (i = 0; i < s->nb_programs; i++) {
>> +        ret = av_program_copy(oc, s, s->programs[i]->id, 0);
>> +        if (ret < 0)
>> +            av_log(s, AV_LOG_WARNING, "unable to transfer program %d to child muxer\n", s->programs[i]->id);
>> +    }
>> +
>>       vs->start_pos = 0;
>>       vs->new_start = 1;
>>   
> You intent to add this loop (including the error message) three times;
> once is enough.

Don't quite follow. You want me to break upon failure?

Regards,
Gyan
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 39df9becc7..0b66efad3e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -907,6 +907,12 @@  static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
         st->id = vs->streams[i]->id;
     }
 
+    for (i = 0; i < s->nb_programs; i++) {
+        ret = av_program_copy(oc, s, s->programs[i]->id, 0);
+        if (ret < 0)
+            av_log(s, AV_LOG_WARNING, "unable to transfer program %d to child muxer\n", s->programs[i]->id);
+    }
+
     vs->start_pos = 0;
     vs->new_start = 1;