This is not public API, no it has no need for an alloc() and free() functions. The struct can reside on stack.
Showing the changes to libavdevice/decklink_enc.cpp (1 of 13 files). Show all
Unified · Split
| @@ -371,7 +371,7 @@ av_cold int ff_decklink_write_trailer(AVFormatContext *avctx) · 370 unmodified lines | |||
| 371 | klvanc_context_destroy(ctx->vanc_ctx); | 371 | klvanc_context_destroy(ctx->vanc_ctx); |
| 372 | #endif | 372 | #endif |
| 373 | 373 | ||
| 374 | ff_ccfifo_freep(&ctx->cc_fifo); | 374 | ff_ccfifo_uninit(&ctx->cc_fifo); |
| 375 | av_freep(&cctx->ctx); | 375 | av_freep(&cctx->ctx); |
| 376 | 376 | ||
| 377 | return 0; | 377 | return 0; |
| @@ -527,15 +527,15 @@ out: · 149 unmodified lines | |||
| 527 | that will later be handled by construct_cc... */ | 527 | that will later be handled by construct_cc... */ |
| 528 | static void parse_608subs(AVFormatContext *avctx, struct decklink_ctx *ctx, AVPacket *pkt) | 528 | static void parse_608subs(AVFormatContext *avctx, struct decklink_ctx *ctx, AVPacket *pkt) |
| 529 | { | 529 | { |
| 530 | size_t cc_size = ff_ccfifo_getoutputsize(ctx->cc_fifo); | 530 | size_t cc_size = ff_ccfifo_getoutputsize(&ctx->cc_fifo); |
| 531 | uint8_t *cc_data; | 531 | uint8_t *cc_data; |
| 532 | 532 | ||
| 533 | if (!ff_ccfifo_ccdetected(ctx->cc_fifo)) | 533 | if (!ff_ccfifo_ccdetected(&ctx->cc_fifo)) |
| 534 | return; | 534 | return; |
| 535 | 535 | ||
| 536 | cc_data = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, cc_size); | 536 | cc_data = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, cc_size); |
| 537 | if (cc_data) | 537 | 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); |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | static int decklink_construct_vanc(AVFormatContext *avctx, struct decklink_ctx *ctx, | 541 | 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 | |||
| 745 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; | 745 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; |
| 746 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; | 746 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; |
| 747 | 747 | ||
| 748 | ff_ccfifo_extractbytes(ctx->cc_fifo, pkt->data, pkt->size); | 748 | ff_ccfifo_extractbytes(&ctx->cc_fifo, pkt->data, pkt->size); |
| 749 | 749 | ||
| 750 | return 0; | 750 | return 0; |
| 751 | } | 751 | } |
| @@ -831,9 +831,9 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) · 79 unmodified lines | |||
| 831 | avpriv_set_pts_info(st, 64, ctx->bmd_tb_num, ctx->bmd_tb_den); | 831 | avpriv_set_pts_info(st, 64, ctx->bmd_tb_num, ctx->bmd_tb_den); |
| 832 | } | 832 | } |
| 833 | 833 | ||
| 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) { | ||
| 835 | av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); | 836 | av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); |
| 836 | ret = AVERROR(ENOMEM); | ||
| 837 | goto error; | 837 | goto error; |
| 838 | } | 838 | } |
| 839 | 839 | ||