History

avfilter/ccfifo: remove unnecessary context allocations

This is not public API, no it has no need for an alloc() and free() functions. The struct can reside on stack.

James Almer committed 3 years ago

Commit 7f890b21 parent 86ee03113 files · +89 −94Browse files

Showing the changes to libavdevice/decklink_enc.cpp (1 of 13 files). Show all

Unified · Split

libavdevice/decklink_enc.cpp+7−7
@@ -371,7 +371,7 @@ av_cold int ff_decklink_write_trailer(AVFormatContext *avctx) · 370 unmodified lines
371371 klvanc_context_destroy(ctx->vanc_ctx);
372372 #endif
373373
374− ff_ccfifo_freep(&ctx->cc_fifo);
374+ ff_ccfifo_uninit(&ctx->cc_fifo);
375375 av_freep(&cctx->ctx);
376376
377377 return 0;
@@ -527,15 +527,15 @@ out: · 149 unmodified lines
527527 that will later be handled by construct_cc... */
528528 static void parse_608subs(AVFormatContext *avctx, struct decklink_ctx *ctx, AVPacket *pkt)
529529 {
530− size_t cc_size = ff_ccfifo_getoutputsize(ctx->cc_fifo);
530+ size_t cc_size = ff_ccfifo_getoutputsize(&ctx->cc_fifo);
531531 uint8_t *cc_data;
532532
533− if (!ff_ccfifo_ccdetected(ctx->cc_fifo))
533+ if (!ff_ccfifo_ccdetected(&ctx->cc_fifo))
534534 return;
535535
536536 cc_data = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, cc_size);
537537 if (cc_data)
538− ff_ccfifo_injectbytes(ctx->cc_fifo, cc_data, cc_size);
538+ ff_ccfifo_injectbytes(&ctx->cc_fifo, cc_data, cc_size);
539539 }
540540
541541 static int decklink_construct_vanc(AVFormatContext *avctx, struct decklink_ctx *ctx,
@@ -745,7 +745,7 @@ static int decklink_write_subtitle_packet(AVFormatContext *avctx, AVPacket *pkt) · 203 unmodified lines
745745 struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
746746 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
747747
748− ff_ccfifo_extractbytes(ctx->cc_fifo, pkt->data, pkt->size);
748+ ff_ccfifo_extractbytes(&ctx->cc_fifo, pkt->data, pkt->size);
749749
750750 return 0;
751751 }
@@ -831,9 +831,9 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) · 79 unmodified lines
831831 avpriv_set_pts_info(st, 64, ctx->bmd_tb_num, ctx->bmd_tb_den);
832832 }
833833
834− if (!(ctx->cc_fifo = ff_ccfifo_alloc(av_make_q(ctx->bmd_tb_den, ctx->bmd_tb_num), avctx))) {
834+ ret = ff_ccfifo_init(&ctx->cc_fifo, av_make_q(ctx->bmd_tb_den, ctx->bmd_tb_num), avctx);
835+ if (ret < 0) {
835836 av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n");
836− ret = AVERROR(ENOMEM);
837837 goto error;
838838 }
839839

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