It already initializes the packet.
Unified · Split
| @@ -2977,7 +2977,7 @@ static int read_thread(void *arg) · 2976 unmodified lines | ||
| 2977 | 2977 | } |
| 2978 | 2978 | if (is->queue_attachments_req) { |
| 2979 | 2979 | if (is->video_st && is->video_st->disposition & AV_DISPOSITION_ATTACHED_PIC) { |
| 2980 | − AVPacket copy = { 0 }; | |
| 2980 | + AVPacket copy; | |
| 2981 | 2981 | if ((ret = av_packet_ref(©, &is->video_st->attached_pic)) < 0) |
| 2982 | 2982 | goto fail; |
| 2983 | 2983 | packet_queue_put(&is->videoq, ©); |
| @@ -125,7 +125,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, · 124 unmodified lines | ||
| 125 | 125 | |
| 126 | 126 | /* buffer the input packet */ |
| 127 | 127 | if (avpkt->size) { |
| 128 | − AVPacket input_ref = { 0 }; | |
| 128 | + AVPacket input_ref; | |
| 129 | 129 | |
| 130 | 130 | if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) { |
| 131 | 131 | ret = av_fifo_realloc2(s->packet_fifo, |
| @@ -123,7 +123,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, · 122 unmodified lines | ||
| 123 | 123 | |
| 124 | 124 | /* buffer the input packet */ |
| 125 | 125 | if (avpkt->size) { |
| 126 | − AVPacket input_ref = { 0 }; | |
| 126 | + AVPacket input_ref; | |
| 127 | 127 | |
| 128 | 128 | if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) { |
| 129 | 129 | ret = av_fifo_realloc2(s->packet_fifo, |
| @@ -536,7 +536,6 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt) · 535 unmodified lines | ||
| 536 | 536 | int ret; |
| 537 | 537 | |
| 538 | 538 | if (pkt) { |
| 539 | − av_init_packet(&msg.pkt); | |
| 540 | 539 | ret = av_packet_ref(&msg.pkt,pkt); |
| 541 | 540 | if (ret < 0) |
| 542 | 541 | return ret; |
| @@ -78,7 +78,7 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) · 77 unmodified lines | ||
| 78 | 78 | VideoMuxData *img = s->priv_data; |
| 79 | 79 | AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; |
| 80 | 80 | AVStream *st; |
| 81 | − AVPacket pkt2 = {0}; | |
| 81 | + AVPacket pkt2; | |
| 82 | 82 | AVFormatContext *fmt = NULL; |
| 83 | 83 | int ret; |
| 84 | 84 | |
| @@ -88,8 +88,8 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) · 3 unmodified lines | ||
| 88 | 88 | return ret; |
| 89 | 89 | st = avformat_new_stream(fmt, NULL); |
| 90 | 90 | if (!st) { |
| 91 | − avformat_free_context(fmt); | |
| 92 | − return AVERROR(ENOMEM); | |
| 91 | + ret = AVERROR(ENOMEM); | |
| 92 | + goto out; | |
| 93 | 93 | } |
| 94 | 94 | st->id = pkt->stream_index; |
| 95 | 95 | |
| @@ -105,8 +105,8 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) · 9 unmodified lines | ||
| 105 | 105 | (ret = av_interleaved_write_frame(fmt, &pkt2)) < 0 || |
| 106 | 106 | (ret = av_write_trailer(fmt))) {} |
| 107 | 107 | |
| 108 | −out: | |
| 109 | 108 | av_packet_unref(&pkt2); |
| 109 | +out: | |
| 110 | 110 | avformat_free_context(fmt); |
| 111 | 111 | return ret; |
| 112 | 112 | } |
| @@ -564,7 +564,6 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) · 563 unmodified lines | ||
| 564 | 564 | if (s2 < 0) |
| 565 | 565 | continue; |
| 566 | 566 | |
| 567 | − memset(&pkt2, 0, sizeof(AVPacket)); | |
| 568 | 567 | if ((ret = av_packet_ref(&pkt2, pkt)) < 0) |
| 569 | 568 | if (!ret_all) { |
| 570 | 569 | ret_all = ret; |