diff mbox series

[FFmpeg-devel,08/10] avformat/nutenc: Cosmetics

Message ID 20200504182250.26141-8-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/10] libavformat/nutenc: Remove redundant function parameter | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 4, 2020, 6:22 p.m. UTC
Mainly reindentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/nutenc.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

Comments

Michael Niedermayer Nov. 8, 2020, 11:39 p.m. UTC | #1
On Mon, May 04, 2020 at 08:22:48PM +0200, Andreas Rheinhardt wrote:
> Mainly reindentation.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/nutenc.c | 42 ++++++++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 20 deletions(-)

probably ok

[...]
diff mbox series

Patch

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index ab44214efd..5735055d19 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -332,7 +332,7 @@  static void put_str(AVIOContext *bc, const char *string)
 }
 
 static int put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc,
-                       const uint8_t *prelude, int prelude_size, uint64_t startcode)
+                      const uint8_t *prelude, int prelude_size, uint64_t startcode)
 {
     uint8_t *dyn_buf = NULL;
     int dyn_size     = dyn_bc ? avio_get_dyn_buf(dyn_bc, &dyn_buf) : 0;
@@ -583,7 +583,8 @@  static void write_chapter(NUTContext *nut, AVIOContext *bc, int id,
     *prelude_size = ptr - prelude;
 }
 
-static int write_index(NUTContext *nut, AVIOContext *bc) {
+static int write_index(NUTContext *nut, AVIOContext *bc)
+{
     int i;
     Syncpoint dummy= { .pos= 0 };
     Syncpoint *next_node[2] = { NULL };
@@ -654,9 +655,8 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
 
     for (i = 0; i < nut->avf->nb_streams; i++) {
         ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i);
-        if (ret < 0) {
+        if (ret < 0)
             goto fail;
-        }
         ret = put_packet(nut, bc, dyn_bc, NULL, 0, STREAM_STARTCODE);
         if (ret < 0)
             goto fail;
@@ -668,8 +668,7 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
         goto fail;
 
     for (i = 0; i < nut->avf->nb_streams; i++) {
-        ret = write_streaminfo(nut, dyn_bc, i, prelude, &prelude_size);
-        if (!ret)
+        if (!write_streaminfo(nut, dyn_bc, i, prelude, &prelude_size))
             continue;
         ret = put_packet(nut, bc, dyn_bc, prelude, prelude_size, INFO_STARTCODE);
         if (ret < 0)
@@ -1035,21 +1034,24 @@  static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
         put_packet(nut, bc, NULL, syncpoint, ptr - syncpoint, SYNCPOINT_STARTCODE);
 
         if (nut->write_index) {
-        if ((ret = ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0 /*unused*/, pkt->dts)) < 0)
-            goto fail;
-
-        if ((1ll<<60) % nut->sp_count == 0)
-            for (i=0; i<s->nb_streams; i++) {
-                int j;
-                StreamContext *nus = &nut->stream[i];
-                av_reallocp_array(&nus->keyframe_pts, 2*nut->sp_count, sizeof(*nus->keyframe_pts));
-                if (!nus->keyframe_pts) {
-                    ret = AVERROR(ENOMEM);
-                    goto fail;
+            if ((ret = ff_nut_add_sp(nut, nut->last_syncpoint_pos,
+                                          0 /*unused*/, pkt->dts)) < 0)
+                goto fail;
+
+            if ((1ll << 60) % nut->sp_count == 0)
+                for (i = 0; i < s->nb_streams; i++) {
+                    int j;
+                    StreamContext *nus = &nut->stream[i];
+                    av_reallocp_array(&nus->keyframe_pts, 2*nut->sp_count,
+                                      sizeof(*nus->keyframe_pts));
+                    if (!nus->keyframe_pts) {
+                        ret = AVERROR(ENOMEM);
+                        goto fail;
+                    }
+                    for (j = nut->sp_count == 1 ? 0 : nut->sp_count;
+                         j < 2 * nut->sp_count; j++)
+                        nus->keyframe_pts[j] = AV_NOPTS_VALUE;
                 }
-                for (j=nut->sp_count == 1 ? 0 : nut->sp_count; j<2*nut->sp_count; j++)
-                    nus->keyframe_pts[j] = AV_NOPTS_VALUE;
-        }
         }
     }
     av_assert0(nus->last_pts != AV_NOPTS_VALUE);