aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-06-28 10:34:12 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-06-28 21:40:49 +0800
commitfdead2a31a4686488a29d45c3d2e9b8b7723c0ef (patch)
tree4d20faf506ced0a41cee4a361ac0e963ff941bed /libavcodec/nvenc.c
parent4ef766e73c47c9928e276d9ec078c060f1d768f7 (diff)
downloadffmpeg-fdead2a31a4686488a29d45c3d2e9b8b7723c0ef.tar.gz
avcodec/nvenc: support for HEVC timecode passthrough
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index de6b0eaa44..b957b9cb7c 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "nvenc.h"
+#include "hevc_sei.h"
#include "libavutil/hwcontext_cuda.h"
#include "libavutil/hwcontext.h"
@@ -2153,6 +2154,22 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
}
}
+ if (ctx->tc && av_frame_get_side_data(frame, AV_FRAME_DATA_S12M_TIMECODE)) {
+ void *tc_data = NULL;
+ size_t tc_size = 0;
+
+ if (ff_alloc_timecode_sei(frame, 0, (void**)&tc_data, &tc_size) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Not enough memory for timecode sei, skipping\n");
+ }
+
+ if (tc_data) {
+ sei_data[sei_count].payloadSize = (uint32_t)tc_size;
+ sei_data[sei_count].payloadType = HEVC_SEI_TYPE_TIME_CODE;
+ sei_data[sei_count].payload = (uint8_t*)tc_data;
+ sei_count ++;
+ }
+ }
+
nvenc_codec_specific_pic_params(avctx, &pic_params, sei_data, sei_count);
} else {
pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;