[FFmpeg-devel] [PATCH 2/2] avformat/movenc: remove useless if and reindent

Marton Balint cus at passwd.hu
Sun May 29 17:17:14 CEST 2016


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/movenc.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index fbb659d..f9dffc2 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5734,11 +5734,9 @@ static int mov_write_trailer(AVFormatContext *s)
             av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n");
             if ((res = shift_data(s)) < 0)
                 goto error;
-            if (res == 0) {
-                avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
-                if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
-                    goto error;
-            }
+            avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
+            if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
+                goto error;
         } else if (mov->reserved_moov_size > 0) {
             int64_t size;
             if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
@@ -5763,16 +5761,15 @@ static int mov_write_trailer(AVFormatContext *s)
         for (i = 0; i < mov->nb_streams; i++)
            mov->tracks[i].data_offset = 0;
         if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
+            int64_t end;
             av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
             if ((res = shift_data(s)) < 0)
                 goto error;
-            if (res == 0) {
-                int64_t end = avio_tell(pb);
-                avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
-                mov_write_sidx_tags(pb, mov, -1, 0);
-                avio_seek(pb, end, SEEK_SET);
-                mov_write_mfra_tag(pb, mov);
-            }
+            end = avio_tell(pb);
+            avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
+            mov_write_sidx_tags(pb, mov, -1, 0);
+            avio_seek(pb, end, SEEK_SET);
+            mov_write_mfra_tag(pb, mov);
         } else {
             mov_write_mfra_tag(pb, mov);
         }
-- 
2.6.6



More information about the ffmpeg-devel mailing list