From ce70f28a1732c74a9cd7fec2d56178750bd6e457 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 23 Oct 2015 11:11:31 +0200 Subject: 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`. --- doc/APIchanges | 4 ++++ doc/examples/avcodec.c | 6 +++--- doc/examples/transcode_aac.c | 10 +++++----- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/APIchanges b/doc/APIchanges index f9297406ad..590f192a46 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2015-08-28 API changes, most recent first: +2015-xx-xx - xxxxxxx - lavc 57.7.0 - avcodec.h + Deprecate av_free_packet(). Use av_packet_unref() as replacement, + it resets the packet in a more consistent way. + 2015-xx-xx - xxxxxxx - lavc 57.5.0 - avcodec.h Add data and linesize array to AVSubtitleRect, to be used instead of the ones from the embedded AVPicture. diff --git a/doc/examples/avcodec.c b/doc/examples/avcodec.c index f801bed2d0..df0af4b1ea 100644 --- a/doc/examples/avcodec.c +++ b/doc/examples/avcodec.c @@ -206,7 +206,7 @@ static void audio_encode_example(const char *filename) } if (got_output) { fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); + av_packet_unref(&pkt); } } fclose(f); @@ -403,7 +403,7 @@ static void video_encode_example(const char *filename) if (got_output) { printf("encoding frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); + av_packet_unref(&pkt); } } @@ -420,7 +420,7 @@ static void video_encode_example(const char *filename) if (got_output) { printf("encoding frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); + av_packet_unref(&pkt); } } diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index 30e6189942..3eebfb9d02 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -337,7 +337,7 @@ static int decode_audio_frame(AVFrame *frame, data_present, &input_packet)) < 0) { fprintf(stderr, "Could not decode frame (error '%s')\n", get_error_text(error)); - av_free_packet(&input_packet); + av_packet_unref(&input_packet); return error; } @@ -347,7 +347,7 @@ static int decode_audio_frame(AVFrame *frame, */ if (*finished && *data_present) *finished = 0; - av_free_packet(&input_packet); + av_packet_unref(&input_packet); return 0; } @@ -585,7 +585,7 @@ static int encode_audio_frame(AVFrame *frame, frame, data_present)) < 0) { fprintf(stderr, "Could not encode frame (error '%s')\n", get_error_text(error)); - av_free_packet(&output_packet); + av_packet_unref(&output_packet); return error; } @@ -594,11 +594,11 @@ static int encode_audio_frame(AVFrame *frame, if ((error = av_write_frame(output_format_context, &output_packet)) < 0) { fprintf(stderr, "Could not write frame (error '%s')\n", get_error_text(error)); - av_free_packet(&output_packet); + av_packet_unref(&output_packet); return error; } - av_free_packet(&output_packet); + av_packet_unref(&output_packet); } return 0; -- cgit v1.2.3