[FFmpeg-cvslog] fftools/ffmpeg_mux_init: move allocation out of prologue

Anton Khirnov git at videolan.org
Sat Jul 15 12:02:50 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jul 12 16:22:43 2023 +0200| [38a2fc2c291efd3f0e09941c5c0a43805a9b2cd2] | committer: Anton Khirnov

fftools/ffmpeg_mux_init: move allocation out of prologue

ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38a2fc2c291efd3f0e09941c5c0a43805a9b2cd2
---

 fftools/ffmpeg_mux_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 8e640610cd..bd4c0a9f97 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -987,13 +987,14 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o,
     MuxStream     *ms;
     OutputStream *ost;
     const AVCodec *enc;
-    AVStream *st = avformat_new_stream(oc, NULL);
+    AVStream *st;
     int ret = 0;
     const char *bsfs = NULL, *time_base = NULL;
     char *filters = NULL, *next, *codec_tag = NULL;
     double qscale = -1;
     int i;
 
+    st = avformat_new_stream(oc, NULL);
     if (!st)
         report_and_exit(AVERROR(ENOMEM));
 



More information about the ffmpeg-cvslog mailing list