summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorBrad Hards <bradh@frogmouth.net>2021-06-04 16:06:38 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2021-06-04 18:24:49 +0200
commitcee9f9628fb983ad9e1c84fb17570f297bc542d2 (patch)
tree0a8f6b62757316cccc913ee25ace313434baf079 /libavcodec
parent63948a61700d2530f13b7d32df03060f0e7fbb94 (diff)
avcodec/nvenc: write out user data unregistered SEI
Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvenc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 5ae68b7101..e254c2983a 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -2282,6 +2282,34 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
}
}
+ for (int j = 0; j < frame->nb_side_data; j++) {
+ AVFrameSideData *side_data = frame->side_data[j];
+ void *tmp;
+
+ if (side_data->type != AV_FRAME_DATA_SEI_UNREGISTERED)
+ continue;
+
+ tmp = av_fast_realloc(ctx->sei_data,
+ &ctx->sei_data_size,
+ (sei_count + 1) * sizeof(*ctx->sei_data));
+ if (!tmp) {
+ res = AVERROR(ENOMEM);
+ goto sei_failed;
+ } else {
+ ctx->sei_data = tmp;
+ ctx->sei_data[sei_count].payloadSize = side_data->size;
+ ctx->sei_data[sei_count].payloadType = SEI_TYPE_USER_DATA_UNREGISTERED;
+ ctx->sei_data[sei_count].payload = av_memdup(side_data->data, side_data->size);
+
+ if (!ctx->sei_data[sei_count].payload) {
+ res = AVERROR(ENOMEM);
+ goto sei_failed;
+ }
+
+ sei_count++;
+ }
+ }
+
nvenc_codec_specific_pic_params(avctx, &pic_params, ctx->sei_data, sei_count);
} else {
pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;