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`. --- libavdevice/alsa_dec.c | 4 ++-- libavdevice/jack.c | 2 +- libavdevice/oss_dec.c | 2 +- libavdevice/pulse.c | 2 +- libavdevice/sndio_dec.c | 2 +- libavdevice/v4l2.c | 2 +- libavdevice/vfwcap.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'libavdevice') diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c index 2cc5b7d574..e7819ec18a 100644 --- a/libavdevice/alsa_dec.c +++ b/libavdevice/alsa_dec.c @@ -128,14 +128,14 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) while ((res = snd_pcm_readi(s->h, pkt->data, pkt->size / s->frame_size)) < 0) { if (res == -EAGAIN) { - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR(EAGAIN); } if (ff_alsa_xrun_recover(s1, res) < 0) { av_log(s1, AV_LOG_ERROR, "ALSA read error: %s\n", snd_strerror(res)); - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR(EIO); } diff --git a/libavdevice/jack.c b/libavdevice/jack.c index aa9348df09..24c23e8c84 100644 --- a/libavdevice/jack.c +++ b/libavdevice/jack.c @@ -220,7 +220,7 @@ static void free_pkt_fifo(AVFifoBuffer *fifo) AVPacket pkt; while (av_fifo_size(fifo)) { av_fifo_generic_read(fifo, &pkt, sizeof(pkt), NULL); - av_free_packet(&pkt); + av_packet_unref(&pkt); } av_fifo_free(fifo); } diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c index 3f786cc356..24d357110c 100644 --- a/libavdevice/oss_dec.c +++ b/libavdevice/oss_dec.c @@ -82,7 +82,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) ret = read(s->fd, pkt->data, pkt->size); if (ret <= 0){ - av_free_packet(pkt); + av_packet_unref(pkt); pkt->size = 0; if (ret<0) return AVERROR(errno); else return AVERROR_EOF; diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c index aaff4478d4..0e8bd09e15 100644 --- a/libavdevice/pulse.c +++ b/libavdevice/pulse.c @@ -133,7 +133,7 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt) if ((pa_simple_read(pd->s, pkt->data, pkt->size, &res)) < 0) { av_log(s, AV_LOG_ERROR, "pa_simple_read failed: %s\n", pa_strerror(res)); - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR(EIO); } diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c index 7ebb8c3ccc..5d40a7a5e2 100644 --- a/libavdevice/sndio_dec.c +++ b/libavdevice/sndio_dec.c @@ -67,7 +67,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) ret = sio_read(s->hdl, pkt->data, pkt->size); if (ret == 0 || sio_eof(s->hdl)) { - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR_EOF; } diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 40eabc4f21..41dc0a12f8 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -508,7 +508,7 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt) if (res < 0) { res = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF)\n"); - av_free_packet(pkt); + av_packet_unref(pkt); return res; } avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1); diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 154f550b00..cc73e82bd0 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -233,7 +233,7 @@ static int vfw_read_close(AVFormatContext *s) pktl = ctx->pktl; while (pktl) { AVPacketList *next = pktl->next; - av_free_packet(&pktl->pkt); + av_packet_unref(&pktl->pkt); av_free(pktl); pktl = next; } -- cgit v1.2.3