[FFmpeg-devel] [PATCH 4/5] libavcodec: write out user data unregistered SEI for nvenc
Timo Rothenpieler
timo at rothenpieler.org
Fri Apr 30 18:27:44 EEST 2021
On 30.04.2021 13:34, Brad Hards wrote:
> Signed-off-by: Brad Hards <bradh at frogmouth.net>
> ---
> libavcodec/nvenc.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 0dcd93a99c..1a895a64f4 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -2173,6 +2173,8 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
> NV_ENC_SEI_PAYLOAD sei_data[8];
> int sei_count = 0;
> int i;
> + AVFrameSideData *sd;
> + int num_unregistered_sei;
>
> NvencContext *ctx = avctx->priv_data;
> NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
> @@ -2261,6 +2263,20 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
> }
> }
>
> + num_unregistered_sei = av_frame_num_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED);
> + for (int i = 0; i < num_unregistered_sei; i++) {
redefines i from above. Not sure if that's even valid.
> + sd = av_frame_get_side_data_n(frame, AV_FRAME_DATA_SEI_UNREGISTERED, i);
> + if (sd) {
> + sei_data[sei_count].payloadSize = sd->size;
> + sei_data[sei_count].payloadType = SEI_TYPE_USER_DATA_UNREGISTERED;
> + sei_data[sei_count].payload = av_memdup(sd->data, sd->size);
> + sei_count ++;
> + if (sei_count >= 8) {
> + break;
> + }
> + }
> + }
I'm not at all a fan of writing an arbitrary amount of stuff into a
small fixed size array.
> nvenc_codec_specific_pic_params(avctx, &pic_params, sei_data,
sei_count);
> } else {
> pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4494 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210430/15722ec1/attachment.bin>
More information about the ffmpeg-devel
mailing list