diff mbox series

[FFmpeg-devel,24/34] avformat/img2enc: Don't use sizeof(AVPacket)

Message ID AM7PR03MB6660A4687F673129C8C895168FD29@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/11] avformat/mux: Sanitize packets without data and side-data
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 6, 2021, 2:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/img2enc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 655595374d..944e055e12 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -77,7 +77,7 @@  static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
     VideoMuxData *img = s->priv_data;
     AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
     AVStream *st;
-    AVPacket pkt2;
+    AVPacket *const pkt2 = s->internal->pkt;
     AVFormatContext *fmt = NULL;
     int ret;
 
@@ -94,17 +94,17 @@  static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
 
     fmt->pb = pb;
 
-    ret = av_packet_ref(&pkt2, pkt);
+    ret = av_packet_ref(pkt2, pkt);
     if (ret < 0)
         goto out;
-    pkt2.stream_index = 0;
+    pkt2->stream_index = 0;
 
     if ((ret = avcodec_parameters_copy(st->codecpar, par))     < 0 ||
         (ret = avformat_write_header(fmt, NULL))               < 0 ||
-        (ret = av_interleaved_write_frame(fmt, &pkt2))         < 0 ||
+        (ret = av_interleaved_write_frame(fmt, pkt2))         < 0 ||
         (ret = av_write_trailer(fmt))) {}
 
-    av_packet_unref(&pkt2);
+    av_packet_unref(pkt2);
 out:
     avformat_free_context(fmt);
     return ret;