[FFmpeg-devel] [PATCH 2/2] avformat/dashenc, hlsenc: Return 0 on succes from write_header

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Mar 5 12:28:35 EET 2024


Do not propagate the return value of avformat_write_header(),
as it contains the information whether the output had
already been initialized in avformat_init_output(),
but this is set generically; the return value of
FFOutputFormat.write_header is not documented at all
(and is currently ignored if >= 0), but it is more future-proof
to simply return 0 on success.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/dashenc.c | 2 +-
 libavformat/hlsenc.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 435a5e8afe..5e31b09486 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1747,7 +1747,7 @@ static int dash_write_header(AVFormatContext *s)
             (ret = flush_init_segment(s, os)) < 0)
             return ret;
     }
-    return ret;
+    return 0;
 }
 
 static int add_segment(OutputStream *os, const char *file,
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index d5cd627e59..e560aa6a20 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2372,7 +2372,7 @@ static int hls_write_header(AVFormatContext *s)
         }
     }
 
-    return ret;
+    return 0;
 }
 
 static int hls_init_file_resend(AVFormatContext *s, VariantStream *vs)
-- 
2.40.1



More information about the ffmpeg-devel mailing list