diff mbox series

[FFmpeg-devel,3/3] avformat: replace all uses of av_shrink_packet() with av_packet_resize()

Message ID 20210311155011.52961-3-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avcodec/avpacket: add av_packet_resize() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer March 11, 2021, 3:50 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/4xm.c      | 2 +-
 libavformat/adp.c      | 2 +-
 libavformat/adxdec.c   | 2 +-
 libavformat/asfdec_f.c | 2 +-
 libavformat/cdxl.c     | 2 +-
 libavformat/dsicin.c   | 2 +-
 libavformat/mxfdec.c   | 4 ++--
 libavformat/nutdec.c   | 2 +-
 libavformat/nuv.c      | 2 +-
 libavformat/rawdec.c   | 2 +-
 libavformat/rmdec.c    | 2 +-
 libavformat/sdr2.c     | 2 +-
 libavformat/svs.c      | 2 +-
 libavformat/swfdec.c   | 2 +-
 libavformat/utils.c    | 2 +-
 libavformat/yop.c      | 2 +-
 16 files changed, 17 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 30f1b05324..5acbd77055 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -341,7 +341,7 @@  static int fourxm_read_packet(AVFormatContext *s,
                 av_packet_unref(pkt);
             } else {
                 packet_read = 1;
-                av_shrink_packet(pkt, ret + 8);
+                av_packet_resize(pkt, ret + 8);
             }
             break;
 
diff --git a/libavformat/adp.c b/libavformat/adp.c
index 8668c78fe4..374f923072 100644
--- a/libavformat/adp.c
+++ b/libavformat/adp.c
@@ -80,7 +80,7 @@  static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (ret < 0) {
             return ret;
         }
-        av_shrink_packet(pkt, ret);
+        av_packet_resize(pkt, ret);
     }
     pkt->stream_index = 0;
 
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index a265c87dea..a772e393c7 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -71,7 +71,7 @@  static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
         return ret;
     if ((ret % size) && ret >= size) {
         size = ret - (ret % size);
-        av_shrink_packet(pkt, size);
+        av_packet_resize(pkt, size);
         pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
     } else if (ret < size) {
         return AVERROR(EIO);
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 1484b544d9..22aab4a46f 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -1388,7 +1388,7 @@  static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
                 ret = asf->packet_frag_size;
             } else {
                 // no scrambling, so we can return partial packets
-                av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + ret);
+                av_packet_resize(&asf_st->pkt, asf->packet_frag_offset + ret);
             }
         }
         if (s->key && s->keylen == 20)
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index 33b6d5cbad..7259ba339e 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -221,7 +221,7 @@  static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (ret < 0) {
             return ret;
         }
-        av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);
+        av_packet_resize(pkt, CDXL_HEADER_SIZE + ret);
         pkt->stream_index  = cdxl->video_stream_index;
         pkt->flags        |= AV_PKT_FLAG_KEY;
         pkt->pos           = cdxl->pos;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index b18f43b9a0..ebadd56c98 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -203,7 +203,7 @@  static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
             return ret;
         }
         if (ret < pkt_size)
-            av_shrink_packet(pkt, 4 + ret);
+            av_packet_resize(pkt, 4 + ret);
 
         /* sound buffer will be processed on next read_packet() call */
         cin->audio_buffer_size = hdr->audio_frame_size;
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index bb00838a3f..bdb8eff587 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -575,7 +575,7 @@  static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt,
         }
         buf_ptr += 32 - st->codecpar->channels*4; // always 8 channels stored SMPTE 331M
     }
-    av_shrink_packet(pkt, data_ptr - pkt->data);
+    av_packet_resize(pkt, data_ptr - pkt->data);
     return 0;
 }
 
@@ -642,7 +642,7 @@  static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
     if (mxf->aesc)
         av_aes_crypt(mxf->aesc, &pkt->data[plaintext_size],
                      &pkt->data[plaintext_size], size >> 4, ivec, 1);
-    av_shrink_packet(pkt, orig_size);
+    av_packet_resize(pkt, orig_size);
     pkt->stream_index = index;
     avio_skip(pb, end - avio_tell(pb));
     return 0;
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ebb062377d..11cdd92c4a 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1122,7 +1122,7 @@  static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
         if (ret < 0)
             goto fail;
     }
-    av_shrink_packet(pkt, nut->header_len[header_idx] + ret);
+    av_packet_resize(pkt, nut->header_len[header_idx] + ret);
 
     pkt->stream_index = stream_id;
     if (stc->last_flags & FLAG_KEY)
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index df90df4938..3c8eb7b8d4 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -291,7 +291,7 @@  static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
                 return ret;
             }
             if (ret < size)
-                av_shrink_packet(pkt, copyhdrsize + ret);
+                av_packet_resize(pkt, copyhdrsize + ret);
             return 0;
         case NUV_AUDIO:
             if (ctx->a_id < 0) {
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 122afca1b6..6c72a7c94a 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -49,7 +49,7 @@  int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
         av_packet_unref(pkt);
         return ret;
     }
-    av_shrink_packet(pkt, ret);
+    av_packet_resize(pkt, ret);
     return ret;
 }
 
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 610189ecb4..79c46429d6 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -850,7 +850,7 @@  static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
         if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin
             memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices,
                 vst->videobufpos - 1 - 8*vst->slices);
-        av_shrink_packet(pkt, vst->videobufpos + 8*(vst->cur_slice - vst->slices));
+        av_packet_resize(pkt, vst->videobufpos + 8*(vst->cur_slice - vst->slices));
         pkt->pts = AV_NOPTS_VALUE;
         pkt->pos = vst->pktpos;
         vst->slices = 0;
diff --git a/libavformat/sdr2.c b/libavformat/sdr2.c
index 3743d59e58..255dd69475 100644
--- a/libavformat/sdr2.c
+++ b/libavformat/sdr2.c
@@ -97,7 +97,7 @@  static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (ret < 0) {
             return ret;
         }
-        av_shrink_packet(pkt, ret + 24);
+        av_packet_resize(pkt, ret + 24);
     } else {
         ret = av_get_packet(s->pb, pkt, next - 52);
     }
diff --git a/libavformat/svs.c b/libavformat/svs.c
index d4285ed306..66647acb67 100644
--- a/libavformat/svs.c
+++ b/libavformat/svs.c
@@ -79,7 +79,7 @@  static int svs_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret != 32 * 256) {
         if (ret < 0)
             return ret;
-        av_shrink_packet(pkt, ret);
+        av_packet_resize(pkt, ret);
         pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
     }
     pkt->stream_index = 0;
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index f9a164b33f..783e0ec072 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -538,7 +538,7 @@  bitmap_end_skip:
                 if (res < 0) {
                     return res;
                 }
-                av_shrink_packet(pkt, res);
+                av_packet_resize(pkt, res);
             }
 
             pkt->pos = pos;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8573117694..18f512a961 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -293,7 +293,7 @@  static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
 
         ret = avio_read(s, pkt->data + prev_size, read_size);
         if (ret != read_size) {
-            av_shrink_packet(pkt, prev_size + FFMAX(ret, 0));
+            av_packet_resize(pkt, prev_size + FFMAX(ret, 0));
             break;
         }
 
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 0d8d9f2ff7..d4150b2d6b 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -160,7 +160,7 @@  static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret < 0)
         goto err_out;
     else if (ret < actual_video_data_size)
-        av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
+        av_packet_resize(&yop->video_packet, yop->palette_size + ret);
 
     // Arbitrarily return the audio data first
     return 0;