diff mbox series

[FFmpeg-devel,01/10] libavformat/nutenc: Remove redundant function parameter

Message ID 20200504182250.26141-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 63a4cadd27c9ba9d45c2c248d2d4f699f9819ddf
Headers show
Series [FFmpeg-devel,01/10] libavformat/nutenc: Remove redundant function parameter
Related show

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
calculate_checksum in put_packet() is always 1.

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

Comments

Michael Niedermayer May 5, 2020, 1:45 p.m. UTC | #1
On Mon, May 04, 2020 at 08:22:41PM +0200, Andreas Rheinhardt wrote:
> calculate_checksum in put_packet() is always 1.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/nutenc.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)

probably ok

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 1d48625815..44ee5d810a 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -299,13 +299,12 @@  static void put_s(AVIOContext *bc, int64_t val)
     ff_put_v(bc, 2 * FFABS(val) - (val > 0));
 }
 
-//FIXME remove calculate_checksum
 static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc,
-                       int calculate_checksum, uint64_t startcode)
+                       uint64_t startcode)
 {
     uint8_t *dyn_buf = NULL;
     int dyn_size     = avio_close_dyn_buf(dyn_bc, &dyn_buf);
-    int forw_ptr     = dyn_size + 4 * calculate_checksum;
+    int forw_ptr     = dyn_size + 4;
 
     if (forw_ptr > 4096)
         ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
@@ -314,11 +313,9 @@  static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc,
     if (forw_ptr > 4096)
         avio_wl32(bc, ffio_get_checksum(bc));
 
-    if (calculate_checksum)
-        ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
+    ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
     avio_write(bc, dyn_buf, dyn_size);
-    if (calculate_checksum)
-        avio_wl32(bc, ffio_get_checksum(bc));
+    avio_wl32(bc, ffio_get_checksum(bc));
 
     av_free(dyn_buf);
 }
@@ -630,7 +627,7 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
     if (ret < 0)
         return ret;
     write_mainheader(nut, dyn_bc);
-    put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
+    put_packet(nut, bc, dyn_bc, MAIN_STARTCODE);
 
     for (i = 0; i < nut->avf->nb_streams; i++) {
         ret = avio_open_dyn_buf(&dyn_bc);
@@ -641,14 +638,14 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
             ffio_free_dyn_buf(&dyn_bc);
             return ret;
         }
-        put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
+        put_packet(nut, bc, dyn_bc, STREAM_STARTCODE);
     }
 
     ret = avio_open_dyn_buf(&dyn_bc);
     if (ret < 0)
         return ret;
     write_globalinfo(nut, dyn_bc);
-    put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+    put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
 
     for (i = 0; i < nut->avf->nb_streams; i++) {
         ret = avio_open_dyn_buf(&dyn_bc);
@@ -656,7 +653,7 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
             return ret;
         ret = write_streaminfo(nut, dyn_bc, i);
         if (ret > 0)
-            put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+            put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
         else {
             ffio_free_dyn_buf(&dyn_bc);
             if (ret < 0)
@@ -673,7 +670,7 @@  static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
             ffio_free_dyn_buf(&dyn_bc);
             return ret;
         }
-        put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+        put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
     }
 
     nut->last_syncpoint_pos = INT_MIN;
@@ -1022,7 +1019,7 @@  static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
             put_tt(nut, nus->time_base, dyn_bc,
                    av_rescale_q(av_gettime(), AV_TIME_BASE_Q, *nus->time_base));
         }
-        put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
+        put_packet(nut, bc, dyn_bc, SYNCPOINT_STARTCODE);
 
         if (nut->write_index) {
         if ((ret = ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0 /*unused*/, pkt->dts)) < 0)
@@ -1175,7 +1172,7 @@  static int nut_write_trailer(AVFormatContext *s)
     if (ret >= 0) {
         av_assert1(nut->write_index); // sp_count should be 0 if no index is going to be written
         write_index(nut, dyn_bc);
-        put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE);
+        put_packet(nut, bc, dyn_bc, INDEX_STARTCODE);
     }
 
     return 0;