[FFmpeg-cvslog] avformat/movenc: remove one level of indentation

James Almer git at videolan.org
Tue Apr 23 18:53:34 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Apr 23 12:46:49 2024 -0300| [ce33a5f16d7aebe18394c4f158a020da36055a23] | committer: James Almer

avformat/movenc: remove one level of indentation

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavformat/movenc.c | 57 ++++++++++++++++++++++++----------------------------
 1 file changed, 26 insertions(+), 31 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1a0502bbb1..e9bbfd67cf 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6672,6 +6672,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s,
 #if CONFIG_IAMFENC
 static int mov_build_iamf_packet(AVFormatContext *s, MOVTrack *trk, AVPacket *pkt)
 {
+    uint8_t *data;
     int ret;
 
     if (pkt->stream_index == trk->first_iamf_idx) {
@@ -6685,40 +6686,34 @@ static int mov_build_iamf_packet(AVFormatContext *s, MOVTrack *trk, AVPacket *pk
     if (ret < 0)
         return ret;
 
-    if (pkt->stream_index == trk->last_iamf_idx) {
-        uint8_t *data;
-
-        ret = avio_close_dyn_buf(trk->iamf_buf, &data);
-        trk->iamf_buf = NULL;
-
-        if (!ret) {
-            if (pkt->size) {
-                // Either all or none of the packets for a single
-                // IA Sample may be empty.
-                av_log(s, AV_LOG_ERROR, "Unexpected packet from "
-                                        "stream #%d\n", pkt->stream_index);
-                ret = AVERROR_INVALIDDATA;
-            }
-            av_free(data);
-            return ret;
-        }
-        av_buffer_unref(&pkt->buf);
-        pkt->buf = av_buffer_create(data, ret, NULL, NULL, 0);
-        if (!pkt->buf) {
-            av_free(data);
-            return AVERROR(ENOMEM);
+    if (pkt->stream_index != trk->last_iamf_idx)
+        return AVERROR(EAGAIN);
+
+    ret = avio_close_dyn_buf(trk->iamf_buf, &data);
+    trk->iamf_buf = NULL;
+    if (!ret) {
+        if (pkt->size) {
+            // Either all or none of the packets for a single
+            // IA Sample may be empty.
+            av_log(s, AV_LOG_ERROR, "Unexpected packet from "
+                                     "stream #%d\n", pkt->stream_index);
+            ret = AVERROR_INVALIDDATA;
         }
-        pkt->data = data;
-        pkt->size = ret;
-        pkt->stream_index = trk->first_iamf_idx;
+        av_free(data);
+        return ret;
+    }
 
-        ret = avio_open_dyn_buf(&trk->iamf_buf);
-        if (ret < 0)
-            return ret;
-    } else
-        ret = AVERROR(EAGAIN);
+    av_buffer_unref(&pkt->buf);
+    pkt->buf = av_buffer_create(data, ret, NULL, NULL, 0);
+    if (!pkt->buf) {
+        av_free(data);
+        return AVERROR(ENOMEM);
+    }
+    pkt->data = data;
+    pkt->size = ret;
+    pkt->stream_index = trk->first_iamf_idx;
 
-    return ret;
+    return avio_open_dyn_buf(&trk->iamf_buf);
 }
 #endif
 



More information about the ffmpeg-cvslog mailing list