diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-27 14:35:30 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-27 14:35:30 +0100 |
commit | c2f861ca42fa1a2fb6f7e85abb7bd44f39c6f2c4 (patch) | |
tree | fd5a76e51fa3eb2b90deafbb6c0c48a127be42a9 /libavformat | |
parent | 7f5af80ba42bbd82da53dfd95236e9d47159a96a (diff) |
Replace remaining occurances of av_free_packet with av_packet_unref
Diffstat (limited to 'libavformat')
33 files changed, 50 insertions, 50 deletions
diff --git a/libavformat/adp.c b/libavformat/adp.c index 8a3661ae15..f53375aea0 100644 --- a/libavformat/adp.c +++ b/libavformat/adp.c @@ -78,7 +78,7 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret != size) { if (ret < 0) { - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } av_shrink_packet(pkt, ret); diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 3abd2840f2..09d91a7e4d 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -293,7 +293,7 @@ static int aiff_write_trailer(AVFormatContext *s) while (pict_list) { AVPacketList *next = pict_list->next; - av_free_packet(&pict_list->pkt); + av_packet_unref(&pict_list->pkt); av_freep(&pict_list); pict_list = next; } diff --git a/libavformat/ape.c b/libavformat/ape.c index 69b001a578..352ddc6d77 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -418,7 +418,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); if (ret < 0) { - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index 9b2c634b95..4326a7cd3b 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -192,7 +192,7 @@ static void flush_packet(AVFormatContext *format_context, AVPacket *packet) } ++apng->frame_number; - av_free_packet(apng->prev_packet); + av_packet_unref(apng->prev_packet); if (packet) av_copy_packet(apng->prev_packet, packet); } diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 7c31cfaee4..3865b0ed17 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -298,7 +298,7 @@ static int asf_read_picture(AVFormatContext *s, int len) fail: av_freep(&desc); - av_free_packet(&pkt); + av_packet_unref(&pkt); return ret; } @@ -852,7 +852,7 @@ static int asf_read_header(AVFormatContext *s) if ((ret = av_get_packet(pb, &pkt, len)) < 0) return ret; av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size); - av_free_packet(&pkt); + av_packet_unref(&pkt); len= avio_rl32(pb); get_tag(s, "ASF_Protection_Type", -1, len, 32); len= avio_rl32(pb); @@ -1288,7 +1288,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) "freeing incomplete packet size %d, new %d\n", asf_st->pkt.size, asf_st->packet_obj_size); asf_st->frag_offset = 0; - av_free_packet(&asf_st->pkt); + av_packet_unref(&asf_st->pkt); } /* new packet */ if ((ret = av_new_packet(&asf_st->pkt, asf_st->packet_obj_size)) < 0) @@ -1379,7 +1379,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) if (i == asf_st->pkt.size) { av_log(s, AV_LOG_DEBUG, "discarding ms fart\n"); asf_st->frag_offset = 0; - av_free_packet(&asf_st->pkt); + av_packet_unref(&asf_st->pkt); continue; } } @@ -1476,7 +1476,7 @@ static void asf_reset_header(AVFormatContext *s) for (i = 0; i < 128; i++) { asf_st = &asf->streams[i]; - av_free_packet(&asf_st->pkt); + av_packet_unref(&asf_st->pkt); asf_st->packet_obj_size = 0; asf_st->frag_offset = 0; asf_st->seq = 0; @@ -1538,7 +1538,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, pts = pkt->dts; - av_free_packet(pkt); + av_packet_unref(pkt); if (pkt->flags & AV_PKT_FLAG_KEY) { i = pkt->stream_index; diff --git a/libavformat/avidec.c b/libavformat/avidec.c index d240fa68bd..b7bd54dedf 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1496,7 +1496,7 @@ resync: } if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) { - av_free_packet(pkt); + av_packet_unref(pkt); goto resync; } ast->seek_pos= 0; diff --git a/libavformat/brstm.c b/libavformat/brstm.c index a781163f95..4ac9881c99 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -412,7 +412,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) dst += size; avio_skip(s->pb, skip); if (ret != size) { - av_free_packet(pkt); + av_packet_unref(pkt); break; } } diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 7686f28c62..0180a7e50f 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -511,7 +511,7 @@ static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt) ret = 1; } if (ret > 0) { - av_free_packet(pkt); + av_packet_unref(pkt); pkt2.buf = av_buffer_create(pkt2.data, pkt2.size, av_buffer_default_free, NULL, 0); if (!pkt2.buf) { diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index ae180f6de3..8601782afa 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -612,7 +612,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) if (partial_packet) { avpriv_request_sample(s, "video header followed by audio packet"); - av_free_packet(pkt); + av_packet_unref(pkt); partial_packet = 0; } @@ -736,7 +736,7 @@ get_video_packet: } if (ret < 0 && partial_packet) - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index b743c872c0..59443b6985 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -632,7 +632,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = ffm->header[0]; if ((unsigned)pkt->stream_index >= s->nb_streams) { av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index); - av_free_packet(pkt); + av_packet_unref(pkt); ffm->read_state = READ_HEADER; return -1; } @@ -643,7 +643,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) ffm->read_state = READ_HEADER; if (ffm_read_data(s, pkt->data, size, 0) != size) { /* bad case: desynchronized packet. we cancel all the packet loading */ - av_free_packet(pkt); + av_packet_unref(pkt); return -1; } pkt->pts = AV_RB64(ffm->header+8); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 4c7ee59ec5..cc3ed830a9 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -267,7 +267,7 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde &out_pkt.data, &out_pkt.size, pkt.data, pkt.size, pkt.pts, pkt.dts, *ppos); - av_free_packet(&pkt); + av_packet_unref(&pkt); if (out_pkt.size){ int size = out_pkt.size; if (parser->pts != AV_NOPTS_VALUE){ diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 7b434498ea..ca73969315 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -1143,7 +1143,7 @@ leave: av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 11); avio_seek(s->pb, pos + 1, SEEK_SET); ret = resync(s); - av_free_packet(pkt); + av_packet_unref(pkt); if (ret >= 0) { goto retry; } diff --git a/libavformat/gif.c b/libavformat/gif.c index e5d558df07..6537e557d6 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -173,7 +173,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) avio_write(pb, pkt->data, pkt->size); - av_free_packet(gif->prev_pkt); + av_packet_unref(gif->prev_pkt); if (new) av_copy_packet(gif->prev_pkt, new); diff --git a/libavformat/iff.c b/libavformat/iff.c index 5973cde8fe..2889083151 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -738,7 +738,7 @@ static int iff_read_packet(AVFormatContext *s, bytestream_put_be16(&buf, 2); ret = avio_read(pb, buf, iff->body_size); if (ret<0) { - av_free_packet(pkt); + av_packet_unref(pkt); } else if (ret < iff->body_size) av_shrink_packet(pkt, ret + 2); } else { diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index efc9304fe0..7f0ff19ba3 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -157,11 +157,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) (ret = avformat_write_header(fmt, NULL)) < 0 || (ret = av_interleaved_write_frame(fmt, &pkt2)) < 0 || (ret = av_write_trailer(fmt)) < 0) { - av_free_packet(&pkt2); + av_packet_unref(&pkt2); avformat_free_context(fmt); return ret; } - av_free_packet(&pkt2); + av_packet_unref(&pkt2); avformat_free_context(fmt); } else { avio_write(pb[0], pkt->data, pkt->size); diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c index 158a63039f..75699e89b4 100644 --- a/libavformat/libmodplug.c +++ b/libavformat/libmodplug.c @@ -325,7 +325,7 @@ static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE); if (pkt->size <= 0) { - av_free_packet(pkt); + av_packet_unref(pkt); return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO); } return 0; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 78ab28742e..8d7db90e1b 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2750,7 +2750,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, additional_size + 8); if (!side_data) { - av_free_packet(pkt); + av_packet_unref(pkt); av_free(pkt); return AVERROR(ENOMEM); } @@ -2763,7 +2763,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, AV_PKT_DATA_SKIP_SAMPLES, 10); if (!side_data) { - av_free_packet(pkt); + av_packet_unref(pkt); av_free(pkt); return AVERROR(ENOMEM); } diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 61dcf4c875..3646994c43 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -440,10 +440,10 @@ concatenate: return ret; if (info->num_blocks != 6) return 0; - av_free_packet(pkt); + av_packet_unref(pkt); if ((ret = av_copy_packet(pkt, &info->pkt)) < 0) return ret; - av_free_packet(&info->pkt); + av_packet_unref(&info->pkt); info->num_blocks = 0; } @@ -498,7 +498,7 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track) av_free(buf); end: - av_free_packet(&info->pkt); + av_packet_unref(&info->pkt); av_freep(&track->eac3_priv); return size; @@ -4606,7 +4606,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s, end.stream_index = stream_index; ret = mov_write_single_packet(s, &end); - av_free_packet(&end); + av_packet_unref(&end); return ret; } diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 55f2b3fb68..fb77d892d5 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -956,12 +956,12 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = idx_pkt.pos; pkt->stream_index = idx_pkt.stream_index; - av_free_packet(&idx_pkt); + av_packet_unref(&idx_pkt); return 0; fail: - av_free_packet(pkt); - av_free_packet(&idx_pkt); + av_packet_unref(pkt); + av_packet_unref(&idx_pkt); return ret; } diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 28ec43ee98..0f0f5036ca 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2654,7 +2654,7 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) ts->pkt = pkt; ret = handle_packets(ts, 0); if (ret < 0) { - av_free_packet(ts->pkt); + av_packet_unref(ts->pkt); /* flush pes data left */ for (i = 0; i < NB_PID_MAX; i++) if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) { @@ -2743,7 +2743,7 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, ret = av_read_frame(s, &pkt); if (ret < 0) return AV_NOPTS_VALUE; - av_free_packet(&pkt); + av_packet_unref(&pkt); if (pkt.dts != AV_NOPTS_VALUE && pkt.pos >= 0) { ff_reduce_index(s, pkt.stream_index); av_add_index_entry(s->streams[pkt.stream_index], pkt.pos, pkt.dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index deceb032e5..62427fc092 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -1157,7 +1157,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) return 0; fail: - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 9682ee9fca..2d99b4af25 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -844,7 +844,7 @@ retry: return psize; fail: - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR(ENOMEM); } diff --git a/libavformat/redspark.c b/libavformat/redspark.c index 66c2dc5aae..5cea6e96b9 100644 --- a/libavformat/redspark.c +++ b/libavformat/redspark.c @@ -148,7 +148,7 @@ static int redspark_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 AVERROR(EIO); } diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 13702f25fc..4ec78efe69 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -783,7 +783,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); if ((ret = avio_read(pb, pkt->data + 9, len)) != len) { - av_free_packet(pkt); + av_packet_unref(pkt); av_log(s, AV_LOG_ERROR, "Failed to read %d bytes\n", len); return ret < 0 ? ret : AVERROR(EIO); } diff --git a/libavformat/sdr2.c b/libavformat/sdr2.c index 82405f69d1..edb454caec 100644 --- a/libavformat/sdr2.c +++ b/libavformat/sdr2.c @@ -95,7 +95,7 @@ static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(pkt->data, header, 24); ret = avio_read(s->pb, pkt->data + 24, next - 52); if (ret < 0) { - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } av_shrink_packet(pkt, ret + 24); diff --git a/libavformat/siff.c b/libavformat/siff.c index b6ea390598..028f18be16 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -219,7 +219,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) if (c->gmcsize) memcpy(pkt->data + 2, c->gmc, c->gmcsize); if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) { - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR_INVALIDDATA; } pkt->stream_index = 0; diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index bb8976682d..471d600c10 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -179,7 +179,7 @@ static void drop_dups(void *log_ctx, FFDemuxSubtitlesQueue *q) q->subs[i].stream_index == last->stream_index && !strcmp(q->subs[i].data, last->data)) { - av_free_packet(&q->subs[i]); + av_packet_unref(&q->subs[i]); drop++; } else if (drop) { q->subs[last_id + 1] = q->subs[i]; @@ -302,7 +302,7 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q) int i; for (i = 0; i < q->nb_subs; i++) - av_free_packet(&q->subs[i]); + av_packet_unref(&q->subs[i]); av_freep(&q->subs); q->nb_subs = q->allocated_size = q->current_sub_idx = 0; } diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 68cd8561fb..e596ffaa92 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -479,7 +479,7 @@ bitmap_end_skip: if ((res = av_new_packet(pkt, len)) < 0) return res; if (avio_read(pb, pkt->data, 4) != 4) { - av_free_packet(pkt); + av_packet_unref(pkt); return AVERROR_INVALIDDATA; } if (AV_RB32(pkt->data) == 0xffd8ffd9 || @@ -496,7 +496,7 @@ bitmap_end_skip: } if (res != pkt->size) { if (res < 0) { - av_free_packet(pkt); + av_packet_unref(pkt); return res; } av_shrink_packet(pkt, res); diff --git a/libavformat/tee.c b/libavformat/tee.c index e9fccc17d6..af52a490c6 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -424,7 +424,7 @@ static int filter_packet(void *log_ctx, AVPacket *pkt, } if (ret > 0) { - av_free_packet(pkt); + av_packet_unref(pkt); new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, av_buffer_default_free, NULL, 0); if (!new_pkt.buf) diff --git a/libavformat/utils.c b/libavformat/utils.c index 4044db32ea..3dc64da56f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1403,7 +1403,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) if (pkt->flags & AV_PKT_FLAG_KEY) st->skip_to_keyframe = 0; if (st->skip_to_keyframe) { - av_free_packet(&cur_pkt); + av_packet_unref(&cur_pkt); if (got_packet) { *pkt = cur_pkt; } diff --git a/libavformat/vivo.c b/libavformat/vivo.c index 7287379801..10d81b9142 100644 --- a/libavformat/vivo.c +++ b/libavformat/vivo.c @@ -298,7 +298,7 @@ restart: fail: if (ret < 0) - av_free_packet(pkt); + av_packet_unref(pkt); return ret; } diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c index 69270c63c4..2a21730f1b 100644 --- a/libavformat/webpenc.c +++ b/libavformat/webpenc.c @@ -140,7 +140,7 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts) avio_w8(s->pb, 0); } avio_write(s->pb, w->last_pkt.data + skip, w->last_pkt.size - skip); - av_free_packet(&w->last_pkt); + av_packet_unref(&w->last_pkt); } return 0; diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index 8aebdddf03..0894b7fe60 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -826,7 +826,7 @@ static int write_trailer(AVFormatContext *s) av_free(wctx->sp_pairs); av_free(wctx->st_pairs); - av_free_packet(&wctx->thumbnail); + av_packet_unref(&wctx->thumbnail); return 0; } |