diff options
author | James Almer <jamrial@gmail.com> | 2023-05-11 14:34:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-05-12 16:21:18 -0300 |
commit | 7f890b2fbb75fa38e7b197cdd509afc7c391f998 (patch) | |
tree | 745329348e92c17b8f0b2cc378f31bb7d2d1f5cd /libavdevice | |
parent | 86ee0317951d6793b83fce03942ee26177663cec (diff) | |
download | ffmpeg-7f890b2fbb75fa38e7b197cdd509afc7c391f998.tar.gz |
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.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/decklink_common.h | 2 | ||||
-rw-r--r-- | libavdevice/decklink_enc.cpp | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index 1cc6d9c2cc..ebb5b94bed 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -113,7 +113,7 @@ struct decklink_ctx { /* Capture buffer queue */ DecklinkPacketQueue queue; - AVCCFifo *cc_fifo; ///< closed captions + CCFifo cc_fifo; ///< closed captions /* Streams present */ int audio; diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 22aa80b8c2..6906cb0882 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -371,7 +371,7 @@ av_cold int ff_decklink_write_trailer(AVFormatContext *avctx) klvanc_context_destroy(ctx->vanc_ctx); #endif - ff_ccfifo_freep(&ctx->cc_fifo); + ff_ccfifo_uninit(&ctx->cc_fifo); av_freep(&cctx->ctx); return 0; @@ -527,15 +527,15 @@ out: that will later be handled by construct_cc... */ static void parse_608subs(AVFormatContext *avctx, struct decklink_ctx *ctx, AVPacket *pkt) { - size_t cc_size = ff_ccfifo_getoutputsize(ctx->cc_fifo); + size_t cc_size = ff_ccfifo_getoutputsize(&ctx->cc_fifo); uint8_t *cc_data; - if (!ff_ccfifo_ccdetected(ctx->cc_fifo)) + if (!ff_ccfifo_ccdetected(&ctx->cc_fifo)) return; cc_data = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, cc_size); if (cc_data) - ff_ccfifo_injectbytes(ctx->cc_fifo, cc_data, cc_size); + ff_ccfifo_injectbytes(&ctx->cc_fifo, cc_data, cc_size); } 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) struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; - ff_ccfifo_extractbytes(ctx->cc_fifo, pkt->data, pkt->size); + ff_ccfifo_extractbytes(&ctx->cc_fifo, pkt->data, pkt->size); return 0; } @@ -831,9 +831,9 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) avpriv_set_pts_info(st, 64, ctx->bmd_tb_num, ctx->bmd_tb_den); } - if (!(ctx->cc_fifo = ff_ccfifo_alloc(av_make_q(ctx->bmd_tb_den, ctx->bmd_tb_num), avctx))) { + ret = ff_ccfifo_init(&ctx->cc_fifo, av_make_q(ctx->bmd_tb_den, ctx->bmd_tb_num), avctx); + if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); - ret = AVERROR(ENOMEM); goto error; } |