aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-10-23 11:11:31 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-10-26 18:00:55 +0100
commitce70f28a1732c74a9cd7fec2d56178750bd6e457 (patch)
tree4e23c0b8181685ce4901250c8ee8468955bc362a /libavformat
parenta5d42043093a39636a1f4021a37dd9c612479f6f (diff)
downloadffmpeg-ce70f28a1732c74a9cd7fec2d56178750bd6e457.tar.gz
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`.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/4xm.c2
-rw-r--r--libavformat/adxdec.c4
-rw-r--r--libavformat/amr.c2
-rw-r--r--libavformat/asfdec.c14
-rw-r--r--libavformat/avformat.h4
-rw-r--r--libavformat/avidec.c6
-rw-r--r--libavformat/avs.c2
-rw-r--r--libavformat/c93.c2
-rw-r--r--libavformat/cdg.c2
-rw-r--r--libavformat/cdxl.c2
-rw-r--r--libavformat/dfa.c4
-rw-r--r--libavformat/dsicin.c2
-rw-r--r--libavformat/dss.c6
-rw-r--r--libavformat/dxa.c2
-rw-r--r--libavformat/electronicarts.c2
-rw-r--r--libavformat/flic.c4
-rw-r--r--libavformat/g723_1.c2
-rw-r--r--libavformat/gsmdec.c2
-rw-r--r--libavformat/hls.c6
-rw-r--r--libavformat/hnm.c2
-rw-r--r--libavformat/idcin.c4
-rw-r--r--libavformat/ilbc.c2
-rw-r--r--libavformat/img2dec.c2
-rw-r--r--libavformat/ingenientdec.c2
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/ipmovie.c4
-rw-r--r--libavformat/iv8.c2
-rw-r--r--libavformat/lxfdec.c2
-rw-r--r--libavformat/matroskadec.c4
-rw-r--r--libavformat/matroskaenc.c4
-rw-r--r--libavformat/mmf.c2
-rw-r--r--libavformat/mp3enc.c2
-rw-r--r--libavformat/mpc.c4
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/mux.c6
-rw-r--r--libavformat/mxfenc.c2
-rw-r--r--libavformat/ncdec.c2
-rw-r--r--libavformat/nsvdec.c4
-rw-r--r--libavformat/nuv.c2
-rw-r--r--libavformat/psxstr.c4
-rw-r--r--libavformat/rawdec.c2
-rw-r--r--libavformat/rl2.c2
-rw-r--r--libavformat/rmdec.c6
-rw-r--r--libavformat/rpl.c4
-rw-r--r--libavformat/rtpdec_asf.c2
-rw-r--r--libavformat/rtpdec_mpa_robust.c2
-rw-r--r--libavformat/rtpdec_qt.c2
-rw-r--r--libavformat/rtpdec_xiph.c2
-rw-r--r--libavformat/sapdec.c2
-rw-r--r--libavformat/seek-test.c2
-rw-r--r--libavformat/sierravmd.c2
-rw-r--r--libavformat/spdifdec.c6
-rw-r--r--libavformat/thp.c4
-rw-r--r--libavformat/utils.c18
-rw-r--r--libavformat/vqf.c2
-rw-r--r--libavformat/wc3movie.c2
-rw-r--r--libavformat/westwood_vqa.c2
-rw-r--r--libavformat/wvdec.c10
-rw-r--r--libavformat/yop.c6
59 files changed, 104 insertions, 104 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 2952a2172a..5eaf9851b7 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -308,7 +308,7 @@ static int fourxm_read_packet(AVFormatContext *s,
ret = avio_read(s->pb, &pkt->data[8], size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
} else
packet_read = 1;
break;
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index bce0493b79..c7bd33ab8b 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -47,11 +47,11 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
if (AV_RB16(pkt->data) & 0x8000) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR_EOF;
}
pkt->size = size;
diff --git a/libavformat/amr.c b/libavformat/amr.c
index afd062ee36..b57a568525 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -148,7 +148,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
read = avio_read(s->pb, pkt->data + 1, size - 1);
if (read != size - 1) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index a39f6d4c21..e1b0b8c67b 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -444,7 +444,7 @@ static int asf_read_picture(AVFormatContext *s, int len)
fail:
av_freep(&desc);
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
return ret;
}
@@ -1128,7 +1128,7 @@ static void reset_packet(ASFPacket *asf_pkt)
asf_pkt->flags = 0;
asf_pkt->dts = 0;
asf_pkt->duration = 0;
- av_free_packet(&asf_pkt->avpkt);
+ av_packet_unref(&asf_pkt->avpkt);
av_init_packet(&asf_pkt->avpkt);
}
@@ -1395,7 +1395,7 @@ static int asf_deinterleave(AVFormatContext *s, ASFPacket *asf_pkt, int st_num)
if (p > asf_pkt->avpkt.data + asf_pkt->data_size)
break;
}
- av_free_packet(&asf_pkt->avpkt);
+ av_packet_unref(&asf_pkt->avpkt);
asf_pkt->avpkt = pkt;
return 0;
@@ -1485,7 +1485,7 @@ static int asf_read_close(AVFormatContext *s)
for (i = 0; i < ASF_MAX_STREAMS; i++) {
av_dict_free(&asf->asf_sd[i].asf_met);
if (i < asf->nb_streams) {
- av_free_packet(&asf->asf_st[i]->pkt.avpkt);
+ av_packet_unref(&asf->asf_st[i]->pkt.avpkt);
av_freep(&asf->asf_st[i]);
}
}
@@ -1521,7 +1521,7 @@ static void reset_packet_state(AVFormatContext *s)
pkt->flags = 0;
pkt->dts = 0;
pkt->duration = 0;
- av_free_packet(&pkt->avpkt);
+ av_packet_unref(&pkt->avpkt);
av_init_packet(&pkt->avpkt);
}
}
@@ -1588,11 +1588,11 @@ static int64_t asf_read_timestamp(AVFormatContext *s, int stream_index,
}
if (st_found)
break;
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
}
*pos = pkt_pos;
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
return dts;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 143a98639c..470bbc6017 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -165,7 +165,7 @@
* until the next av_read_frame() call or closing the file. If the caller
* requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy
* of it.
- * In both cases, the packet must be freed with av_free_packet() when it is no
+ * In both cases, the packet must be freed with av_packet_unref() when it is no
* longer needed.
*
* @section lavf_decoding_seek Seeking
@@ -1491,7 +1491,7 @@ int av_find_best_stream(AVFormatContext *ic,
* If pkt->buf is NULL, then the packet is valid until the next
* av_read_frame() or until avformat_close_input(). Otherwise the packet
* is valid indefinitely. In both cases the packet must be freed with
- * av_free_packet when it is no longer needed. For video, the packet contains
+ * av_packet_unref when it is no longer needed. For video, the packet contains
* exactly one frame. For audio, it contains an integer number of frames if each
* frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames
* have a variable size (e.g. MPEG audio), then it contains one frame.
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 63afe2f397..659bfa7b6d 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1215,7 +1215,7 @@ resync:
pkt->buf = avbuf;
pkt->flags |= AV_PKT_FLAG_KEY;
if (size < 0)
- av_free_packet(pkt);
+ av_packet_unref(pkt);
} else if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE &&
!st->codec->codec_tag && read_gab2_sub(st, pkt)) {
ast->frame_offset++;
@@ -1470,7 +1470,7 @@ static void seek_subtitle(AVStream *st, AVStream *st2, int64_t timestamp)
{
AVIStream *ast2 = st2->priv_data;
int64_t ts2 = av_rescale_q(timestamp, st->time_base, st2->time_base);
- av_free_packet(&ast2->sub_pkt);
+ av_packet_unref(&ast2->sub_pkt);
if (avformat_seek_file(ast2->sub_ctx, 0, INT64_MIN, ts2, ts2, 0) >= 0 ||
avformat_seek_file(ast2->sub_ctx, 0, ts2, ts2, INT64_MAX, 0) >= 0)
ff_read_packet(ast2->sub_ctx, &ast2->sub_pkt);
@@ -1587,7 +1587,7 @@ static int avi_read_close(AVFormatContext *s)
avformat_close_input(&ast->sub_ctx);
}
av_free(ast->sub_buffer);
- av_free_packet(&ast->sub_pkt);
+ av_packet_unref(&ast->sub_pkt);
}
}
diff --git a/libavformat/avs.c b/libavformat/avs.c
index d8042c51f9..74721b63c4 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -108,7 +108,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
if (ret < size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/c93.c b/libavformat/c93.c
index fdb7a87a2a..3ae99fcfc9 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -188,7 +188,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
fail:
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index e699691925..285bfaf35b 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -62,7 +62,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
if (ret < 1 || (pkt->data[0] & CDG_MASK) == CDG_COMMAND)
break;
- av_free_packet(pkt);
+ av_packet_unref(pkt);
}
if (!priv->got_first_packet) {
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index a2cba526ca..366da4bf7c 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -146,7 +146,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, cdxl->header, CDXL_HEADER_SIZE);
ret = avio_read(pb, pkt->data + CDXL_HEADER_SIZE, video_size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index c097d72cf8..03dca4f5c3 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -82,7 +82,7 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!first) {
ret = av_append_packet(pb, pkt, 12);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
} else
@@ -103,7 +103,7 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
}
ret = av_append_packet(pb, pkt, frame_size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
}
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index 6a7c8b948a..612289fd4f 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -197,7 +197,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(pb, &pkt->data[4], pkt_size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
if (ret < pkt_size)
diff --git a/libavformat/dss.c b/libavformat/dss.c
index f7d0ead1c2..e9610dd1a1 100644
--- a/libavformat/dss.c
+++ b/libavformat/dss.c
@@ -256,7 +256,7 @@ static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt)
return pkt->size;
error_eof:
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
@@ -294,7 +294,7 @@ static int dss_723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + offset,
size2 - offset);
if (ret < size2 - offset) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
@@ -304,7 +304,7 @@ static int dss_723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + offset, size - offset);
if (ret < size - offset) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 34085cf446..7d04e7bfaa 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -201,7 +201,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
if(pal_size) memcpy(pkt->data, pal, pal_size);
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 7c1fabee0f..b3855b69a5 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -567,7 +567,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
case AV_CODEC_ID_ADPCM_EA_R3:
if (pkt->size < 4) {
av_log(s, AV_LOG_ERROR, "Packet is too short\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR_INVALIDDATA;
}
if (ea->audio_codec == AV_CODEC_ID_ADPCM_EA_R3)
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 2eb6f057b4..277e12b20c 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -228,7 +228,7 @@ static int flic_read_packet(AVFormatContext *s,
ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
ret = AVERROR(EIO);
}
packet_read = 1;
@@ -246,7 +246,7 @@ static int flic_read_packet(AVFormatContext *s,
ret = avio_read(pb, pkt->data, size);
if (ret != size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
ret = AVERROR(EIO);
}
diff --git a/libavformat/g723_1.c b/libavformat/g723_1.c
index b67c07c404..716fbb9dd2 100644
--- a/libavformat/g723_1.c
+++ b/libavformat/g723_1.c
@@ -69,7 +69,7 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + 1, size - 1);
if (ret < size - 1) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index e73aa0ddab..1bc7eed856 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -45,7 +45,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret < GSM_BLOCK_SIZE) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
pkt->size = ret;
diff --git a/libavformat/hls.c b/libavformat/hls.c
index be4720789b..dc3ab87b8a 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -129,7 +129,7 @@ static void free_variant_list(HLSContext *c)
for (i = 0; i < c->n_variants; i++) {
struct variant *var = c->variants[i];
free_segment_list(var);
- av_free_packet(&var->pkt);
+ av_packet_unref(&var->pkt);
av_free(var->pb.buffer);
if (var->input)
ffurl_close(var->input);
@@ -724,7 +724,7 @@ start:
c->seek_timestamp = AV_NOPTS_VALUE;
break;
}
- av_free_packet(&var->pkt);
+ av_packet_unref(&var->pkt);
reset_packet(&var->pkt);
}
}
@@ -815,7 +815,7 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
ffurl_close(var->input);
var->input = NULL;
}
- av_free_packet(&var->pkt);
+ av_packet_unref(&var->pkt);
reset_packet(&var->pkt);
var->pb.eof_reached = 0;
/* Clear any buffered data */
diff --git a/libavformat/hnm.c b/libavformat/hnm.c
index 54ac6c2ce4..31fc42e05d 100644
--- a/libavformat/hnm.c
+++ b/libavformat/hnm.c
@@ -190,7 +190,7 @@ static int hnm_read_close(AVFormatContext *s)
Hnm4DemuxContext *hnm = s->priv_data;
if (hnm->vpkt.size > 0)
- av_free_packet(&hnm->vpkt);
+ av_packet_unref(&hnm->vpkt);
return 0;
}
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 3aa0e3ea50..32cba3adba 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -309,7 +309,7 @@ static int idcin_read_packet(AVFormatContext *s,
return ret;
else if (ret != chunk_size) {
av_log(s, AV_LOG_ERROR, "incomplete packet\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
if (command == 1) {
@@ -318,7 +318,7 @@ static int idcin_read_packet(AVFormatContext *s,
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE);
if (!pal) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
memcpy(pal, palette, AVPALETTE_SIZE);
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index e44af487b2..5ed8899a9e 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -112,7 +112,7 @@ static int ilbc_read_packet(AVFormatContext *s,
pkt->pos = avio_tell(s->pb);
pkt->duration = enc->block_align == 38 ? 160 : 240;
if ((ret = avio_read(s->pb, pkt->data, enc->block_align)) != enc->block_align) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index fc6da1b7fe..eb2508738e 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -280,7 +280,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO); /* signal EOF */
} else {
s->img_count++;
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index 42b29ef6e3..2bb70e721f 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -51,7 +51,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
ret = avio_read(s->pb, pkt->data, size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
pkt->size = ret;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index f08ad90038..a65a3b7f13 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -348,7 +348,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt);
* Interleave a packet per dts in an output media file.
*
* Packets with pkt->destruct == av_destruct_packet will be freed inside this
- * function, so they cannot be used after it. Note that calling av_free_packet()
+ * function, so they cannot be used after it. Note that calling av_packet_unref()
* on them is still safe.
*
* @param s media file handle
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index fe8d97b548..fb5124d685 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -180,7 +180,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
if (avio_read(pb, pkt->data, s->decode_map_chunk_size) !=
s->decode_map_chunk_size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return CHUNK_EOF;
}
@@ -189,7 +189,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
if (avio_read(pb, pkt->data + s->decode_map_chunk_size,
s->video_chunk_size) != s->video_chunk_size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return CHUNK_EOF;
}
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index 56909e3a22..ad630b3eb4 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -92,7 +92,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_append_packet(s->pb, pkt, size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "failed to grow packet\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
}
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index e25f82e0af..2bbf033664 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret2;
if ((ret2 = avio_read(pb, pkt->data, ret)) != ret) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret2 < 0 ? ret2 : AVERROR_EOF;
}
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index caf127ff20..8296a41559 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1227,7 +1227,7 @@ static int matroska_merge_packets(AVPacket *out, AVPacket *in)
memcpy(out->data + old_size, in->data, in->size);
- av_free_packet(in);
+ av_packet_unref(in);
av_free(in);
return 0;
}
@@ -1997,7 +1997,7 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
if (matroska->packets) {
int n;
for (n = 0; n < matroska->num_packets; n++) {
- av_free_packet(matroska->packets[n]);
+ av_packet_unref(matroska->packets[n]);
av_free(matroska->packets[n]);
}
av_freep(&matroska->packets);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2e4d277ae9..f1bd272672 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1597,7 +1597,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
// check if we have an audio packet cached
if (mkv->cur_audio_pkt.size > 0) {
ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt);
- av_free_packet(&mkv->cur_audio_pkt);
+ av_packet_unref(&mkv->cur_audio_pkt);
if (ret < 0) {
av_log(s, AV_LOG_ERROR,
"Could not write cached audio packet ret:%d\n", ret);
@@ -1653,7 +1653,7 @@ static int mkv_write_trailer(AVFormatContext *s)
// check if we have an audio packet cached
if (mkv->cur_audio_pkt.size > 0) {
ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt);
- av_free_packet(&mkv->cur_audio_pkt);
+ av_packet_unref(&mkv->cur_audio_pkt);
if (ret < 0) {
av_log(s, AV_LOG_ERROR,
"Could not write cached audio packet ret:%d\n", ret);
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 6fb63bf9ab..2150bd5911 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -292,7 +292,7 @@ static int mmf_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data, pkt->size);
if (ret < 0)
- av_free_packet(pkt);
+ av_packet_unref(pkt);
mmf->data_size -= ret;
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 9cff9d33e7..e4c6dbb223 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -341,7 +341,7 @@ static int mp3_queue_flush(AVFormatContext *s)
while ((pktl = mp3->queue)) {
if (write && (ret = mp3_write_audio_packet(s, &pktl->pkt)) < 0)
write = 0;
- av_free_packet(&pktl->pkt);
+ av_packet_unref(&pktl->pkt);
mp3->queue = pktl->next;
av_freep(&pktl);
}
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index ed8d73f7b0..e92cab6242 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -167,7 +167,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
if(c->curbits)
avio_seek(s->pb, -4, SEEK_CUR);
if(ret < size){
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
pkt->size = ret + 4;
@@ -218,7 +218,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
c->curframe = lastframe;
return ret;
}
- av_free_packet(pkt);
+ av_packet_unref(pkt);
}
return 0;
}
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index e9e3288820..01af597894 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2162,7 +2162,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = read_packet(s, pkt->data, ts->raw_packet_size, &data);
pkt->pos = avio_tell(s->pb);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
if (data != pkt->data)
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 4bba970c92..e86d202713 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -544,7 +544,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in
if (s->oformat->interleave_packet) {
int ret = s->oformat->interleave_packet(s, out, in, flush);
if (in)
- av_free_packet(in);
+ av_packet_unref(in);
return ret;
} else
return ff_interleave_packet_per_dts(s, out, in, flush);
@@ -590,7 +590,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
if (ret >= 0)
s->streams[opkt.stream_index]->nb_frames++;
- av_free_packet(&opkt);
+ av_packet_unref(&opkt);
if (ret < 0)
return ret;
@@ -616,7 +616,7 @@ int av_write_trailer(AVFormatContext *s)
if (ret >= 0)
s->streams[pkt.stream_index]->nb_frames++;
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
if (ret < 0)
goto fail;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index f434b4a1a3..0f4155ab87 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1855,7 +1855,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
- av_free_packet(&pktl->pkt);
+ av_packet_unref(&pktl->pkt);
av_freep(&pktl);
pktl = next;
}
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index 40d8dac3a7..ee2aee3664 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -83,7 +83,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
- if (ret > 0) av_free_packet(pkt);
+ if (ret > 0) av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 7c8f9e3ad9..6e31d9b0b8 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -711,9 +711,9 @@ static int nsv_read_close(AVFormatContext *s)
av_freep(&nsv->nsvs_file_offset);
av_freep(&nsv->nsvs_timestamps);
if (nsv->ahead[0].data)
- av_free_packet(&nsv->ahead[0]);
+ av_packet_unref(&nsv->ahead[0]);
if (nsv->ahead[1].data)
- av_free_packet(&nsv->ahead[1]);
+ av_packet_unref(&nsv->ahead[1]);
return 0;
}
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index c9fa38aa5b..aeb2fae466 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -276,7 +276,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, hdr, copyhdrsize);
ret = avio_read(pb, pkt->data + copyhdrsize, size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
if (ret < size)
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 573ef0a346..e1371c089e 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -184,7 +184,7 @@ static int str_read_packet(AVFormatContext *s,
if(pkt->size != sector_count*VIDEO_DATA_CHUNK_SIZE){
if(pkt->data)
av_log(s, AV_LOG_ERROR, "missmatching sector_count\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
return AVERROR(EIO);
@@ -263,7 +263,7 @@ static int str_read_close(AVFormatContext *s)
int i;
for(i=0; i<32; i++){
if(str->channels[i].tmp_pkt.data)
- av_free_packet(&str->channels[i].tmp_pkt);
+ av_packet_unref(&str->channels[i].tmp_pkt);
}
return 0;
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 74ca272300..5f2a39801a 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -44,7 +44,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
ret = ffio_read_partial(s->pb, pkt->data, size);
if (ret < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
} else if (ret < size) {
/* initialize end of packet for partial reads to avoid reading
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index a6544c3a60..51de3473da 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -245,7 +245,7 @@ static int rl2_read_packet(AVFormatContext *s,
/** fill the packet */
ret = av_get_packet(pb, pkt, sample->size);
if(ret != sample->size){
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 54ffc15a93..5110b0369c 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -117,7 +117,7 @@ RMStream *ff_rm_alloc_rmstream (void)
void ff_rm_free_rmstream (RMStream *rms)
{
- av_free_packet(&rms->pkt);
+ av_packet_unref(&rms->pkt);
}
static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
@@ -659,7 +659,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
if((seq & 0x7F) == 1 || vst->curpic_num != pic_num){
vst->slices = ((hdr & 0x3F) << 1) + 1;
vst->videobufsize = len2 + 8*vst->slices + 1;
- av_free_packet(&vst->pkt); //FIXME this should be output.
+ av_packet_unref(&vst->pkt); //FIXME this should be output.
if(av_new_packet(&vst->pkt, vst->videobufsize) < 0)
return AVERROR(ENOMEM);
vst->videobufpos = 8*vst->slices + 1;
@@ -879,7 +879,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
if( (st->discard >= AVDISCARD_NONKEY && !(flags&2))
|| st->discard >= AVDISCARD_ALL){
- av_free_packet(pkt);
+ av_packet_unref(pkt);
} else
break;
}
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index b72b8d0691..fdcefdbf72 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -310,7 +310,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(pb, pkt, frame_size);
if (ret != frame_size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
pkt->duration = 1;
@@ -325,7 +325,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
} else {
ret = av_get_packet(pb, pkt, index_entry->size);
if (ret != index_entry->size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 597f29fae3..10a4dcd8ab 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -274,7 +274,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
return 1; // FIXME: return 0 if last packet
}
}
- av_free_packet(pkt);
+ av_packet_unref(pkt);
}
return res == 1 ? -1 : res;
diff --git a/libavformat/rtpdec_mpa_robust.c b/libavformat/rtpdec_mpa_robust.c
index 022cfec313..a65e139cfc 100644
--- a/libavformat/rtpdec_mpa_robust.c
+++ b/libavformat/rtpdec_mpa_robust.c
@@ -136,7 +136,7 @@ static int mpa_robust_parse_packet(AVFormatContext *ctx, PayloadContext *data,
data->split_pos = 0;
if (!data->split_buf) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
memcpy(data->split_buf, buf, data->split_buf_size);
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 002413dec2..f87e8affc9 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -217,7 +217,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
av_freep(&qt->pkt.data);
qt->pkt.data = av_realloc(NULL, qt->remaining * qt->bytes_per_frame);
if (!qt->pkt.data) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
qt->pkt.size = qt->remaining * qt->bytes_per_frame;
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 5e17181ff3..c79cfeb7b5 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -141,7 +141,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
data->split_buf = av_malloc(data->split_buf_size);
if (!data->split_buf) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
}
diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index 0280cead9c..f09222df3c 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -215,7 +215,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
int i = s->nb_streams;
AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
st->id = i;
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 143f0b5ace..97062d5dfc 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
ts_str(dts_buf, pkt.dts, st->time_base);
ts_str(ts_buf, pkt.pts, st->time_base);
printf("ret:%-10s st:%2d flags:%d dts:%s pts:%s pos:%7" PRId64 " size:%6d", ret_str(ret), pkt.stream_index, pkt.flags, dts_buf, ts_buf, pkt.pos, pkt.size);
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
} else
printf("ret:%s", ret_str(ret)); // necessary to avoid trailing whitespace
printf("\n");
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index c6f9c035c5..9be07cbdfa 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -271,7 +271,7 @@ static int vmd_read_packet(AVFormatContext *s,
frame->frame_size);
if (ret != frame->frame_size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
ret = AVERROR(EIO);
}
pkt->stream_index = frame->stream_index;
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 2fb94773a5..a28adf8224 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -188,7 +188,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE;
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR_EOF;
}
ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1);
@@ -196,7 +196,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = spdif_get_offset_and_codec(s, data_type, pkt->data,
&offset, &codec_id);
if (ret) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
@@ -207,7 +207,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
/* first packet, create a stream */
AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/thp.c b/libavformat/thp.c
index e8ca04f939..18d4afea24 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -168,7 +168,7 @@ static int thp_read_packet(AVFormatContext *s,
ret = av_get_packet(pb, pkt, size);
if (ret != size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
@@ -176,7 +176,7 @@ static int thp_read_packet(AVFormatContext *s,
} else {
ret = av_get_packet(pb, pkt, thp->audiosize);
if (ret != thp->audiosize) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index fd96b9d959..94ee9d92f1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -110,7 +110,7 @@ static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
pkt->pos = orig_pos;
if (!pkt->size)
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return pkt->size > orig_size ? pkt->size - orig_size : ret;
}
@@ -426,7 +426,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
av_log(s, AV_LOG_WARNING,
"Dropped corrupted packet (stream = %d)\n",
pkt->stream_index);
- av_free_packet(pkt);
+ av_packet_unref(pkt);
continue;
}
@@ -756,7 +756,7 @@ static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_en
while (*pkt_buf) {
AVPacketList *pktl = *pkt_buf;
*pkt_buf = pktl->next;
- av_free_packet(&pktl->pkt);
+ av_packet_unref(&pktl->pkt);
av_freep(&pktl);
}
*pkt_buf_end = NULL;
@@ -845,7 +845,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
goto fail;
if (!add_to_pktbuf(&s->internal->parse_queue, &out_pkt, &s->internal->parse_queue_end)) {
- av_free_packet(&out_pkt);
+ av_packet_unref(&out_pkt);
ret = AVERROR(ENOMEM);
goto fail;
}
@@ -858,7 +858,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
}
fail:
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
@@ -949,7 +949,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
return ret;
} else {
/* free packet */
- av_free_packet(&cur_pkt);
+ av_packet_unref(&cur_pkt);
}
}
@@ -1450,7 +1450,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
} while (read_status == AVERROR(EAGAIN));
if (read_status < 0)
break;
- av_free_packet(&pkt);
+ av_packet_unref(&pkt);
if (stream_index == pkt.stream_index)
if ((pkt.flags & AV_PKT_FLAG_KEY) && pkt.dts > timestamp)
break;
@@ -1752,7 +1752,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
st->duration = duration;
}
}
- av_free_packet(pkt);
+ av_packet_unref(pkt);
}
} while (end_time == AV_NOPTS_VALUE &&
filesize > (DURATION_MAX_READ_SIZE << retry) &&
@@ -2461,7 +2461,7 @@ void avformat_free_context(AVFormatContext *s)
av_parser_close(st->parser);
}
if (st->attached_pic.data)
- av_free_packet(&st->attached_pic);
+ av_packet_unref(&st->attached_pic);
av_dict_free(&st->metadata);
av_freep(&st->probe_data.buf);
av_free(st->index_entries);
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 49895c03a8..baff8fcb53 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -243,7 +243,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data+2, size);
if (ret<=0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index c8942537cb..c673fad6df 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -288,7 +288,7 @@ static int wc3_read_close(AVFormatContext *s)
Wc3DemuxContext *wc3 = s->priv_data;
if (wc3->vpkt.size > 0)
- av_free_packet(&wc3->vpkt);
+ av_packet_unref(&wc3->vpkt);
return 0;
}
diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index 1f2359e83d..4323914675 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -184,7 +184,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
return AVERROR(EIO);
ret = avio_read(pb, pkt->data, chunk_size);
if (ret != chunk_size) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c
index 75eddd2f50..e9a2a6227e 100644
--- a/libavformat/wvdec.c
+++ b/libavformat/wvdec.c
@@ -269,25 +269,25 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, wc->block_header, WV_HEADER_SIZE);
ret = avio_read(s->pb, pkt->data + WV_HEADER_SIZE, wc->header.blocksize);
if (ret != wc->header.blocksize) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
while (!(wc->header.flags & WV_FLAG_FINAL_BLOCK)) {
if ((ret = wv_read_block_header(s, s->pb)) < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
off = pkt->size;
if ((ret = av_grow_packet(pkt, WV_HEADER_SIZE + wc->header.blocksize)) < 0) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}
memcpy(pkt->data + off, wc->block_header, WV_HEADER_SIZE);
ret = avio_read(s->pb, pkt->data + off + WV_HEADER_SIZE, wc->header.blocksize);
if (ret != wc->header.blocksize) {
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return (ret < 0) ? ret : AVERROR_EOF;
}
}
@@ -334,7 +334,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index,
return ret;
}
pts = pkt->pts;
- av_free_packet(pkt);
+ av_packet_unref(pkt);
} while(pts < timestamp);
return 0;
}
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 1e429d344a..933c57d757 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -168,14 +168,14 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
return yop->audio_block_length;
err_out:
- av_free_packet(&yop->video_packet);
+ av_packet_unref(&yop->video_packet);
return ret;
}
static int yop_read_close(AVFormatContext *s)
{
YopDecContext *yop = s->priv_data;
- av_free_packet(&yop->video_packet);
+ av_packet_unref(&yop->video_packet);
return 0;
}
@@ -200,7 +200,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
if (avio_seek(s->pb, frame_pos, SEEK_SET) < 0)
return -1;
- av_free_packet(&yop->video_packet);
+ av_packet_unref(&yop->video_packet);
yop->odd_frame = timestamp & 1;
return 0;