History

Replace remaining occurances of av_free_packet with av_packet_unref

Hendrik Leppkes committed 11 years ago

Commit c2f861c1 parent 7f5af8059 files · +99 −99Browse files

Unified · Split

59 files
  1. doc/examples/decoding_encoding.c +1 −1
  2. doc/examples/demuxing_decoding.c +1 −1
  3. doc/examples/extract_mvs.c +1 −1
  4. doc/examples/filtering_audio.c +2 −2
  5. doc/examples/filtering_video.c +1 −1
  6. doc/examples/remuxing.c +1 −1
  7. doc/examples/transcoding.c +2 −2
  8. ffmpeg.c +7 −7
  9. ffplay.c +5 −5
  10. ffserver.c +4 −4
  11. libavcodec/avpacket.c +2 −2
  12. libavcodec/libopusenc.c +2 −2
  13. libavcodec/libvpxenc.c +1 −1
  14. libavcodec/utils.c +2 −2
  15. libavdevice/decklink_dec.cpp +1 −1
  16. libavdevice/dshow.c +1 −1
  17. libavdevice/openal-dec.c +1 −1
  18. libavfilter/lavfutils.c +1 −1
  19. libavfilter/src_movie.c +3 −3
  20. libavfilter/vf_mcdeint.c +1 −1
  21. libavfilter/vf_subtitles.c +1 −1
  22. libavformat/adp.c +1 −1
  23. libavformat/aiffenc.c +1 −1
  24. libavformat/ape.c +1 −1
  25. libavformat/apngenc.c +1 −1
  26. libavformat/asfdec_f.c +6 −6
  27. libavformat/avidec.c +1 −1
  28. libavformat/brstm.c +1 −1
  29. libavformat/concatdec.c +1 −1
  30. libavformat/electronicarts.c +2 −2
  31. libavformat/ffmdec.c +2 −2
  32. libavformat/flacdec.c +1 −1
  33. libavformat/flvdec.c +1 −1
  34. libavformat/gif.c +1 −1
  35. libavformat/iff.c +1 −1
  36. libavformat/img2enc.c +2 −2
  37. libavformat/libmodplug.c +1 −1
  38. libavformat/matroskadec.c +2 −2
  39. libavformat/movenc.c +4 −4
  40. libavformat/mpeg.c +3 −3
  41. libavformat/mpegts.c +2 −2
  42. libavformat/nutdec.c +1 −1
  43. libavformat/oggdec.c +1 −1
  44. libavformat/redspark.c +1 −1
  45. libavformat/rmdec.c +1 −1
  46. libavformat/sdr2.c +1 −1
  47. libavformat/siff.c +1 −1
  48. libavformat/subtitles.c +2 −2
  49. libavformat/swfdec.c +2 −2
  50. libavformat/tee.c +1 −1
  51. libavformat/utils.c +1 −1
  52. libavformat/vivo.c +1 −1
  53. libavformat/webpenc.c +1 −1
  54. libavformat/wtvenc.c +1 −1
  55. tests/api/api-band-test.c +2 −2
  56. tests/api/api-flac-test.c +1 −1
  57. tests/api/api-h264-test.c +2 −2
  58. tests/api/api-seek-test.c +2 −2
  59. tools/seek_print.c +1 −1
