@@ -484,6 +484,8 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int nnal;
int ret;
int i;
+ AVFrameSideData *sd;
+ int num_unregistered_sei;
ctx->api->picture_init(ctx->params, &x265pic);
@@ -515,6 +517,17 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque));
}
+ num_unregistered_sei = av_frame_num_side_data(pic, AV_FRAME_DATA_SEI_UNREGISTERED);
+ x265pic.userSEI.payloads = av_realloc_array(x265pic.userSEI.payloads, x265pic.userSEI.numPayloads + num_unregistered_sei, sizeof(x265_sei_payload));
+ for (i = 0; i < num_unregistered_sei; i++) {
+ sd = av_frame_get_side_data_n(pic, AV_FRAME_DATA_SEI_UNREGISTERED, i);
+ if (sd) {
+ x265pic.userSEI.payloads[x265pic.userSEI.numPayloads + i].payload = sd->data;
+ x265pic.userSEI.payloads[x265pic.userSEI.numPayloads + i].payloadSize = sd->size;
+ x265pic.userSEI.payloads[x265pic.userSEI.numPayloads + i].payloadType = USER_DATA_UNREGISTERED;
+ }
+ }
+ x265pic.userSEI.numPayloads += num_unregistered_sei;
}
ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
Signed-off-by: Brad Hards <bradh@frogmouth.net> --- libavcodec/libx265.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)