diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index fcadf149a0..aab37418f0 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -233,7 +233,8 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) if (!pict_list) return AVERROR(ENOMEM); - if ((ret = av_copy_packet(&pict_list->pkt, pkt)) < 0) { + ret = av_packet_ref(&pict_list->pkt, pkt); + if (ret < 0) { av_freep(&pict_list); return ret; } diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index d4191c02cc..77c1c916c2 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -218,7 +218,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet) av_packet_unref(apng->prev_packet); if (packet) - av_copy_packet(apng->prev_packet, packet); + av_packet_ref(apng->prev_packet, packet); return 0; } @@ -232,7 +232,7 @@ static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet) if (!apng->prev_packet) return AVERROR(ENOMEM); - av_copy_packet(apng->prev_packet, packet); + av_packet_ref(apng->prev_packet, packet); } else { ret = flush_packet(format_context, packet); if (ret < 0) diff --git a/libavformat/gif.c b/libavformat/gif.c index d6113dbc85..01d98a27b0 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -175,7 +175,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) av_packet_unref(gif->prev_pkt); if (new) - av_copy_packet(gif->prev_pkt, new); + av_packet_ref(gif->prev_pkt, new); return 0; } @@ -206,7 +206,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) gif_image_write_header(s->pb, video_st, gif->loop, palette); } - return av_copy_packet(gif->prev_pkt, pkt); + return av_packet_ref(gif->prev_pkt, pkt); } return flush_packet(s, pkt); } diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 87b5ec2317..9b60bfc75c 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -161,7 +161,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) st->id = pkt->stream_index; fmt->pb = pb[0]; - if ((ret = av_copy_packet(&pkt2, pkt)) < 0 || + if ((ret = av_packet_ref(&pkt2, pkt)) < 0 || (ret = av_dup_packet(&pkt2)) < 0 || (ret = avcodec_parameters_copy(st->codecpar, s->streams[0]->codecpar)) < 0 || (ret = avformat_write_header(fmt, NULL)) < 0 || diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 10b959ad02..ba3e263f9f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -437,8 +437,8 @@ concatenate: return AVERROR_INVALIDDATA; if (!info->num_blocks) { - int ret; - if ((ret = av_copy_packet(&info->pkt, pkt)) < 0) + int ret = av_packet_ref(&info->pkt, pkt); + if (ret < 0) return ret; info->num_blocks = num_blocks; return 0; @@ -454,7 +454,8 @@ concatenate: if (info->num_blocks != 6) return 0; av_packet_unref(pkt); - if ((ret = av_copy_packet(pkt, &info->pkt)) < 0) + ret = av_packet_ref(pkt, &info->pkt); + if (ret < 0) return ret; av_packet_unref(&info->pkt); info->num_blocks = 0; diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 3cbf7bd137..826878eca1 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -523,7 +523,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt) return mp3_write_audio_packet(s, pkt); } - ret = av_copy_packet(&pktl->pkt, pkt); + ret = av_packet_ref(&pktl->pkt, pkt); if (ret < 0) { av_freep(&pktl); return ret; diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 108f909c84..93c9ef05cf 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -211,7 +211,7 @@ int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt) if (q->current_sub_idx == q->nb_subs) return AVERROR_EOF; - if (av_copy_packet(pkt, sub) < 0) { + if (av_packet_ref(pkt, sub) < 0) { return AVERROR(ENOMEM); } diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c index 2e0147cefd..9fb472257d 100644 --- a/libavformat/webpenc.c +++ b/libavformat/webpenc.c @@ -158,7 +158,7 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt) int ret; if ((ret = flush(s, 0, pkt->pts)) < 0) return ret; - av_copy_packet(&w->last_pkt, pkt); + av_packet_ref(&w->last_pkt, pkt); } ++w->frame_count; diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index 4925a60049..4a68b8133f 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -464,7 +464,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_MJPEG && !wctx->thumbnail.size) { - av_copy_packet(&wctx->thumbnail, pkt); + av_packet_ref(&wctx->thumbnail, pkt); return 0; } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) { int ret = ff_check_h264_startcode(s, st, pkt);