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