doc/examples/decoding_encoding.c+1−1
@@ -211,7 +211,7 @@ static void audio_encode_example(const char *filename) · 210 unmodified lines
211211 }
212212 if (got_output) {
213213 fwrite(pkt.data, 1, pkt.size, f);
214− av_free_packet(&pkt);
214+ av_packet_unref(&pkt);
215215 }
216216 }
217217
doc/examples/demuxing_decoding.c+1−1
@@ -326,7 +326,7 @@ int main (int argc, char **argv) · 325 unmodified lines
326326 pkt.data += ret;
327327 pkt.size -= ret;
328328 } while (pkt.size > 0);
329− av_free_packet(&orig_pkt);
329+ av_packet_unref(&orig_pkt);
330330 }
331331
332332 /* flush cached frames */
doc/examples/extract_mvs.c+1−1
@@ -167,7 +167,7 @@ int main(int argc, char **argv) · 166 unmodified lines
167167 pkt.data += ret;
168168 pkt.size -= ret;
169169 } while (pkt.size > 0);
170− av_free_packet(&orig_pkt);
170+ av_packet_unref(&orig_pkt);
171171 }
172172
173173 /* flush cached frames */
doc/examples/filtering_audio.c+2−2
@@ -273,10 +273,10 @@ int main(int argc, char **argv) · 272 unmodified lines
273273 }
274274
275275 if (packet.size <= 0)
276− av_free_packet(&packet0);
276+ av_packet_unref(&packet0);
277277 } else {
278278 /* discard non-wanted packets */
279− av_free_packet(&packet0);
279+ av_packet_unref(&packet0);
280280 }
281281 }
282282 end:
doc/examples/filtering_video.c+1−1
@@ -262,7 +262,7 @@ int main(int argc, char **argv) · 261 unmodified lines
262262 av_frame_unref(frame);
263263 }
264264 }
265− av_free_packet(&packet);
265+ av_packet_unref(&packet);
266266 }
267267 end:
268268 avfilter_graph_free(&filter_graph);
doc/examples/remuxing.c+1−1
@@ -143,7 +143,7 @@ int main(int argc, char **argv) · 142 unmodified lines
143143 fprintf(stderr, "Error muxing packet\n");
144144 break;
145145 }
146− av_free_packet(&pkt);
146+ av_packet_unref(&pkt);
147147 }
148148
149149 av_write_trailer(ofmt_ctx);
doc/examples/transcoding.c+2−2
@@ -536,7 +536,7 @@ int main(int argc, char **argv) · 535 unmodified lines
536536 if (ret < 0)
537537 goto end;
538538 }
539− av_free_packet(&packet);
539+ av_packet_unref(&packet);
540540 }
541541
542542 /* flush filters and encoders */
@@ -560,7 +560,7 @@ int main(int argc, char **argv) · 17 unmodified lines
560560
561561 av_write_trailer(ofmt_ctx);
562562 end:
563− av_free_packet(&packet);
563+ av_packet_unref(&packet);
564564 av_frame_free(&frame);
565565 for (i = 0; i < ifmt_ctx->nb_streams; i++) {
566566 avcodec_close(ifmt_ctx->streams[i]->codec);
ffmpeg.c+7−7
@@ -653,7 +653,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 652 unmodified lines
653653 */
654654 if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) {
655655 if (ost->frame_number >= ost->max_frames) {
656− av_free_packet(pkt);
656+ av_packet_unref(pkt);
657657 return;
658658 }
659659 ost->frame_number++;
@@ -700,7 +700,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 40 unmodified lines
700700 if (a > 0) {
701701 pkt->side_data = NULL;
702702 pkt->side_data_elems = 0;
703− av_free_packet(pkt);
703+ av_packet_unref(pkt);
704704 new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size,
705705 av_buffer_default_free, NULL, 0);
706706 if (!new_pkt.buf)
@@ -777,7 +777,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 70 unmodified lines
777777 main_return_code = 1;
778778 close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
779779 }
780− av_free_packet(pkt);
780+ av_packet_unref(pkt);
781781 }
782782
783783 static void close_output_stream(OutputStream *ost)
@@ -1754,7 +1754,7 @@ static void flush_encoders(void) · 970 unmodified lines
17541754 break;
17551755 }
17561756 if (ost->finished & MUXER_FINISHED) {
1757− av_free_packet(&pkt);
1757+ av_packet_unref(&pkt);
17581758 continue;
17591759 }
17601760 av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
@@ -3521,7 +3521,7 @@ static void *input_thread(void *arg) · 1760 unmodified lines
35213521 av_log(f->ctx, AV_LOG_ERROR,
35223522 "Unable to send packet to main thread: %s\n",
35233523 av_err2str(ret));
3524− av_free_packet(&pkt);
3524+ av_packet_unref(&pkt);
35253525 av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
35263526 break;
35273527 }
@@ -3542,7 +3542,7 @@ static void free_input_threads(void) · 14 unmodified lines
35423542 continue;
35433543 av_thread_message_queue_set_err_send(f->in_thread_queue, AVERROR_EOF);
35443544 while (av_thread_message_queue_recv(f->in_thread_queue, &pkt, 0) >= 0)
3545− av_free_packet(&pkt);
3545+ av_packet_unref(&pkt);
35463546
35473547 pthread_join(f->thread, NULL);
35483548 f->joined = 1;
@@ -3945,7 +3945,7 @@ static int process_input(int file_index) · 396 unmodified lines
39453945 process_input_packet(ist, &pkt, 0);
39463946
39473947 discard_packet:
3948− av_free_packet(&pkt);
3948+ av_packet_unref(&pkt);
39493949
39503950 return 0;
39513951 }
ffplay.c+5−5
@@ -432,7 +432,7 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt) · 431 unmodified lines
432432 SDL_UnlockMutex(q->mutex);
433433
434434 if (pkt != &flush_pkt && ret < 0)
435− av_free_packet(pkt);
435+ av_packet_unref(pkt);
436436
437437 return ret;
438438 }
@@ -472,7 +472,7 @@ static void packet_queue_flush(PacketQueue *q) · 33 unmodified lines
472472 SDL_LockMutex(q->mutex);
473473 for (pkt = q->first_pkt; pkt; pkt = pkt1) {
474474 pkt1 = pkt->next;
475− av_free_packet(&pkt->pkt);
475+ av_packet_unref(&pkt->pkt);
476476 av_freep(&pkt);
477477 }
478478 q->last_pkt = NULL;
@@ -577,7 +577,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { · 98 unmodified lines
577577 d->next_pts_tb = d->start_pts_tb;
578578 }
579579 } while (pkt.data == flush_pkt.data || d->queue->serial != d->pkt_serial);
580− av_free_packet(&d->pkt);
580+ av_packet_unref(&d->pkt);
581581 d->pkt_temp = d->pkt = pkt;
582582 d->packet_pending = 1;
583583 }
@@ -641,7 +641,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { · 57 unmodified lines
641641 }
642642
643643 static void decoder_destroy(Decoder *d) {
644− av_free_packet(&d->pkt);
644+ av_packet_unref(&d->pkt);
645645 }
646646
647647 static void frame_queue_unref_item(Frame *vp)
@@ -3119,7 +3119,7 @@ static int read_thread(void *arg) · 2471 unmodified lines
31193119 } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) {
31203120 packet_queue_put(&is->subtitleq, pkt);
31213121 } else {
3122− av_free_packet(pkt);
3122+ av_packet_unref(pkt);
31233123 }
31243124 }
31253125
ffserver.c+4−4
@@ -2318,7 +2318,7 @@ static int http_prepare_data(HTTPContext *c) · 2317 unmodified lines
23182318 c->packet_stream_index = pkt.stream_index;
23192319 ctx = c->rtp_ctx[c->packet_stream_index];
23202320 if(!ctx) {
2321− av_free_packet(&pkt);
2321+ av_packet_unref(&pkt);
23222322 break;
23232323 }
23242324 codec = ctx->streams[0]->codec;
@@ -2370,11 +2370,11 @@ static int http_prepare_data(HTTPContext *c) · 45 unmodified lines
23702370
23712371 codec->frame_number++;
23722372 if (len == 0) {
2373− av_free_packet(&pkt);
2373+ av_packet_unref(&pkt);
23742374 goto redo;
23752375 }
23762376 }
2377− av_free_packet(&pkt);
2377+ av_packet_unref(&pkt);
23782378 }
23792379 }
23802380 break;
@@ -3548,7 +3548,7 @@ static void extract_mpeg4_header(AVFormatContext *infile) · 1167 unmodified lines
35483548 }
35493549 mpeg4_count--;
35503550 }
3551− av_free_packet(&pkt);
3551+ av_packet_unref(&pkt);
35523552 }
35533553 }
35543554
libavcodec/avpacket.c+2−2
@@ -179,7 +179,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup) · 178 unmodified lines
179179 return 0;
180180
181181 failed_alloc:
182− av_free_packet(pkt);
182+ av_packet_unref(pkt);
183183 return AVERROR(ENOMEM);
184184 }
185185
@@ -342,7 +342,7 @@ int av_packet_merge_side_data(AVPacket *pkt){ · 156 unmodified lines
342342 bytestream_put_be64(&p, FF_MERGE_MARKER);
343343 av_assert0(p-pkt->data == pkt->size);
344344 memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE);
345− av_free_packet(&old);
345+ av_packet_unref(&old);
346346 pkt->side_data_elems = 0;
347347 pkt->side_data = NULL;
348348 return 1;
libavcodec/libopusenc.c+2−2
@@ -361,7 +361,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, · 360 unmodified lines
361361 discard_padding = opus->opts.packet_size - avpkt->duration;
362362 // Check if subtraction resulted in an overflow
363363 if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) {
364− av_free_packet(avpkt);
364+ av_packet_unref(avpkt);
365365 av_free(avpkt);
366366 return AVERROR(EINVAL);
367367 }
@@ -370,7 +370,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, · 2 unmodified lines
370370 AV_PKT_DATA_SKIP_SAMPLES,
371371 10);
372372 if(!side_data) {
373− av_free_packet(avpkt);
373+ av_packet_unref(avpkt);
374374 av_free(avpkt);
375375 return AVERROR(ENOMEM);
376376 }
libavcodec/libvpxenc.c+1−1
@@ -733,7 +733,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 732 unmodified lines
733733 AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
734734 cx_frame->sz_alpha + 8);
735735 if(!side_data) {
736− av_free_packet(pkt);
736+ av_packet_unref(pkt);
737737 av_free(pkt);
738738 return AVERROR(ENOMEM);
739739 }
libavcodec/utils.c+2−2
@@ -2353,7 +2353,7 @@ static int recode_subtitle(AVCodecContext *avctx, · 2352 unmodified lines
23532353 ret = FFMIN(AVERROR(errno), -1);
23542354 av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" "
23552355 "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc);
2356− av_free_packet(&tmp);
2356+ av_packet_unref(&tmp);
23572357 goto end;
23582358 }
23592359 outpkt->size -= outl;
@@ -2460,7 +2460,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, · 100 unmodified lines
24602460 pkt_recoded.side_data = NULL;
24612461 pkt_recoded.side_data_elems = 0;
24622462
2463− av_free_packet(&pkt_recoded);
2463+ av_packet_unref(&pkt_recoded);
24642464 }
24652465 if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
24662466 sub->format = 0;
libavdevice/decklink_dec.cpp+1−1
@@ -48,7 +48,7 @@ static void avpacket_queue_flush(AVPacketQueue *q) · 47 unmodified lines
4848 pthread_mutex_lock(&q->mutex);
4949 for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
5050 pkt1 = pkt->next;
51− av_free_packet(&pkt->pkt);
51+ av_packet_unref(&pkt->pkt);
5252 av_freep(&pkt);
5353 }
5454 q->last_pkt = NULL;
libavdevice/dshow.c+1−1
@@ -119,7 +119,7 @@ dshow_read_close(AVFormatContext *s) · 118 unmodified lines
119119 pktl = ctx->pktl;
120120 while (pktl) {
121121 AVPacketList *next = pktl->next;
122− av_free_packet(&pktl->pkt);
122+ av_packet_unref(&pktl->pkt);
123123 av_free(pktl);
124124 pktl = next;
125125 }
libavdevice/openal-dec.c+1−1
@@ -204,7 +204,7 @@ static int read_packet(AVFormatContext* ctx, AVPacket *pkt) · 203 unmodified lines
204204 fail:
205205 /* Handle failure */
206206 if (pkt->data)
207− av_free_packet(pkt);
207+ av_packet_unref(pkt);
208208 if (error_msg)
209209 av_log(ctx, AV_LOG_ERROR, "Error: %s\n", error_msg);
210210 return error;
libavfilter/lavfutils.c+1−1
@@ -95,7 +95,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], · 94 unmodified lines
9595 av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h);
9696
9797 end:
98− av_free_packet(&pkt);
98+ av_packet_unref(&pkt);
9999 avcodec_close(codec_ctx);
100100 avformat_close_input(&format_ctx);
101101 av_frame_free(&frame);
libavfilter/src_movie.c+3−3
@@ -490,7 +490,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 489 unmodified lines
490490 pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 :
491491 movie->out_index[pkt->stream_index];
492492 if (pkt_out_id < 0) {
493− av_free_packet(&movie->pkt0);
493+ av_packet_unref(&movie->pkt0);
494494 pkt->size = 0; /* ready for next run */
495495 pkt->data = NULL;
496496 return 0;
@@ -517,7 +517,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 20 unmodified lines
517517 if (ret < 0) {
518518 av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret));
519519 av_frame_free(&frame);
520− av_free_packet(&movie->pkt0);
520+ av_packet_unref(&movie->pkt0);
521521 movie->pkt.size = 0;
522522 movie->pkt.data = NULL;
523523 return 0;
@@ -528,7 +528,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 4 unmodified lines
528528 pkt->data += ret;
529529 pkt->size -= ret;
530530 if (pkt->size <= 0) {
531− av_free_packet(&movie->pkt0);
531+ av_packet_unref(&movie->pkt0);
532532 pkt->size = 0; /* ready for next run */
533533 pkt->data = NULL;
534534 }
libavfilter/vf_mcdeint.c+1−1
@@ -277,7 +277,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) · 276 unmodified lines
277277 mcdeint->parity ^= 1;
278278
279279 end:
280− av_free_packet(&pkt);
280+ av_packet_unref(&pkt);
281281 av_frame_free(&inpic);
282282 if (ret < 0) {
283283 av_frame_free(&outpic);
libavfilter/vf_subtitles.c+1−1
@@ -444,7 +444,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx) · 443 unmodified lines
444444 }
445445 }
446446 }
447− av_free_packet(&pkt);
447+ av_packet_unref(&pkt);
448448 avsubtitle_free(&sub);
449449 }
450450
libavformat/adp.c+1−1
@@ -78,7 +78,7 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt) · 77 unmodified lines
7878
7979 if (ret != size) {
8080 if (ret < 0) {
81− av_free_packet(pkt);
81+ av_packet_unref(pkt);
8282 return ret;
8383 }
8484 av_shrink_packet(pkt, ret);
libavformat/aiffenc.c+1−1
@@ -293,7 +293,7 @@ static int aiff_write_trailer(AVFormatContext *s) · 292 unmodified lines
293293
294294 while (pict_list) {
295295 AVPacketList *next = pict_list->next;
296− av_free_packet(&pict_list->pkt);
296+ av_packet_unref(&pict_list->pkt);
297297 av_freep(&pict_list);
298298 pict_list = next;
299299 }
libavformat/ape.c+1−1
@@ -418,7 +418,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) · 417 unmodified lines
418418 AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
419419 ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
420420 if (ret < 0) {
421− av_free_packet(pkt);
421+ av_packet_unref(pkt);
422422 return ret;
423423 }
424424
libavformat/apngenc.c+1−1
@@ -192,7 +192,7 @@ static void flush_packet(AVFormatContext *format_context, AVPacket *packet) · 191 unmodified lines
192192 }
193193 ++apng->frame_number;
194194
195− av_free_packet(apng->prev_packet);
195+ av_packet_unref(apng->prev_packet);
196196 if (packet)
197197 av_copy_packet(apng->prev_packet, packet);
198198 }
libavformat/asfdec_f.c+6−6
@@ -298,7 +298,7 @@ static int asf_read_picture(AVFormatContext *s, int len) · 297 unmodified lines
298298
299299 fail:
300300 av_freep(&desc);
301− av_free_packet(&pkt);
301+ av_packet_unref(&pkt);
302302 return ret;
303303 }
304304
@@ -852,7 +852,7 @@ static int asf_read_header(AVFormatContext *s) · 547 unmodified lines
852852 if ((ret = av_get_packet(pb, &pkt, len)) < 0)
853853 return ret;
854854 av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size);
855− av_free_packet(&pkt);
855+ av_packet_unref(&pkt);
856856 len= avio_rl32(pb);
857857 get_tag(s, "ASF_Protection_Type", -1, len, 32);
858858 len= avio_rl32(pb);
@@ -1288,7 +1288,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) · 429 unmodified lines
12881288 "freeing incomplete packet size %d, new %d\n",
12891289 asf_st->pkt.size, asf_st->packet_obj_size);
12901290 asf_st->frag_offset = 0;
1291− av_free_packet(&asf_st->pkt);
1291+ av_packet_unref(&asf_st->pkt);
12921292 }
12931293 /* new packet */
12941294 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) · 84 unmodified lines
13791379 if (i == asf_st->pkt.size) {
13801380 av_log(s, AV_LOG_DEBUG, "discarding ms fart\n");
13811381 asf_st->frag_offset = 0;
1382− av_free_packet(&asf_st->pkt);
1382+ av_packet_unref(&asf_st->pkt);
13831383 continue;
13841384 }
13851385 }
@@ -1476,7 +1476,7 @@ static void asf_reset_header(AVFormatContext *s) · 90 unmodified lines
14761476
14771477 for (i = 0; i < 128; i++) {
14781478 asf_st = &asf->streams[i];
1479− av_free_packet(&asf_st->pkt);
1479+ av_packet_unref(&asf_st->pkt);
14801480 asf_st->packet_obj_size = 0;
14811481 asf_st->frag_offset = 0;
14821482 asf_st->seq = 0;
@@ -1538,7 +1538,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, · 55 unmodified lines
15381538
15391539 pts = pkt->dts;
15401540
1541− av_free_packet(pkt);
1541+ av_packet_unref(pkt);
15421542 if (pkt->flags & AV_PKT_FLAG_KEY) {
15431543 i = pkt->stream_index;
15441544
libavformat/avidec.c+1−1
@@ -1496,7 +1496,7 @@ resync: · 1495 unmodified lines
14961496 }
14971497
14981498 if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) {
1499− av_free_packet(pkt);
1499+ av_packet_unref(pkt);
15001500 goto resync;
15011501 }
15021502 ast->seek_pos= 0;
libavformat/brstm.c+1−1
@@ -412,7 +412,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 411 unmodified lines
412412 dst += size;
413413 avio_skip(s->pb, skip);
414414 if (ret != size) {
415− av_free_packet(pkt);
415+ av_packet_unref(pkt);
416416 break;
417417 }
418418 }
libavformat/concatdec.c+1−1
@@ -511,7 +511,7 @@ static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt) · 510 unmodified lines
511511 ret = 1;
512512 }
513513 if (ret > 0) {
514− av_free_packet(pkt);
514+ av_packet_unref(pkt);
515515 pkt2.buf = av_buffer_create(pkt2.data, pkt2.size,
516516 av_buffer_default_free, NULL, 0);
517517 if (!pkt2.buf) {
libavformat/electronicarts.c+2−2
@@ -612,7 +612,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) · 611 unmodified lines
612612
613613 if (partial_packet) {
614614 avpriv_request_sample(s, "video header followed by audio packet");
615− av_free_packet(pkt);
615+ av_packet_unref(pkt);
616616 partial_packet = 0;
617617 }
618618
@@ -736,7 +736,7 @@ get_video_packet: · 117 unmodified lines
736736 }
737737
738738 if (ret < 0 && partial_packet)
739− av_free_packet(pkt);
739+ av_packet_unref(pkt);
740740 return ret;
741741 }
742742
libavformat/ffmdec.c+2−2
@@ -632,7 +632,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) · 631 unmodified lines
632632 pkt->stream_index = ffm->header[0];
633633 if ((unsigned)pkt->stream_index >= s->nb_streams) {
634634 av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index);
635− av_free_packet(pkt);
635+ av_packet_unref(pkt);
636636 ffm->read_state = READ_HEADER;
637637 return -1;
638638 }
@@ -643,7 +643,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines
643643 ffm->read_state = READ_HEADER;
644644 if (ffm_read_data(s, pkt->data, size, 0) != size) {
645645 /* bad case: desynchronized packet. we cancel all the packet loading */
646− av_free_packet(pkt);
646+ av_packet_unref(pkt);
647647 return -1;
648648 }
649649 pkt->pts = AV_RB64(ffm->header+8);
libavformat/flacdec.c+1−1
@@ -267,7 +267,7 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde · 266 unmodified lines
267267 &out_pkt.data, &out_pkt.size, pkt.data, pkt.size,
268268 pkt.pts, pkt.dts, *ppos);
269269
270− av_free_packet(&pkt);
270+ av_packet_unref(&pkt);
271271 if (out_pkt.size){
272272 int size = out_pkt.size;
273273 if (parser->pts != AV_NOPTS_VALUE){
libavformat/flvdec.c+1−1
@@ -1143,7 +1143,7 @@ leave: · 1142 unmodified lines
11431143 av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 11);
11441144 avio_seek(s->pb, pos + 1, SEEK_SET);
11451145 ret = resync(s);
1146− av_free_packet(pkt);
1146+ av_packet_unref(pkt);
11471147 if (ret >= 0) {
11481148 goto retry;
11491149 }
libavformat/gif.c+1−1
@@ -173,7 +173,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) · 172 unmodified lines
173173
174174 avio_write(pb, pkt->data, pkt->size);
175175
176− av_free_packet(gif->prev_pkt);
176+ av_packet_unref(gif->prev_pkt);
177177 if (new)
178178 av_copy_packet(gif->prev_pkt, new);
179179
libavformat/iff.c+1−1
@@ -738,7 +738,7 @@ static int iff_read_packet(AVFormatContext *s, · 737 unmodified lines
738738 bytestream_put_be16(&buf, 2);
739739 ret = avio_read(pb, buf, iff->body_size);
740740 if (ret<0) {
741− av_free_packet(pkt);
741+ av_packet_unref(pkt);
742742 } else if (ret < iff->body_size)
743743 av_shrink_packet(pkt, ret + 2);
744744 } else {
libavformat/img2enc.c+2−2
@@ -157,11 +157,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 156 unmodified lines
157157 (ret = avformat_write_header(fmt, NULL)) < 0 ||
158158 (ret = av_interleaved_write_frame(fmt, &pkt2)) < 0 ||
159159 (ret = av_write_trailer(fmt)) < 0) {
160− av_free_packet(&pkt2);
160+ av_packet_unref(&pkt2);
161161 avformat_free_context(fmt);
162162 return ret;
163163 }
164− av_free_packet(&pkt2);
164+ av_packet_unref(&pkt2);
165165 avformat_free_context(fmt);
166166 } else {
167167 avio_write(pb[0], pkt->data, pkt->size);
libavformat/libmodplug.c+1−1
@@ -325,7 +325,7 @@ static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt) · 324 unmodified lines
325325
326326 pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
327327 if (pkt->size <= 0) {
328− av_free_packet(pkt);
328+ av_packet_unref(pkt);
329329 return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
330330 }
331331 return 0;
libavformat/matroskadec.c+2−2
@@ -2750,7 +2750,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, · 2749 unmodified lines
27502750 AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
27512751 additional_size + 8);
27522752 if (!side_data) {
2753− av_free_packet(pkt);
2753+ av_packet_unref(pkt);
27542754 av_free(pkt);
27552755 return AVERROR(ENOMEM);
27562756 }
@@ -2763,7 +2763,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, · 6 unmodified lines
27632763 AV_PKT_DATA_SKIP_SAMPLES,
27642764 10);
27652765 if (!side_data) {
2766− av_free_packet(pkt);
2766+ av_packet_unref(pkt);
27672767 av_free(pkt);
27682768 return AVERROR(ENOMEM);
27692769 }
libavformat/movenc.c+4−4
@@ -440,10 +440,10 @@ concatenate: · 439 unmodified lines
440440 return ret;
441441 if (info->num_blocks != 6)
442442 return 0;
443− av_free_packet(pkt);
443+ av_packet_unref(pkt);
444444 if ((ret = av_copy_packet(pkt, &info->pkt)) < 0)
445445 return ret;
446− av_free_packet(&info->pkt);
446+ av_packet_unref(&info->pkt);
447447 info->num_blocks = 0;
448448 }
449449
@@ -498,7 +498,7 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track) · 48 unmodified lines
498498 av_free(buf);
499499
500500 end:
501− av_free_packet(&info->pkt);
501+ av_packet_unref(&info->pkt);
502502 av_freep(&track->eac3_priv);
503503
504504 return size;
@@ -4606,7 +4606,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s, · 4101 unmodified lines
46064606 end.stream_index = stream_index;
46074607
46084608 ret = mov_write_single_packet(s, &end);
4609− av_free_packet(&end);
4609+ av_packet_unref(&end);
46104610
46114611 return ret;
46124612 }
libavformat/mpeg.c+3−3
@@ -956,12 +956,12 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) · 955 unmodified lines
956956 pkt->pos = idx_pkt.pos;
957957 pkt->stream_index = idx_pkt.stream_index;
958958
959− av_free_packet(&idx_pkt);
959+ av_packet_unref(&idx_pkt);
960960 return 0;
961961
962962 fail:
963− av_free_packet(pkt);
964− av_free_packet(&idx_pkt);
963+ av_packet_unref(pkt);
964+ av_packet_unref(&idx_pkt);
965965 return ret;
966966 }
967967
libavformat/mpegts.c+2−2
@@ -2654,7 +2654,7 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) · 2653 unmodified lines
26542654 ts->pkt = pkt;
26552655 ret = handle_packets(ts, 0);
26562656 if (ret < 0) {
2657− av_free_packet(ts->pkt);
2657+ av_packet_unref(ts->pkt);
26582658 /* flush pes data left */
26592659 for (i = 0; i < NB_PID_MAX; i++)
26602660 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, · 82 unmodified lines
27432743 ret = av_read_frame(s, &pkt);
27442744 if (ret < 0)
27452745 return AV_NOPTS_VALUE;
2746− av_free_packet(&pkt);
2746+ av_packet_unref(&pkt);
27472747 if (pkt.dts != AV_NOPTS_VALUE && pkt.pos >= 0) {
27482748 ff_reduce_index(s, pkt.stream_index);
27492749 av_add_index_entry(s->streams[pkt.stream_index], pkt.pos, pkt.dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
libavformat/nutdec.c+1−1
@@ -1157,7 +1157,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) · 1156 unmodified lines
11571157
11581158 return 0;
11591159 fail:
1160− av_free_packet(pkt);
1160+ av_packet_unref(pkt);
11611161 return ret;
11621162 }
11631163
libavformat/oggdec.c+1−1
@@ -844,7 +844,7 @@ retry: · 843 unmodified lines
844844
845845 return psize;
846846 fail:
847− av_free_packet(pkt);
847+ av_packet_unref(pkt);
848848 return AVERROR(ENOMEM);
849849 }
850850
libavformat/redspark.c+1−1
@@ -148,7 +148,7 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt) · 147 unmodified lines
148148
149149 ret = av_get_packet(s->pb, pkt, size);
150150 if (ret != size) {
151− av_free_packet(pkt);
151+ av_packet_unref(pkt);
152152 return AVERROR(EIO);
153153 }
154154
libavformat/rmdec.c+1−1
@@ -783,7 +783,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 782 unmodified lines
783783 AV_WL32(pkt->data + 1, 1);
784784 AV_WL32(pkt->data + 5, 0);
785785 if ((ret = avio_read(pb, pkt->data + 9, len)) != len) {
786− av_free_packet(pkt);
786+ av_packet_unref(pkt);
787787 av_log(s, AV_LOG_ERROR, "Failed to read %d bytes\n", len);
788788 return ret < 0 ? ret : AVERROR(EIO);
789789 }
libavformat/sdr2.c+1−1
@@ -95,7 +95,7 @@ static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt) · 94 unmodified lines
9595 memcpy(pkt->data, header, 24);
9696 ret = avio_read(s->pb, pkt->data + 24, next - 52);
9797 if (ret < 0) {
98− av_free_packet(pkt);
98+ av_packet_unref(pkt);
9999 return ret;
100100 }
101101 av_shrink_packet(pkt, ret + 24);
libavformat/siff.c+1−1
@@ -219,7 +219,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 218 unmodified lines
219219 if (c->gmcsize)
220220 memcpy(pkt->data + 2, c->gmc, c->gmcsize);
221221 if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) {
222− av_free_packet(pkt);
222+ av_packet_unref(pkt);
223223 return AVERROR_INVALIDDATA;
224224 }
225225 pkt->stream_index = 0;
libavformat/subtitles.c+2−2
@@ -179,7 +179,7 @@ static void drop_dups(void *log_ctx, FFDemuxSubtitlesQueue *q) · 178 unmodified lines
179179 q->subs[i].stream_index == last->stream_index &&
180180 !strcmp(q->subs[i].data, last->data)) {
181181
182− av_free_packet(&q->subs[i]);
182+ av_packet_unref(&q->subs[i]);
183183 drop++;
184184 } else if (drop) {
185185 q->subs[last_id + 1] = q->subs[i];
@@ -302,7 +302,7 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q) · 116 unmodified lines
302302 int i;
303303
304304 for (i = 0; i < q->nb_subs; i++)
305− av_free_packet(&q->subs[i]);
305+ av_packet_unref(&q->subs[i]);
306306 av_freep(&q->subs);
307307 q->nb_subs = q->allocated_size = q->current_sub_idx = 0;
308308 }
libavformat/swfdec.c+2−2
@@ -479,7 +479,7 @@ bitmap_end_skip: · 478 unmodified lines
479479 if ((res = av_new_packet(pkt, len)) < 0)
480480 return res;
481481 if (avio_read(pb, pkt->data, 4) != 4) {
482− av_free_packet(pkt);
482+ av_packet_unref(pkt);
483483 return AVERROR_INVALIDDATA;
484484 }
485485 if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
@@ -496,7 +496,7 @@ bitmap_end_skip: · 10 unmodified lines
496496 }
497497 if (res != pkt->size) {
498498 if (res < 0) {
499− av_free_packet(pkt);
499+ av_packet_unref(pkt);
500500 return res;
501501 }
502502 av_shrink_packet(pkt, res);
libavformat/tee.c+1−1
@@ -424,7 +424,7 @@ static int filter_packet(void *log_ctx, AVPacket *pkt, · 423 unmodified lines
424424 }
425425
426426 if (ret > 0) {
427− av_free_packet(pkt);
427+ av_packet_unref(pkt);
428428 new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size,
429429 av_buffer_default_free, NULL, 0);
430430 if (!new_pkt.buf)
libavformat/utils.c+1−1
@@ -1403,7 +1403,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) · 1402 unmodified lines
14031403 if (pkt->flags & AV_PKT_FLAG_KEY)
14041404 st->skip_to_keyframe = 0;
14051405 if (st->skip_to_keyframe) {
1406− av_free_packet(&cur_pkt);
1406+ av_packet_unref(&cur_pkt);
14071407 if (got_packet) {
14081408 *pkt = cur_pkt;
14091409 }
libavformat/vivo.c+1−1
@@ -298,7 +298,7 @@ restart: · 297 unmodified lines
298298
299299 fail:
300300 if (ret < 0)
301− av_free_packet(pkt);
301+ av_packet_unref(pkt);
302302 return ret;
303303 }
304304
libavformat/webpenc.c+1−1
@@ -140,7 +140,7 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts) · 139 unmodified lines
140140 avio_w8(s->pb, 0);
141141 }
142142 avio_write(s->pb, w->last_pkt.data + skip, w->last_pkt.size - skip);
143− av_free_packet(&w->last_pkt);
143+ av_packet_unref(&w->last_pkt);
144144 }
145145
146146 return 0;
libavformat/wtvenc.c+1−1
@@ -826,7 +826,7 @@ static int write_trailer(AVFormatContext *s) · 825 unmodified lines
826826
827827 av_free(wctx->sp_pairs);
828828 av_free(wctx->st_pairs);
829− av_free_packet(&wctx->thumbnail);
829+ av_packet_unref(&wctx->thumbnail);
830830 return 0;
831831 }
832832
tests/api/api-band-test.c+2−2
@@ -190,12 +190,12 @@ static int video_decode(const char *input_filename) · 189 unmodified lines
190190 return -1;
191191 }
192192 }
193− av_free_packet(&pkt);
193+ av_packet_unref(&pkt);
194194 av_init_packet(&pkt);
195195 }
196196 } while (!end_of_stream || got_frame);
197197
198− av_free_packet(&pkt);
198+ av_packet_unref(&pkt);
199199 av_frame_free(&fr);
200200 avcodec_close(ctx);
201201 avformat_close_input(&fmt_ctx);
tests/api/api-flac-test.c+1−1
@@ -206,7 +206,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx, · 205 unmodified lines
206206 out_offset += out_frame_bytes;
207207 }
208208 }
209− av_free_packet(&enc_pkt);
209+ av_packet_unref(&enc_pkt);
210210 }
211211
212212 if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_FRAMES) != 0) {
tests/api/api-h264-test.c+2−2
@@ -134,13 +134,13 @@ static int video_decode_example(const char *input_filename) · 133 unmodified lines
134134 fr->pkt_pts, fr->pkt_dts, av_frame_get_pkt_duration(fr),
135135 number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes));
136136 }
137− av_free_packet(&pkt);
137+ av_packet_unref(&pkt);
138138 av_init_packet(&pkt);
139139 }
140140 i++;
141141 } while (!end_of_stream || got_frame);
142142
143− av_free_packet(&pkt);
143+ av_packet_unref(&pkt);
144144 av_frame_free(&fr);
145145 avcodec_close(ctx);
146146 avformat_close_input(&fmt_ctx);
tests/api/api-seek-test.c+2−2
@@ -143,11 +143,11 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, · 142 unmodified lines
143143 }
144144 }
145145 }
146− av_free_packet(&pkt);
146+ av_packet_unref(&pkt);
147147 av_init_packet(&pkt);
148148 } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pkt_pts + av_frame_get_pkt_duration(fr) <= ts_end)));
149149
150− av_free_packet(&pkt);
150+ av_packet_unref(&pkt);
151151 av_freep(&byte_buffer);
152152
153153 return 0;
tools/seek_print.c+1−1
@@ -87,7 +87,7 @@ int main(int argc, char **argv) · 86 unmodified lines
8787 ret, packet.size, packet.stream_index,
8888 av_ts2str(packet.dts), av_ts2timestr(packet.dts, tb),
8989 av_ts2str(packet.pts), av_ts2timestr(packet.pts, tb));
90− av_free_packet(&packet);
90+ av_packet_unref(&packet);
9191 }
9292 } else if (sscanf(*argv, "seek:%i:%"SCNi64":%"SCNi64":%"SCNi64":%i",
9393 &stream, &min_ts, &ts, &max_ts, &flags) == 5) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t