avpacket: Replace av_free_packet with av_packet_unref

`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
This commit is contained in:
Luca Barbato
2015-10-23 11:11:31 +02:00
parent a5d4204309
commit ce70f28a17
80 changed files with 174 additions and 158 deletions

View File

@@ -1200,7 +1200,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
*got_packet_ptr = 0;
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
av_free_packet(avpkt);
av_packet_unref(avpkt);
av_init_packet(avpkt);
return 0;
}
@@ -1276,7 +1276,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
}
if (ret < 0 || !*got_packet_ptr) {
av_free_packet(avpkt);
av_packet_unref(avpkt);
av_init_packet(avpkt);
goto end;
}
@@ -1307,7 +1307,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
*got_packet_ptr = 0;
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
av_free_packet(avpkt);
av_packet_unref(avpkt);
av_init_packet(avpkt);
avpkt->size = 0;
return 0;
@@ -1335,7 +1335,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
}
if (ret < 0 || !*got_packet_ptr)
av_free_packet(avpkt);
av_packet_unref(avpkt);
emms_c();
return ret;