Commit a447b75d authored by James Almer's avatar James Almer

avformat: replace all uses of av_copy_packet()

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent ecb9741b
...@@ -233,7 +233,8 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -233,7 +233,8 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
if (!pict_list) if (!pict_list)
return AVERROR(ENOMEM); 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); av_freep(&pict_list);
return ret; return ret;
} }
......
...@@ -218,7 +218,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet) ...@@ -218,7 +218,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet)
av_packet_unref(apng->prev_packet); av_packet_unref(apng->prev_packet);
if (packet) if (packet)
av_copy_packet(apng->prev_packet, packet); av_packet_ref(apng->prev_packet, packet);
return 0; return 0;
} }
...@@ -232,7 +232,7 @@ static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet) ...@@ -232,7 +232,7 @@ static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet)
if (!apng->prev_packet) if (!apng->prev_packet)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_copy_packet(apng->prev_packet, packet); av_packet_ref(apng->prev_packet, packet);
} else { } else {
ret = flush_packet(format_context, packet); ret = flush_packet(format_context, packet);
if (ret < 0) if (ret < 0)
......
...@@ -175,7 +175,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) ...@@ -175,7 +175,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new)
av_packet_unref(gif->prev_pkt); av_packet_unref(gif->prev_pkt);
if (new) if (new)
av_copy_packet(gif->prev_pkt, new); av_packet_ref(gif->prev_pkt, new);
return 0; return 0;
} }
...@@ -206,7 +206,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -206,7 +206,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
gif_image_write_header(s->pb, video_st, gif->loop, palette); 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); return flush_packet(s, pkt);
} }
......
...@@ -161,7 +161,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -161,7 +161,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
st->id = pkt->stream_index; st->id = pkt->stream_index;
fmt->pb = pb[0]; 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 = av_dup_packet(&pkt2)) < 0 ||
(ret = avcodec_parameters_copy(st->codecpar, s->streams[0]->codecpar)) < 0 || (ret = avcodec_parameters_copy(st->codecpar, s->streams[0]->codecpar)) < 0 ||
(ret = avformat_write_header(fmt, NULL)) < 0 || (ret = avformat_write_header(fmt, NULL)) < 0 ||
......
...@@ -437,8 +437,8 @@ concatenate: ...@@ -437,8 +437,8 @@ concatenate:
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (!info->num_blocks) { if (!info->num_blocks) {
int ret; int ret = av_packet_ref(&info->pkt, pkt);
if ((ret = av_copy_packet(&info->pkt, pkt)) < 0) if (ret < 0)
return ret; return ret;
info->num_blocks = num_blocks; info->num_blocks = num_blocks;
return 0; return 0;
...@@ -454,7 +454,8 @@ concatenate: ...@@ -454,7 +454,8 @@ concatenate:
if (info->num_blocks != 6) if (info->num_blocks != 6)
return 0; return 0;
av_packet_unref(pkt); 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; return ret;
av_packet_unref(&info->pkt); av_packet_unref(&info->pkt);
info->num_blocks = 0; info->num_blocks = 0;
......
...@@ -523,7 +523,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -523,7 +523,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
return mp3_write_audio_packet(s, 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) { if (ret < 0) {
av_freep(&pktl); av_freep(&pktl);
return ret; return ret;
......
...@@ -211,7 +211,7 @@ int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt) ...@@ -211,7 +211,7 @@ int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
if (q->current_sub_idx == q->nb_subs) if (q->current_sub_idx == q->nb_subs)
return AVERROR_EOF; return AVERROR_EOF;
if (av_copy_packet(pkt, sub) < 0) { if (av_packet_ref(pkt, sub) < 0) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
......
...@@ -158,7 +158,7 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -158,7 +158,7 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt)
int ret; int ret;
if ((ret = flush(s, 0, pkt->pts)) < 0) if ((ret = flush(s, 0, pkt->pts)) < 0)
return ret; return ret;
av_copy_packet(&w->last_pkt, pkt); av_packet_ref(&w->last_pkt, pkt);
} }
++w->frame_count; ++w->frame_count;
......
...@@ -464,7 +464,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -464,7 +464,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
if (st->codecpar->codec_id == AV_CODEC_ID_MJPEG && !wctx->thumbnail.size) { 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; return 0;
} else if (st->codecpar->codec_id == AV_CODEC_ID_H264) { } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
int ret = ff_check_h264_startcode(s, st, pkt); int ret = ff_check_h264_startcode(s, st, pkt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment