Unified · Split
| @@ -211,7 +211,7 @@ static void audio_encode_example(const char *filename) · 210 unmodified lines | |||
| 211 | } | 211 | } |
| 212 | if (got_output) { | 212 | if (got_output) { |
| 213 | fwrite(pkt.data, 1, pkt.size, f); | 213 | fwrite(pkt.data, 1, pkt.size, f); |
| 214 | av_free_packet(&pkt); | 214 | av_packet_unref(&pkt); |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | 217 | ||
| @@ -326,7 +326,7 @@ int main (int argc, char **argv) · 325 unmodified lines | |||
| 326 | pkt.data += ret; | 326 | pkt.data += ret; |
| 327 | pkt.size -= ret; | 327 | pkt.size -= ret; |
| 328 | } while (pkt.size > 0); | 328 | } while (pkt.size > 0); |
| 329 | av_free_packet(&orig_pkt); | 329 | av_packet_unref(&orig_pkt); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | /* flush cached frames */ | 332 | /* flush cached frames */ |
| @@ -167,7 +167,7 @@ int main(int argc, char **argv) · 166 unmodified lines | |||
| 167 | pkt.data += ret; | 167 | pkt.data += ret; |
| 168 | pkt.size -= ret; | 168 | pkt.size -= ret; |
| 169 | } while (pkt.size > 0); | 169 | } while (pkt.size > 0); |
| 170 | av_free_packet(&orig_pkt); | 170 | av_packet_unref(&orig_pkt); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /* flush cached frames */ | 173 | /* flush cached frames */ |
| @@ -273,10 +273,10 @@ int main(int argc, char **argv) · 272 unmodified lines | |||
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | if (packet.size <= 0) | 275 | if (packet.size <= 0) |
| 276 | av_free_packet(&packet0); | 276 | av_packet_unref(&packet0); |
| 277 | } else { | 277 | } else { |
| 278 | /* discard non-wanted packets */ | 278 | /* discard non-wanted packets */ |
| 279 | av_free_packet(&packet0); | 279 | av_packet_unref(&packet0); |
| 280 | } | 280 | } |
| 281 | } | 281 | } |
| 282 | end: | 282 | end: |
| @@ -262,7 +262,7 @@ int main(int argc, char **argv) · 261 unmodified lines | |||
| 262 | av_frame_unref(frame); | 262 | av_frame_unref(frame); |
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| 265 | av_free_packet(&packet); | 265 | av_packet_unref(&packet); |
| 266 | } | 266 | } |
| 267 | end: | 267 | end: |
| 268 | avfilter_graph_free(&filter_graph); | 268 | avfilter_graph_free(&filter_graph); |
| @@ -143,7 +143,7 @@ int main(int argc, char **argv) · 142 unmodified lines | |||
| 143 | fprintf(stderr, "Error muxing packet\n"); | 143 | fprintf(stderr, "Error muxing packet\n"); |
| 144 | break; | 144 | break; |
| 145 | } | 145 | } |
| 146 | av_free_packet(&pkt); | 146 | av_packet_unref(&pkt); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | av_write_trailer(ofmt_ctx); | 149 | av_write_trailer(ofmt_ctx); |
| @@ -536,7 +536,7 @@ int main(int argc, char **argv) · 535 unmodified lines | |||
| 536 | if (ret < 0) | 536 | if (ret < 0) |
| 537 | goto end; | 537 | goto end; |
| 538 | } | 538 | } |
| 539 | av_free_packet(&packet); | 539 | av_packet_unref(&packet); |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | /* flush filters and encoders */ | 542 | /* flush filters and encoders */ |
| @@ -560,7 +560,7 @@ int main(int argc, char **argv) · 17 unmodified lines | |||
| 560 | 560 | ||
| 561 | av_write_trailer(ofmt_ctx); | 561 | av_write_trailer(ofmt_ctx); |
| 562 | end: | 562 | end: |
| 563 | av_free_packet(&packet); | 563 | av_packet_unref(&packet); |
| 564 | av_frame_free(&frame); | 564 | av_frame_free(&frame); |
| 565 | for (i = 0; i < ifmt_ctx->nb_streams; i++) { | 565 | for (i = 0; i < ifmt_ctx->nb_streams; i++) { |
| 566 | avcodec_close(ifmt_ctx->streams[i]->codec); | 566 | avcodec_close(ifmt_ctx->streams[i]->codec); |
| @@ -653,7 +653,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 652 unmodified lines | |||
| 653 | */ | 653 | */ |
| 654 | if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) { | 654 | if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) { |
| 655 | if (ost->frame_number >= ost->max_frames) { | 655 | if (ost->frame_number >= ost->max_frames) { |
| 656 | av_free_packet(pkt); | 656 | av_packet_unref(pkt); |
| 657 | return; | 657 | return; |
| 658 | } | 658 | } |
| 659 | ost->frame_number++; | 659 | ost->frame_number++; |
| @@ -700,7 +700,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 40 unmodified lines | |||
| 700 | if (a > 0) { | 700 | if (a > 0) { |
| 701 | pkt->side_data = NULL; | 701 | pkt->side_data = NULL; |
| 702 | pkt->side_data_elems = 0; | 702 | pkt->side_data_elems = 0; |
| 703 | av_free_packet(pkt); | 703 | av_packet_unref(pkt); |
| 704 | new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, | 704 | new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, |
| 705 | av_buffer_default_free, NULL, 0); | 705 | av_buffer_default_free, NULL, 0); |
| 706 | if (!new_pkt.buf) | 706 | if (!new_pkt.buf) |
| @@ -777,7 +777,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) · 70 unmodified lines | |||
| 777 | main_return_code = 1; | 777 | main_return_code = 1; |
| 778 | close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); | 778 | close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); |
| 779 | } | 779 | } |
| 780 | av_free_packet(pkt); | 780 | av_packet_unref(pkt); |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | static void close_output_stream(OutputStream *ost) | 783 | static void close_output_stream(OutputStream *ost) |
| @@ -1754,7 +1754,7 @@ static void flush_encoders(void) · 970 unmodified lines | |||
| 1754 | break; | 1754 | break; |
| 1755 | } | 1755 | } |
| 1756 | if (ost->finished & MUXER_FINISHED) { | 1756 | if (ost->finished & MUXER_FINISHED) { |
| 1757 | av_free_packet(&pkt); | 1757 | av_packet_unref(&pkt); |
| 1758 | continue; | 1758 | continue; |
| 1759 | } | 1759 | } |
| 1760 | av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base); | 1760 | 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 | |||
| 3521 | av_log(f->ctx, AV_LOG_ERROR, | 3521 | av_log(f->ctx, AV_LOG_ERROR, |
| 3522 | "Unable to send packet to main thread: %s\n", | 3522 | "Unable to send packet to main thread: %s\n", |
| 3523 | av_err2str(ret)); | 3523 | av_err2str(ret)); |
| 3524 | av_free_packet(&pkt); | 3524 | av_packet_unref(&pkt); |
| 3525 | av_thread_message_queue_set_err_recv(f->in_thread_queue, ret); | 3525 | av_thread_message_queue_set_err_recv(f->in_thread_queue, ret); |
| 3526 | break; | 3526 | break; |
| 3527 | } | 3527 | } |
| @@ -3542,7 +3542,7 @@ static void free_input_threads(void) · 14 unmodified lines | |||
| 3542 | continue; | 3542 | continue; |
| 3543 | av_thread_message_queue_set_err_send(f->in_thread_queue, AVERROR_EOF); | 3543 | av_thread_message_queue_set_err_send(f->in_thread_queue, AVERROR_EOF); |
| 3544 | while (av_thread_message_queue_recv(f->in_thread_queue, &pkt, 0) >= 0) | 3544 | while (av_thread_message_queue_recv(f->in_thread_queue, &pkt, 0) >= 0) |
| 3545 | av_free_packet(&pkt); | 3545 | av_packet_unref(&pkt); |
| 3546 | 3546 | ||
| 3547 | pthread_join(f->thread, NULL); | 3547 | pthread_join(f->thread, NULL); |
| 3548 | f->joined = 1; | 3548 | f->joined = 1; |
| @@ -3945,7 +3945,7 @@ static int process_input(int file_index) · 396 unmodified lines | |||
| 3945 | process_input_packet(ist, &pkt, 0); | 3945 | process_input_packet(ist, &pkt, 0); |
| 3946 | 3946 | ||
| 3947 | discard_packet: | 3947 | discard_packet: |
| 3948 | av_free_packet(&pkt); | 3948 | av_packet_unref(&pkt); |
| 3949 | 3949 | ||
| 3950 | return 0; | 3950 | return 0; |
| 3951 | } | 3951 | } |
| @@ -432,7 +432,7 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt) · 431 unmodified lines | |||
| 432 | SDL_UnlockMutex(q->mutex); | 432 | SDL_UnlockMutex(q->mutex); |
| 433 | 433 | ||
| 434 | if (pkt != &flush_pkt && ret < 0) | 434 | if (pkt != &flush_pkt && ret < 0) |
| 435 | av_free_packet(pkt); | 435 | av_packet_unref(pkt); |
| 436 | 436 | ||
| 437 | return ret; | 437 | return ret; |
| 438 | } | 438 | } |
| @@ -472,7 +472,7 @@ static void packet_queue_flush(PacketQueue *q) · 33 unmodified lines | |||
| 472 | SDL_LockMutex(q->mutex); | 472 | SDL_LockMutex(q->mutex); |
| 473 | for (pkt = q->first_pkt; pkt; pkt = pkt1) { | 473 | for (pkt = q->first_pkt; pkt; pkt = pkt1) { |
| 474 | pkt1 = pkt->next; | 474 | pkt1 = pkt->next; |
| 475 | av_free_packet(&pkt->pkt); | 475 | av_packet_unref(&pkt->pkt); |
| 476 | av_freep(&pkt); | 476 | av_freep(&pkt); |
| 477 | } | 477 | } |
| 478 | q->last_pkt = NULL; | 478 | q->last_pkt = NULL; |
| @@ -577,7 +577,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { · 98 unmodified lines | |||
| 577 | d->next_pts_tb = d->start_pts_tb; | 577 | d->next_pts_tb = d->start_pts_tb; |
| 578 | } | 578 | } |
| 579 | } while (pkt.data == flush_pkt.data || d->queue->serial != d->pkt_serial); | 579 | } while (pkt.data == flush_pkt.data || d->queue->serial != d->pkt_serial); |
| 580 | av_free_packet(&d->pkt); | 580 | av_packet_unref(&d->pkt); |
| 581 | d->pkt_temp = d->pkt = pkt; | 581 | d->pkt_temp = d->pkt = pkt; |
| 582 | d->packet_pending = 1; | 582 | d->packet_pending = 1; |
| 583 | } | 583 | } |
| @@ -641,7 +641,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { · 57 unmodified lines | |||
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | static void decoder_destroy(Decoder *d) { | 643 | static void decoder_destroy(Decoder *d) { |
| 644 | av_free_packet(&d->pkt); | 644 | av_packet_unref(&d->pkt); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | static void frame_queue_unref_item(Frame *vp) | 647 | static void frame_queue_unref_item(Frame *vp) |
| @@ -3119,7 +3119,7 @@ static int read_thread(void *arg) · 2471 unmodified lines | |||
| 3119 | } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { | 3119 | } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { |
| 3120 | packet_queue_put(&is->subtitleq, pkt); | 3120 | packet_queue_put(&is->subtitleq, pkt); |
| 3121 | } else { | 3121 | } else { |
| 3122 | av_free_packet(pkt); | 3122 | av_packet_unref(pkt); |
| 3123 | } | 3123 | } |
| 3124 | } | 3124 | } |
| 3125 | 3125 | ||
| @@ -2318,7 +2318,7 @@ static int http_prepare_data(HTTPContext *c) · 2317 unmodified lines | |||
| 2318 | c->packet_stream_index = pkt.stream_index; | 2318 | c->packet_stream_index = pkt.stream_index; |
| 2319 | ctx = c->rtp_ctx[c->packet_stream_index]; | 2319 | ctx = c->rtp_ctx[c->packet_stream_index]; |
| 2320 | if(!ctx) { | 2320 | if(!ctx) { |
| 2321 | av_free_packet(&pkt); | 2321 | av_packet_unref(&pkt); |
| 2322 | break; | 2322 | break; |
| 2323 | } | 2323 | } |
| 2324 | codec = ctx->streams[0]->codec; | 2324 | codec = ctx->streams[0]->codec; |
| @@ -2370,11 +2370,11 @@ static int http_prepare_data(HTTPContext *c) · 45 unmodified lines | |||
| 2370 | 2370 | ||
| 2371 | codec->frame_number++; | 2371 | codec->frame_number++; |
| 2372 | if (len == 0) { | 2372 | if (len == 0) { |
| 2373 | av_free_packet(&pkt); | 2373 | av_packet_unref(&pkt); |
| 2374 | goto redo; | 2374 | goto redo; |
| 2375 | } | 2375 | } |
| 2376 | } | 2376 | } |
| 2377 | av_free_packet(&pkt); | 2377 | av_packet_unref(&pkt); |
| 2378 | } | 2378 | } |
| 2379 | } | 2379 | } |
| 2380 | break; | 2380 | break; |
| @@ -3548,7 +3548,7 @@ static void extract_mpeg4_header(AVFormatContext *infile) · 1167 unmodified lines | |||
| 3548 | } | 3548 | } |
| 3549 | mpeg4_count--; | 3549 | mpeg4_count--; |
| 3550 | } | 3550 | } |
| 3551 | av_free_packet(&pkt); | 3551 | av_packet_unref(&pkt); |
| 3552 | } | 3552 | } |
| 3553 | } | 3553 | } |
| 3554 | 3554 | ||
| @@ -179,7 +179,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup) · 178 unmodified lines | |||
| 179 | return 0; | 179 | return 0; |
| 180 | 180 | ||
| 181 | failed_alloc: | 181 | failed_alloc: |
| 182 | av_free_packet(pkt); | 182 | av_packet_unref(pkt); |
| 183 | return AVERROR(ENOMEM); | 183 | return AVERROR(ENOMEM); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| @@ -342,7 +342,7 @@ int av_packet_merge_side_data(AVPacket *pkt){ · 156 unmodified lines | |||
| 342 | bytestream_put_be64(&p, FF_MERGE_MARKER); | 342 | bytestream_put_be64(&p, FF_MERGE_MARKER); |
| 343 | av_assert0(p-pkt->data == pkt->size); | 343 | av_assert0(p-pkt->data == pkt->size); |
| 344 | memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE); | 344 | memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE); |
| 345 | av_free_packet(&old); | 345 | av_packet_unref(&old); |
| 346 | pkt->side_data_elems = 0; | 346 | pkt->side_data_elems = 0; |
| 347 | pkt->side_data = NULL; | 347 | pkt->side_data = NULL; |
| 348 | return 1; | 348 | return 1; |
| @@ -361,7 +361,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, · 360 unmodified lines | |||
| 361 | discard_padding = opus->opts.packet_size - avpkt->duration; | 361 | discard_padding = opus->opts.packet_size - avpkt->duration; |
| 362 | // Check if subtraction resulted in an overflow | 362 | // Check if subtraction resulted in an overflow |
| 363 | if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) { | 363 | if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) { |
| 364 | av_free_packet(avpkt); | 364 | av_packet_unref(avpkt); |
| 365 | av_free(avpkt); | 365 | av_free(avpkt); |
| 366 | return AVERROR(EINVAL); | 366 | return AVERROR(EINVAL); |
| 367 | } | 367 | } |
| @@ -370,7 +370,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, · 2 unmodified lines | |||
| 370 | AV_PKT_DATA_SKIP_SAMPLES, | 370 | AV_PKT_DATA_SKIP_SAMPLES, |
| 371 | 10); | 371 | 10); |
| 372 | if(!side_data) { | 372 | if(!side_data) { |
| 373 | av_free_packet(avpkt); | 373 | av_packet_unref(avpkt); |
| 374 | av_free(avpkt); | 374 | av_free(avpkt); |
| 375 | return AVERROR(ENOMEM); | 375 | return AVERROR(ENOMEM); |
| 376 | } | 376 | } |
| @@ -733,7 +733,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 732 unmodified lines | |||
| 733 | AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, | 733 | AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, |
| 734 | cx_frame->sz_alpha + 8); | 734 | cx_frame->sz_alpha + 8); |
| 735 | if(!side_data) { | 735 | if(!side_data) { |
| 736 | av_free_packet(pkt); | 736 | av_packet_unref(pkt); |
| 737 | av_free(pkt); | 737 | av_free(pkt); |
| 738 | return AVERROR(ENOMEM); | 738 | return AVERROR(ENOMEM); |
| 739 | } | 739 | } |
| @@ -2353,7 +2353,7 @@ static int recode_subtitle(AVCodecContext *avctx, · 2352 unmodified lines | |||
| 2353 | ret = FFMIN(AVERROR(errno), -1); | 2353 | ret = FFMIN(AVERROR(errno), -1); |
| 2354 | av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" " | 2354 | av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" " |
| 2355 | "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc); | 2355 | "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc); |
| 2356 | av_free_packet(&tmp); | 2356 | av_packet_unref(&tmp); |
| 2357 | goto end; | 2357 | goto end; |
| 2358 | } | 2358 | } |
| 2359 | outpkt->size -= outl; | 2359 | outpkt->size -= outl; |
| @@ -2460,7 +2460,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, · 100 unmodified lines | |||
| 2460 | pkt_recoded.side_data = NULL; | 2460 | pkt_recoded.side_data = NULL; |
| 2461 | pkt_recoded.side_data_elems = 0; | 2461 | pkt_recoded.side_data_elems = 0; |
| 2462 | 2462 | ||
| 2463 | av_free_packet(&pkt_recoded); | 2463 | av_packet_unref(&pkt_recoded); |
| 2464 | } | 2464 | } |
| 2465 | if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) | 2465 | if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) |
| 2466 | sub->format = 0; | 2466 | sub->format = 0; |
| @@ -48,7 +48,7 @@ static void avpacket_queue_flush(AVPacketQueue *q) · 47 unmodified lines | |||
| 48 | pthread_mutex_lock(&q->mutex); | 48 | pthread_mutex_lock(&q->mutex); |
| 49 | for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { | 49 | for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { |
| 50 | pkt1 = pkt->next; | 50 | pkt1 = pkt->next; |
| 51 | av_free_packet(&pkt->pkt); | 51 | av_packet_unref(&pkt->pkt); |
| 52 | av_freep(&pkt); | 52 | av_freep(&pkt); |
| 53 | } | 53 | } |
| 54 | q->last_pkt = NULL; | 54 | q->last_pkt = NULL; |
| @@ -119,7 +119,7 @@ dshow_read_close(AVFormatContext *s) · 118 unmodified lines | |||
| 119 | pktl = ctx->pktl; | 119 | pktl = ctx->pktl; |
| 120 | while (pktl) { | 120 | while (pktl) { |
| 121 | AVPacketList *next = pktl->next; | 121 | AVPacketList *next = pktl->next; |
| 122 | av_free_packet(&pktl->pkt); | 122 | av_packet_unref(&pktl->pkt); |
| 123 | av_free(pktl); | 123 | av_free(pktl); |
| 124 | pktl = next; | 124 | pktl = next; |
| 125 | } | 125 | } |
| @@ -204,7 +204,7 @@ static int read_packet(AVFormatContext* ctx, AVPacket *pkt) · 203 unmodified lines | |||
| 204 | fail: | 204 | fail: |
| 205 | /* Handle failure */ | 205 | /* Handle failure */ |
| 206 | if (pkt->data) | 206 | if (pkt->data) |
| 207 | av_free_packet(pkt); | 207 | av_packet_unref(pkt); |
| 208 | if (error_msg) | 208 | if (error_msg) |
| 209 | av_log(ctx, AV_LOG_ERROR, "Error: %s\n", error_msg); | 209 | av_log(ctx, AV_LOG_ERROR, "Error: %s\n", error_msg); |
| 210 | return error; | 210 | return error; |
| @@ -95,7 +95,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], · 94 unmodified lines | |||
| 95 | av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h); | 95 | av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h); |
| 96 | 96 | ||
| 97 | end: | 97 | end: |
| 98 | av_free_packet(&pkt); | 98 | av_packet_unref(&pkt); |
| 99 | avcodec_close(codec_ctx); | 99 | avcodec_close(codec_ctx); |
| 100 | avformat_close_input(&format_ctx); | 100 | avformat_close_input(&format_ctx); |
| 101 | av_frame_free(&frame); | 101 | av_frame_free(&frame); |
| @@ -490,7 +490,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 489 unmodified lines | |||
| 490 | pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 : | 490 | pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 : |
| 491 | movie->out_index[pkt->stream_index]; | 491 | movie->out_index[pkt->stream_index]; |
| 492 | if (pkt_out_id < 0) { | 492 | if (pkt_out_id < 0) { |
| 493 | av_free_packet(&movie->pkt0); | 493 | av_packet_unref(&movie->pkt0); |
| 494 | pkt->size = 0; /* ready for next run */ | 494 | pkt->size = 0; /* ready for next run */ |
| 495 | pkt->data = NULL; | 495 | pkt->data = NULL; |
| 496 | return 0; | 496 | return 0; |
| @@ -517,7 +517,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 20 unmodified lines | |||
| 517 | if (ret < 0) { | 517 | if (ret < 0) { |
| 518 | av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret)); | 518 | av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret)); |
| 519 | av_frame_free(&frame); | 519 | av_frame_free(&frame); |
| 520 | av_free_packet(&movie->pkt0); | 520 | av_packet_unref(&movie->pkt0); |
| 521 | movie->pkt.size = 0; | 521 | movie->pkt.size = 0; |
| 522 | movie->pkt.data = NULL; | 522 | movie->pkt.data = NULL; |
| 523 | return 0; | 523 | return 0; |
| @@ -528,7 +528,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) · 4 unmodified lines | |||
| 528 | pkt->data += ret; | 528 | pkt->data += ret; |
| 529 | pkt->size -= ret; | 529 | pkt->size -= ret; |
| 530 | if (pkt->size <= 0) { | 530 | if (pkt->size <= 0) { |
| 531 | av_free_packet(&movie->pkt0); | 531 | av_packet_unref(&movie->pkt0); |
| 532 | pkt->size = 0; /* ready for next run */ | 532 | pkt->size = 0; /* ready for next run */ |
| 533 | pkt->data = NULL; | 533 | pkt->data = NULL; |
| 534 | } | 534 | } |
| @@ -277,7 +277,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) · 276 unmodified lines | |||
| 277 | mcdeint->parity ^= 1; | 277 | mcdeint->parity ^= 1; |
| 278 | 278 | ||
| 279 | end: | 279 | end: |
| 280 | av_free_packet(&pkt); | 280 | av_packet_unref(&pkt); |
| 281 | av_frame_free(&inpic); | 281 | av_frame_free(&inpic); |
| 282 | if (ret < 0) { | 282 | if (ret < 0) { |
| 283 | av_frame_free(&outpic); | 283 | av_frame_free(&outpic); |
| @@ -444,7 +444,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx) · 443 unmodified lines | |||
| 444 | } | 444 | } |
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| 447 | av_free_packet(&pkt); | 447 | av_packet_unref(&pkt); |
| 448 | avsubtitle_free(&sub); | 448 | avsubtitle_free(&sub); |
| 449 | } | 449 | } |
| 450 | 450 | ||
| @@ -78,7 +78,7 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt) · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | if (ret != size) { | 79 | if (ret != size) { |
| 80 | if (ret < 0) { | 80 | if (ret < 0) { |
| 81 | av_free_packet(pkt); | 81 | av_packet_unref(pkt); |
| 82 | return ret; | 82 | return ret; |
| 83 | } | 83 | } |
| 84 | av_shrink_packet(pkt, ret); | 84 | av_shrink_packet(pkt, ret); |
| @@ -293,7 +293,7 @@ static int aiff_write_trailer(AVFormatContext *s) · 292 unmodified lines | |||
| 293 | 293 | ||
| 294 | while (pict_list) { | 294 | while (pict_list) { |
| 295 | AVPacketList *next = pict_list->next; | 295 | AVPacketList *next = pict_list->next; |
| 296 | av_free_packet(&pict_list->pkt); | 296 | av_packet_unref(&pict_list->pkt); |
| 297 | av_freep(&pict_list); | 297 | av_freep(&pict_list); |
| 298 | pict_list = next; | 298 | pict_list = next; |
| 299 | } | 299 | } |
| @@ -418,7 +418,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) · 417 unmodified lines | |||
| 418 | AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); | 418 | AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); |
| 419 | ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); | 419 | ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); |
| 420 | if (ret < 0) { | 420 | if (ret < 0) { |
| 421 | av_free_packet(pkt); | 421 | av_packet_unref(pkt); |
| 422 | return ret; | 422 | return ret; |
| 423 | } | 423 | } |
| 424 | 424 | ||
| @@ -192,7 +192,7 @@ static void flush_packet(AVFormatContext *format_context, AVPacket *packet) · 191 unmodified lines | |||
| 192 | } | 192 | } |
| 193 | ++apng->frame_number; | 193 | ++apng->frame_number; |
| 194 | 194 | ||
| 195 | av_free_packet(apng->prev_packet); | 195 | av_packet_unref(apng->prev_packet); |
| 196 | if (packet) | 196 | if (packet) |
| 197 | av_copy_packet(apng->prev_packet, packet); | 197 | av_copy_packet(apng->prev_packet, packet); |
| 198 | } | 198 | } |
| @@ -298,7 +298,7 @@ static int asf_read_picture(AVFormatContext *s, int len) · 297 unmodified lines | |||
| 298 | 298 | ||
| 299 | fail: | 299 | fail: |
| 300 | av_freep(&desc); | 300 | av_freep(&desc); |
| 301 | av_free_packet(&pkt); | 301 | av_packet_unref(&pkt); |
| 302 | return ret; | 302 | return ret; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| @@ -852,7 +852,7 @@ static int asf_read_header(AVFormatContext *s) · 547 unmodified lines | |||
| 852 | if ((ret = av_get_packet(pb, &pkt, len)) < 0) | 852 | if ((ret = av_get_packet(pb, &pkt, len)) < 0) |
| 853 | return ret; | 853 | return ret; |
| 854 | av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size); | 854 | av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size); |
| 855 | av_free_packet(&pkt); | 855 | av_packet_unref(&pkt); |
| 856 | len= avio_rl32(pb); | 856 | len= avio_rl32(pb); |
| 857 | get_tag(s, "ASF_Protection_Type", -1, len, 32); | 857 | get_tag(s, "ASF_Protection_Type", -1, len, 32); |
| 858 | len= avio_rl32(pb); | 858 | len= avio_rl32(pb); |
| @@ -1288,7 +1288,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) · 429 unmodified lines | |||
| 1288 | "freeing incomplete packet size %d, new %d\n", | 1288 | "freeing incomplete packet size %d, new %d\n", |
| 1289 | asf_st->pkt.size, asf_st->packet_obj_size); | 1289 | asf_st->pkt.size, asf_st->packet_obj_size); |
| 1290 | asf_st->frag_offset = 0; | 1290 | asf_st->frag_offset = 0; |
| 1291 | av_free_packet(&asf_st->pkt); | 1291 | av_packet_unref(&asf_st->pkt); |
| 1292 | } | 1292 | } |
| 1293 | /* new packet */ | 1293 | /* new packet */ |
| 1294 | if ((ret = av_new_packet(&asf_st->pkt, asf_st->packet_obj_size)) < 0) | 1294 | 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 | |||
| 1379 | if (i == asf_st->pkt.size) { | 1379 | if (i == asf_st->pkt.size) { |
| 1380 | av_log(s, AV_LOG_DEBUG, "discarding ms fart\n"); | 1380 | av_log(s, AV_LOG_DEBUG, "discarding ms fart\n"); |
| 1381 | asf_st->frag_offset = 0; | 1381 | asf_st->frag_offset = 0; |
| 1382 | av_free_packet(&asf_st->pkt); | 1382 | av_packet_unref(&asf_st->pkt); |
| 1383 | continue; | 1383 | continue; |
| 1384 | } | 1384 | } |
| 1385 | } | 1385 | } |
| @@ -1476,7 +1476,7 @@ static void asf_reset_header(AVFormatContext *s) · 90 unmodified lines | |||
| 1476 | 1476 | ||
| 1477 | for (i = 0; i < 128; i++) { | 1477 | for (i = 0; i < 128; i++) { |
| 1478 | asf_st = &asf->streams[i]; | 1478 | asf_st = &asf->streams[i]; |
| 1479 | av_free_packet(&asf_st->pkt); | 1479 | av_packet_unref(&asf_st->pkt); |
| 1480 | asf_st->packet_obj_size = 0; | 1480 | asf_st->packet_obj_size = 0; |
| 1481 | asf_st->frag_offset = 0; | 1481 | asf_st->frag_offset = 0; |
| 1482 | asf_st->seq = 0; | 1482 | asf_st->seq = 0; |
| @@ -1538,7 +1538,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, · 55 unmodified lines | |||
| 1538 | 1538 | ||
| 1539 | pts = pkt->dts; | 1539 | pts = pkt->dts; |
| 1540 | 1540 | ||
| 1541 | av_free_packet(pkt); | 1541 | av_packet_unref(pkt); |
| 1542 | if (pkt->flags & AV_PKT_FLAG_KEY) { | 1542 | if (pkt->flags & AV_PKT_FLAG_KEY) { |
| 1543 | i = pkt->stream_index; | 1543 | i = pkt->stream_index; |
| 1544 | 1544 | ||
| @@ -1496,7 +1496,7 @@ resync: · 1495 unmodified lines | |||
| 1496 | } | 1496 | } |
| 1497 | 1497 | ||
| 1498 | if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) { | 1498 | if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) { |
| 1499 | av_free_packet(pkt); | 1499 | av_packet_unref(pkt); |
| 1500 | goto resync; | 1500 | goto resync; |
| 1501 | } | 1501 | } |
| 1502 | ast->seek_pos= 0; | 1502 | ast->seek_pos= 0; |
| @@ -412,7 +412,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 411 unmodified lines | |||
| 412 | dst += size; | 412 | dst += size; |
| 413 | avio_skip(s->pb, skip); | 413 | avio_skip(s->pb, skip); |
| 414 | if (ret != size) { | 414 | if (ret != size) { |
| 415 | av_free_packet(pkt); | 415 | av_packet_unref(pkt); |
| 416 | break; | 416 | break; |
| 417 | } | 417 | } |
| 418 | } | 418 | } |
| @@ -511,7 +511,7 @@ static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt) · 510 unmodified lines | |||
| 511 | ret = 1; | 511 | ret = 1; |
| 512 | } | 512 | } |
| 513 | if (ret > 0) { | 513 | if (ret > 0) { |
| 514 | av_free_packet(pkt); | 514 | av_packet_unref(pkt); |
| 515 | pkt2.buf = av_buffer_create(pkt2.data, pkt2.size, | 515 | pkt2.buf = av_buffer_create(pkt2.data, pkt2.size, |
| 516 | av_buffer_default_free, NULL, 0); | 516 | av_buffer_default_free, NULL, 0); |
| 517 | if (!pkt2.buf) { | 517 | if (!pkt2.buf) { |
| @@ -612,7 +612,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) · 611 unmodified lines | |||
| 612 | 612 | ||
| 613 | if (partial_packet) { | 613 | if (partial_packet) { |
| 614 | avpriv_request_sample(s, "video header followed by audio packet"); | 614 | avpriv_request_sample(s, "video header followed by audio packet"); |
| 615 | av_free_packet(pkt); | 615 | av_packet_unref(pkt); |
| 616 | partial_packet = 0; | 616 | partial_packet = 0; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| @@ -736,7 +736,7 @@ get_video_packet: · 117 unmodified lines | |||
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | if (ret < 0 && partial_packet) | 738 | if (ret < 0 && partial_packet) |
| 739 | av_free_packet(pkt); | 739 | av_packet_unref(pkt); |
| 740 | return ret; | 740 | return ret; |
| 741 | } | 741 | } |
| 742 | 742 | ||
| @@ -632,7 +632,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) · 631 unmodified lines | |||
| 632 | pkt->stream_index = ffm->header[0]; | 632 | pkt->stream_index = ffm->header[0]; |
| 633 | if ((unsigned)pkt->stream_index >= s->nb_streams) { | 633 | if ((unsigned)pkt->stream_index >= s->nb_streams) { |
| 634 | av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index); | 634 | av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index); |
| 635 | av_free_packet(pkt); | 635 | av_packet_unref(pkt); |
| 636 | ffm->read_state = READ_HEADER; | 636 | ffm->read_state = READ_HEADER; |
| 637 | return -1; | 637 | return -1; |
| 638 | } | 638 | } |
| @@ -643,7 +643,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines | |||
| 643 | ffm->read_state = READ_HEADER; | 643 | ffm->read_state = READ_HEADER; |
| 644 | if (ffm_read_data(s, pkt->data, size, 0) != size) { | 644 | if (ffm_read_data(s, pkt->data, size, 0) != size) { |
| 645 | /* bad case: desynchronized packet. we cancel all the packet loading */ | 645 | /* bad case: desynchronized packet. we cancel all the packet loading */ |
| 646 | av_free_packet(pkt); | 646 | av_packet_unref(pkt); |
| 647 | return -1; | 647 | return -1; |
| 648 | } | 648 | } |
| 649 | pkt->pts = AV_RB64(ffm->header+8); | 649 | pkt->pts = AV_RB64(ffm->header+8); |
| @@ -267,7 +267,7 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde · 266 unmodified lines | |||
| 267 | &out_pkt.data, &out_pkt.size, pkt.data, pkt.size, | 267 | &out_pkt.data, &out_pkt.size, pkt.data, pkt.size, |
| 268 | pkt.pts, pkt.dts, *ppos); | 268 | pkt.pts, pkt.dts, *ppos); |
| 269 | 269 | ||
| 270 | av_free_packet(&pkt); | 270 | av_packet_unref(&pkt); |
| 271 | if (out_pkt.size){ | 271 | if (out_pkt.size){ |
| 272 | int size = out_pkt.size; | 272 | int size = out_pkt.size; |
| 273 | if (parser->pts != AV_NOPTS_VALUE){ | 273 | if (parser->pts != AV_NOPTS_VALUE){ |
| @@ -1143,7 +1143,7 @@ leave: · 1142 unmodified lines | |||
| 1143 | av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 11); | 1143 | av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 11); |
| 1144 | avio_seek(s->pb, pos + 1, SEEK_SET); | 1144 | avio_seek(s->pb, pos + 1, SEEK_SET); |
| 1145 | ret = resync(s); | 1145 | ret = resync(s); |
| 1146 | av_free_packet(pkt); | 1146 | av_packet_unref(pkt); |
| 1147 | if (ret >= 0) { | 1147 | if (ret >= 0) { |
| 1148 | goto retry; | 1148 | goto retry; |
| 1149 | } | 1149 | } |
| @@ -173,7 +173,7 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) · 172 unmodified lines | |||
| 173 | 173 | ||
| 174 | avio_write(pb, pkt->data, pkt->size); | 174 | avio_write(pb, pkt->data, pkt->size); |
| 175 | 175 | ||
| 176 | av_free_packet(gif->prev_pkt); | 176 | av_packet_unref(gif->prev_pkt); |
| 177 | if (new) | 177 | if (new) |
| 178 | av_copy_packet(gif->prev_pkt, new); | 178 | av_copy_packet(gif->prev_pkt, new); |
| 179 | 179 | ||
| @@ -738,7 +738,7 @@ static int iff_read_packet(AVFormatContext *s, · 737 unmodified lines | |||
| 738 | bytestream_put_be16(&buf, 2); | 738 | bytestream_put_be16(&buf, 2); |
| 739 | ret = avio_read(pb, buf, iff->body_size); | 739 | ret = avio_read(pb, buf, iff->body_size); |
| 740 | if (ret<0) { | 740 | if (ret<0) { |
| 741 | av_free_packet(pkt); | 741 | av_packet_unref(pkt); |
| 742 | } else if (ret < iff->body_size) | 742 | } else if (ret < iff->body_size) |
| 743 | av_shrink_packet(pkt, ret + 2); | 743 | av_shrink_packet(pkt, ret + 2); |
| 744 | } else { | 744 | } else { |
| @@ -157,11 +157,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 156 unmodified lines | |||
| 157 | (ret = avformat_write_header(fmt, NULL)) < 0 || | 157 | (ret = avformat_write_header(fmt, NULL)) < 0 || |
| 158 | (ret = av_interleaved_write_frame(fmt, &pkt2)) < 0 || | 158 | (ret = av_interleaved_write_frame(fmt, &pkt2)) < 0 || |
| 159 | (ret = av_write_trailer(fmt)) < 0) { | 159 | (ret = av_write_trailer(fmt)) < 0) { |
| 160 | av_free_packet(&pkt2); | 160 | av_packet_unref(&pkt2); |
| 161 | avformat_free_context(fmt); | 161 | avformat_free_context(fmt); |
| 162 | return ret; | 162 | return ret; |
| 163 | } | 163 | } |
| 164 | av_free_packet(&pkt2); | 164 | av_packet_unref(&pkt2); |
| 165 | avformat_free_context(fmt); | 165 | avformat_free_context(fmt); |
| 166 | } else { | 166 | } else { |
| 167 | avio_write(pb[0], pkt->data, pkt->size); | 167 | avio_write(pb[0], pkt->data, pkt->size); |
| @@ -325,7 +325,7 @@ static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt) · 324 unmodified lines | |||
| 325 | 325 | ||
| 326 | pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE); | 326 | pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE); |
| 327 | if (pkt->size <= 0) { | 327 | if (pkt->size <= 0) { |
| 328 | av_free_packet(pkt); | 328 | av_packet_unref(pkt); |
| 329 | return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO); | 329 | return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO); |
| 330 | } | 330 | } |
| 331 | return 0; | 331 | return 0; |
| @@ -2750,7 +2750,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, · 2749 unmodified lines | |||
| 2750 | AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, | 2750 | AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, |
| 2751 | additional_size + 8); | 2751 | additional_size + 8); |
| 2752 | if (!side_data) { | 2752 | if (!side_data) { |
| 2753 | av_free_packet(pkt); | 2753 | av_packet_unref(pkt); |
| 2754 | av_free(pkt); | 2754 | av_free(pkt); |
| 2755 | return AVERROR(ENOMEM); | 2755 | return AVERROR(ENOMEM); |
| 2756 | } | 2756 | } |
| @@ -2763,7 +2763,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, · 6 unmodified lines | |||
| 2763 | AV_PKT_DATA_SKIP_SAMPLES, | 2763 | AV_PKT_DATA_SKIP_SAMPLES, |
| 2764 | 10); | 2764 | 10); |
| 2765 | if (!side_data) { | 2765 | if (!side_data) { |
| 2766 | av_free_packet(pkt); | 2766 | av_packet_unref(pkt); |
| 2767 | av_free(pkt); | 2767 | av_free(pkt); |
| 2768 | return AVERROR(ENOMEM); | 2768 | return AVERROR(ENOMEM); |
| 2769 | } | 2769 | } |
| @@ -440,10 +440,10 @@ concatenate: · 439 unmodified lines | |||
| 440 | return ret; | 440 | return ret; |
| 441 | if (info->num_blocks != 6) | 441 | if (info->num_blocks != 6) |
| 442 | return 0; | 442 | return 0; |
| 443 | av_free_packet(pkt); | 443 | av_packet_unref(pkt); |
| 444 | if ((ret = av_copy_packet(pkt, &info->pkt)) < 0) | 444 | if ((ret = av_copy_packet(pkt, &info->pkt)) < 0) |
| 445 | return ret; | 445 | return ret; |
| 446 | av_free_packet(&info->pkt); | 446 | av_packet_unref(&info->pkt); |
| 447 | info->num_blocks = 0; | 447 | info->num_blocks = 0; |
| 448 | } | 448 | } |
| 449 | 449 | ||
| @@ -498,7 +498,7 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track) · 48 unmodified lines | |||
| 498 | av_free(buf); | 498 | av_free(buf); |
| 499 | 499 | ||
| 500 | end: | 500 | end: |
| 501 | av_free_packet(&info->pkt); | 501 | av_packet_unref(&info->pkt); |
| 502 | av_freep(&track->eac3_priv); | 502 | av_freep(&track->eac3_priv); |
| 503 | 503 | ||
| 504 | return size; | 504 | return size; |
| @@ -4606,7 +4606,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s, · 4101 unmodified lines | |||
| 4606 | end.stream_index = stream_index; | 4606 | end.stream_index = stream_index; |
| 4607 | 4607 | ||
| 4608 | ret = mov_write_single_packet(s, &end); | 4608 | ret = mov_write_single_packet(s, &end); |
| 4609 | av_free_packet(&end); | 4609 | av_packet_unref(&end); |
| 4610 | 4610 | ||
| 4611 | return ret; | 4611 | return ret; |
| 4612 | } | 4612 | } |
| @@ -956,12 +956,12 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) · 955 unmodified lines | |||
| 956 | pkt->pos = idx_pkt.pos; | 956 | pkt->pos = idx_pkt.pos; |
| 957 | pkt->stream_index = idx_pkt.stream_index; | 957 | pkt->stream_index = idx_pkt.stream_index; |
| 958 | 958 | ||
| 959 | av_free_packet(&idx_pkt); | 959 | av_packet_unref(&idx_pkt); |
| 960 | return 0; | 960 | return 0; |
| 961 | 961 | ||
| 962 | fail: | 962 | fail: |
| 963 | av_free_packet(pkt); | 963 | av_packet_unref(pkt); |
| 964 | av_free_packet(&idx_pkt); | 964 | av_packet_unref(&idx_pkt); |
| 965 | return ret; | 965 | return ret; |
| 966 | } | 966 | } |
| 967 | 967 | ||
| @@ -2654,7 +2654,7 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) · 2653 unmodified lines | |||
| 2654 | ts->pkt = pkt; | 2654 | ts->pkt = pkt; |
| 2655 | ret = handle_packets(ts, 0); | 2655 | ret = handle_packets(ts, 0); |
| 2656 | if (ret < 0) { | 2656 | if (ret < 0) { |
| 2657 | av_free_packet(ts->pkt); | 2657 | av_packet_unref(ts->pkt); |
| 2658 | /* flush pes data left */ | 2658 | /* flush pes data left */ |
| 2659 | for (i = 0; i < NB_PID_MAX; i++) | 2659 | for (i = 0; i < NB_PID_MAX; i++) |
| 2660 | if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) { | 2660 | 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 | |||
| 2743 | ret = av_read_frame(s, &pkt); | 2743 | ret = av_read_frame(s, &pkt); |
| 2744 | if (ret < 0) | 2744 | if (ret < 0) |
| 2745 | return AV_NOPTS_VALUE; | 2745 | return AV_NOPTS_VALUE; |
| 2746 | av_free_packet(&pkt); | 2746 | av_packet_unref(&pkt); |
| 2747 | if (pkt.dts != AV_NOPTS_VALUE && pkt.pos >= 0) { | 2747 | if (pkt.dts != AV_NOPTS_VALUE && pkt.pos >= 0) { |
| 2748 | ff_reduce_index(s, pkt.stream_index); | 2748 | ff_reduce_index(s, pkt.stream_index); |
| 2749 | av_add_index_entry(s->streams[pkt.stream_index], pkt.pos, pkt.dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); | 2749 | av_add_index_entry(s->streams[pkt.stream_index], pkt.pos, pkt.dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); |
| @@ -1157,7 +1157,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) · 1156 unmodified lines | |||
| 1157 | 1157 | ||
| 1158 | return 0; | 1158 | return 0; |
| 1159 | fail: | 1159 | fail: |
| 1160 | av_free_packet(pkt); | 1160 | av_packet_unref(pkt); |
| 1161 | return ret; | 1161 | return ret; |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| @@ -844,7 +844,7 @@ retry: · 843 unmodified lines | |||
| 844 | 844 | ||
| 845 | return psize; | 845 | return psize; |
| 846 | fail: | 846 | fail: |
| 847 | av_free_packet(pkt); | 847 | av_packet_unref(pkt); |
| 848 | return AVERROR(ENOMEM); | 848 | return AVERROR(ENOMEM); |
| 849 | } | 849 | } |
| 850 | 850 | ||
| @@ -148,7 +148,7 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt) · 147 unmodified lines | |||
| 148 | 148 | ||
| 149 | ret = av_get_packet(s->pb, pkt, size); | 149 | ret = av_get_packet(s->pb, pkt, size); |
| 150 | if (ret != size) { | 150 | if (ret != size) { |
| 151 | av_free_packet(pkt); | 151 | av_packet_unref(pkt); |
| 152 | return AVERROR(EIO); | 152 | return AVERROR(EIO); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -783,7 +783,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 782 unmodified lines | |||
| 783 | AV_WL32(pkt->data + 1, 1); | 783 | AV_WL32(pkt->data + 1, 1); |
| 784 | AV_WL32(pkt->data + 5, 0); | 784 | AV_WL32(pkt->data + 5, 0); |
| 785 | if ((ret = avio_read(pb, pkt->data + 9, len)) != len) { | 785 | if ((ret = avio_read(pb, pkt->data + 9, len)) != len) { |
| 786 | av_free_packet(pkt); | 786 | av_packet_unref(pkt); |
| 787 | av_log(s, AV_LOG_ERROR, "Failed to read %d bytes\n", len); | 787 | av_log(s, AV_LOG_ERROR, "Failed to read %d bytes\n", len); |
| 788 | return ret < 0 ? ret : AVERROR(EIO); | 788 | return ret < 0 ? ret : AVERROR(EIO); |
| 789 | } | 789 | } |
| @@ -95,7 +95,7 @@ static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt) · 94 unmodified lines | |||
| 95 | memcpy(pkt->data, header, 24); | 95 | memcpy(pkt->data, header, 24); |
| 96 | ret = avio_read(s->pb, pkt->data + 24, next - 52); | 96 | ret = avio_read(s->pb, pkt->data + 24, next - 52); |
| 97 | if (ret < 0) { | 97 | if (ret < 0) { |
| 98 | av_free_packet(pkt); | 98 | av_packet_unref(pkt); |
| 99 | return ret; | 99 | return ret; |
| 100 | } | 100 | } |
| 101 | av_shrink_packet(pkt, ret + 24); | 101 | av_shrink_packet(pkt, ret + 24); |
| @@ -219,7 +219,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 218 unmodified lines | |||
| 219 | if (c->gmcsize) | 219 | if (c->gmcsize) |
| 220 | memcpy(pkt->data + 2, c->gmc, c->gmcsize); | 220 | memcpy(pkt->data + 2, c->gmc, c->gmcsize); |
| 221 | if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) { | 221 | if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) { |
| 222 | av_free_packet(pkt); | 222 | av_packet_unref(pkt); |
| 223 | return AVERROR_INVALIDDATA; | 223 | return AVERROR_INVALIDDATA; |
| 224 | } | 224 | } |
| 225 | pkt->stream_index = 0; | 225 | pkt->stream_index = 0; |
| @@ -179,7 +179,7 @@ static void drop_dups(void *log_ctx, FFDemuxSubtitlesQueue *q) · 178 unmodified lines | |||
| 179 | q->subs[i].stream_index == last->stream_index && | 179 | q->subs[i].stream_index == last->stream_index && |
| 180 | !strcmp(q->subs[i].data, last->data)) { | 180 | !strcmp(q->subs[i].data, last->data)) { |
| 181 | 181 | ||
| 182 | av_free_packet(&q->subs[i]); | 182 | av_packet_unref(&q->subs[i]); |
| 183 | drop++; | 183 | drop++; |
| 184 | } else if (drop) { | 184 | } else if (drop) { |
| 185 | q->subs[last_id + 1] = q->subs[i]; | 185 | q->subs[last_id + 1] = q->subs[i]; |
| @@ -302,7 +302,7 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q) · 116 unmodified lines | |||
| 302 | int i; | 302 | int i; |
| 303 | 303 | ||
| 304 | for (i = 0; i < q->nb_subs; i++) | 304 | for (i = 0; i < q->nb_subs; i++) |
| 305 | av_free_packet(&q->subs[i]); | 305 | av_packet_unref(&q->subs[i]); |
| 306 | av_freep(&q->subs); | 306 | av_freep(&q->subs); |
| 307 | q->nb_subs = q->allocated_size = q->current_sub_idx = 0; | 307 | q->nb_subs = q->allocated_size = q->current_sub_idx = 0; |
| 308 | } | 308 | } |
| @@ -479,7 +479,7 @@ bitmap_end_skip: · 478 unmodified lines | |||
| 479 | if ((res = av_new_packet(pkt, len)) < 0) | 479 | if ((res = av_new_packet(pkt, len)) < 0) |
| 480 | return res; | 480 | return res; |
| 481 | if (avio_read(pb, pkt->data, 4) != 4) { | 481 | if (avio_read(pb, pkt->data, 4) != 4) { |
| 482 | av_free_packet(pkt); | 482 | av_packet_unref(pkt); |
| 483 | return AVERROR_INVALIDDATA; | 483 | return AVERROR_INVALIDDATA; |
| 484 | } | 484 | } |
| 485 | if (AV_RB32(pkt->data) == 0xffd8ffd9 || | 485 | if (AV_RB32(pkt->data) == 0xffd8ffd9 || |
| @@ -496,7 +496,7 @@ bitmap_end_skip: · 10 unmodified lines | |||
| 496 | } | 496 | } |
| 497 | if (res != pkt->size) { | 497 | if (res != pkt->size) { |
| 498 | if (res < 0) { | 498 | if (res < 0) { |
| 499 | av_free_packet(pkt); | 499 | av_packet_unref(pkt); |
| 500 | return res; | 500 | return res; |
| 501 | } | 501 | } |
| 502 | av_shrink_packet(pkt, res); | 502 | av_shrink_packet(pkt, res); |
| @@ -424,7 +424,7 @@ static int filter_packet(void *log_ctx, AVPacket *pkt, · 423 unmodified lines | |||
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | if (ret > 0) { | 426 | if (ret > 0) { |
| 427 | av_free_packet(pkt); | 427 | av_packet_unref(pkt); |
| 428 | new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, | 428 | new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, |
| 429 | av_buffer_default_free, NULL, 0); | 429 | av_buffer_default_free, NULL, 0); |
| 430 | if (!new_pkt.buf) | 430 | if (!new_pkt.buf) |
| @@ -1403,7 +1403,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) · 1402 unmodified lines | |||
| 1403 | if (pkt->flags & AV_PKT_FLAG_KEY) | 1403 | if (pkt->flags & AV_PKT_FLAG_KEY) |
| 1404 | st->skip_to_keyframe = 0; | 1404 | st->skip_to_keyframe = 0; |
| 1405 | if (st->skip_to_keyframe) { | 1405 | if (st->skip_to_keyframe) { |
| 1406 | av_free_packet(&cur_pkt); | 1406 | av_packet_unref(&cur_pkt); |
| 1407 | if (got_packet) { | 1407 | if (got_packet) { |
| 1408 | *pkt = cur_pkt; | 1408 | *pkt = cur_pkt; |
| 1409 | } | 1409 | } |
| @@ -298,7 +298,7 @@ restart: · 297 unmodified lines | |||
| 298 | 298 | ||
| 299 | fail: | 299 | fail: |
| 300 | if (ret < 0) | 300 | if (ret < 0) |
| 301 | av_free_packet(pkt); | 301 | av_packet_unref(pkt); |
| 302 | return ret; | 302 | return ret; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| @@ -140,7 +140,7 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts) · 139 unmodified lines | |||
| 140 | avio_w8(s->pb, 0); | 140 | avio_w8(s->pb, 0); |
| 141 | } | 141 | } |
| 142 | avio_write(s->pb, w->last_pkt.data + skip, w->last_pkt.size - skip); | 142 | 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); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | return 0; | 146 | return 0; |
| @@ -826,7 +826,7 @@ static int write_trailer(AVFormatContext *s) · 825 unmodified lines | |||
| 826 | 826 | ||
| 827 | av_free(wctx->sp_pairs); | 827 | av_free(wctx->sp_pairs); |
| 828 | av_free(wctx->st_pairs); | 828 | av_free(wctx->st_pairs); |
| 829 | av_free_packet(&wctx->thumbnail); | 829 | av_packet_unref(&wctx->thumbnail); |
| 830 | return 0; | 830 | return 0; |
| 831 | } | 831 | } |
| 832 | 832 | ||
| @@ -190,12 +190,12 @@ static int video_decode(const char *input_filename) · 189 unmodified lines | |||
| 190 | return -1; | 190 | return -1; |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | av_free_packet(&pkt); | 193 | av_packet_unref(&pkt); |
| 194 | av_init_packet(&pkt); | 194 | av_init_packet(&pkt); |
| 195 | } | 195 | } |
| 196 | } while (!end_of_stream || got_frame); | 196 | } while (!end_of_stream || got_frame); |
| 197 | 197 | ||
| 198 | av_free_packet(&pkt); | 198 | av_packet_unref(&pkt); |
| 199 | av_frame_free(&fr); | 199 | av_frame_free(&fr); |
| 200 | avcodec_close(ctx); | 200 | avcodec_close(ctx); |
| 201 | avformat_close_input(&fmt_ctx); | 201 | avformat_close_input(&fmt_ctx); |
| @@ -206,7 +206,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx, · 205 unmodified lines | |||
| 206 | out_offset += out_frame_bytes; | 206 | out_offset += out_frame_bytes; |
| 207 | } | 207 | } |
| 208 | } | 208 | } |
| 209 | av_free_packet(&enc_pkt); | 209 | av_packet_unref(&enc_pkt); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_FRAMES) != 0) { | 212 | if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_FRAMES) != 0) { |
| @@ -134,13 +134,13 @@ static int video_decode_example(const char *input_filename) · 133 unmodified lines | |||
| 134 | fr->pkt_pts, fr->pkt_dts, av_frame_get_pkt_duration(fr), | 134 | fr->pkt_pts, fr->pkt_dts, av_frame_get_pkt_duration(fr), |
| 135 | number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); | 135 | number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); |
| 136 | } | 136 | } |
| 137 | av_free_packet(&pkt); | 137 | av_packet_unref(&pkt); |
| 138 | av_init_packet(&pkt); | 138 | av_init_packet(&pkt); |
| 139 | } | 139 | } |
| 140 | i++; | 140 | i++; |
| 141 | } while (!end_of_stream || got_frame); | 141 | } while (!end_of_stream || got_frame); |
| 142 | 142 | ||
| 143 | av_free_packet(&pkt); | 143 | av_packet_unref(&pkt); |
| 144 | av_frame_free(&fr); | 144 | av_frame_free(&fr); |
| 145 | avcodec_close(ctx); | 145 | avcodec_close(ctx); |
| 146 | avformat_close_input(&fmt_ctx); | 146 | avformat_close_input(&fmt_ctx); |
| @@ -143,11 +143,11 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, · 142 unmodified lines | |||
| 143 | } | 143 | } |
| 144 | } | 144 | } |
| 145 | } | 145 | } |
| 146 | av_free_packet(&pkt); | 146 | av_packet_unref(&pkt); |
| 147 | av_init_packet(&pkt); | 147 | av_init_packet(&pkt); |
| 148 | } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pkt_pts + av_frame_get_pkt_duration(fr) <= ts_end))); | 148 | } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pkt_pts + av_frame_get_pkt_duration(fr) <= ts_end))); |
| 149 | 149 | ||
| 150 | av_free_packet(&pkt); | 150 | av_packet_unref(&pkt); |
| 151 | av_freep(&byte_buffer); | 151 | av_freep(&byte_buffer); |
| 152 | 152 | ||
| 153 | return 0; | 153 | return 0; |
| @@ -87,7 +87,7 @@ int main(int argc, char **argv) · 86 unmodified lines | |||
| 87 | ret, packet.size, packet.stream_index, | 87 | ret, packet.size, packet.stream_index, |
| 88 | av_ts2str(packet.dts), av_ts2timestr(packet.dts, tb), | 88 | av_ts2str(packet.dts), av_ts2timestr(packet.dts, tb), |
| 89 | av_ts2str(packet.pts), av_ts2timestr(packet.pts, tb)); | 89 | av_ts2str(packet.pts), av_ts2timestr(packet.pts, tb)); |
| 90 | av_free_packet(&packet); | 90 | av_packet_unref(&packet); |
| 91 | } | 91 | } |
| 92 | } else if (sscanf(*argv, "seek:%i:%"SCNi64":%"SCNi64":%"SCNi64":%i", | 92 | } else if (sscanf(*argv, "seek:%i:%"SCNi64":%"SCNi64":%"SCNi64":%i", |
| 93 | &stream, &min_ts, &ts, &max_ts, &flags) == 5) { | 93 | &stream, &min_ts, &ts, &max_ts, &flags) == 5) { |