From dc2d56a66b8ad8bc5b07a5cc9c0608a67d5c2ae2 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Tue, 21 Aug 2018 14:28:15 +0200 Subject: [PATCH] avcodec/nvenc: add option to turn off a53 closed caption embedding --- libavcodec/nvenc.c | 2 +- libavcodec/nvenc.h | 1 + libavcodec/nvenc_h264.c | 1 + libavcodec/version.h | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index cfa7268a5e..e180d7b993 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -2107,7 +2107,7 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame) pic_params.inputTimeStamp = frame->pts; - if (av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC)) { + if (ctx->a53_cc && av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC)) { if (ff_alloc_a53_sei(frame, sizeof(NV_ENC_SEI_PAYLOAD), (void**)&sei_data, &sei_size) < 0) { av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); } diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index b29fbf282a..ebb7a80fc3 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -186,6 +186,7 @@ typedef struct NvencContext int weighted_pred; int coder; int b_ref_mode; + int a53_cc; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c index d446f9b33c..a6623f5f35 100644 --- a/libavcodec/nvenc_h264.c +++ b/libavcodec/nvenc_h264.c @@ -137,6 +137,7 @@ static const AVOption options[] = { { "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "b_ref_mode" }, { "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" }, #endif + { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { NULL } }; diff --git a/libavcodec/version.h b/libavcodec/version.h index d0b207b065..2af25d3166 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 24 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- GitLab