avformat: replace all uses of av_copy_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-09-23 20:30:13 -03:00
parent ecb9741ba2
commit a447b75de8
9 changed files with 15 additions and 13 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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 ||

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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);