diff --git a/sys/nvcodec/gstnvbaseenc.c b/sys/nvcodec/gstnvbaseenc.c index 8c9735a1f7..e653a13b7b 100644 --- a/sys/nvcodec/gstnvbaseenc.c +++ b/sys/nvcodec/gstnvbaseenc.c @@ -314,8 +314,8 @@ gst_nv_base_enc_open (GstVideoEncoder * enc) NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params = { 0, }; NVENCSTATUS nv_ret; - params.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER; - params.apiVersion = NVENCAPI_VERSION; + params.version = gst_nvenc_get_open_encode_session_ex_params_version (); + params.apiVersion = gst_nvenc_get_api_version (); params.device = gst_cuda_context_get_handle (nvenc->cuda_ctx); params.deviceType = NV_ENC_DEVICE_TYPE_CUDA; nv_ret = NvEncOpenEncodeSessionEx (¶ms, &nvenc->encoder); @@ -795,7 +795,7 @@ gst_nv_base_enc_bitstream_thread (gpointer user_data) GST_LOG_OBJECT (nvenc, "waiting for output buffer %p to be ready", out_buf); - lock_bs.version = NV_ENC_LOCK_BITSTREAM_VER; + lock_bs.version = gst_nvenc_get_lock_bitstream_version (); lock_bs.outputBitstream = out_buf; lock_bs.doNotWait = 0; @@ -1136,13 +1136,13 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) g_atomic_int_set (&nvenc->reconfig, FALSE); if (old_state) { - reconfigure_params.version = NV_ENC_RECONFIGURE_PARAMS_VER; + reconfigure_params.version = gst_nvenc_get_reconfigure_params_version (); params = &reconfigure_params.reInitEncodeParams; } else { params = &init_params; } - params->version = NV_ENC_INITIALIZE_PARAMS_VER; + params->version = gst_nvenc_get_initialize_params_version (); params->encodeGUID = nvenc_class->codec_id; params->encodeWidth = GST_VIDEO_INFO_WIDTH (info); params->encodeHeight = GST_VIDEO_INFO_HEIGHT (info); @@ -1208,8 +1208,8 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) } } - preset_config.version = NV_ENC_PRESET_CONFIG_VER; - preset_config.presetCfg.version = NV_ENC_CONFIG_VER; + preset_config.version = gst_nvenc_get_preset_config_version (); + preset_config.presetCfg.version = gst_nvenc_get_config_version (); nv_ret = NvEncGetEncodePresetConfig (nvenc->encoder, @@ -1364,7 +1364,8 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) g_assert_not_reached (); } - in_gl_resource->nv_resource.version = NV_ENC_REGISTER_RESOURCE_VER; + in_gl_resource->nv_resource.version = + gst_nvenc_get_registure_resource_version (); in_gl_resource->nv_resource.resourceType = NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR; in_gl_resource->nv_resource.width = input_width; @@ -1393,7 +1394,7 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) for (i = 0; i < nvenc->n_bufs; ++i) { NV_ENC_CREATE_INPUT_BUFFER cin_buf = { 0, }; - cin_buf.version = NV_ENC_CREATE_INPUT_BUFFER_VER; + cin_buf.version = gst_nvenc_get_create_input_buffer_version (); cin_buf.width = GST_ROUND_UP_32 (input_width); cin_buf.height = GST_ROUND_UP_32 (input_height); @@ -1425,7 +1426,7 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) for (i = 0; i < nvenc->n_bufs; ++i) { NV_ENC_CREATE_BITSTREAM_BUFFER cout_buf = { 0, }; - cout_buf.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER; + cout_buf.version = gst_nvenc_get_create_bitstream_buffer_version (); /* 1 MB should be large enough to hold most output frames. * NVENC will automatically increase this if it's not enough. */ @@ -1456,7 +1457,7 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) NV_ENC_SEQUENCE_PARAM_PAYLOAD seq_param = { 0 }; uint32_t seq_size = 0; - seq_param.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER; + seq_param.version = gst_nvenc_get_sequence_param_payload_version (); seq_param.spsppsBuffer = g_alloca (1024); seq_param.inBufferSize = 1024; seq_param.outSPSPPSPayloadSize = &seq_size; @@ -1742,7 +1743,7 @@ _submit_input_buffer (GstNvBaseEnc * nvenc, GstVideoCodecFrame * frame, "pts %" GST_TIME_FORMAT, frame->system_frame_number, inputBuffer, outputBufferPtr, GST_TIME_ARGS (frame->pts)); - pic_params.version = NV_ENC_PIC_PARAMS_VER; + pic_params.version = gst_nvenc_get_pic_params_version (); pic_params.inputBuffer = inputBufferPtr; pic_params.bufferFmt = bufferFormat; @@ -1867,7 +1868,8 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame) goto error; } - in_gl_resource->nv_mapped_resource.version = NV_ENC_MAP_INPUT_RESOURCE_VER; + in_gl_resource->nv_mapped_resource.version = + gst_nvenc_get_map_input_resource_version (); in_gl_resource->nv_mapped_resource.registeredResource = in_gl_resource->nv_resource.registeredResource; @@ -1916,7 +1918,7 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame) GST_LOG_OBJECT (enc, "got input buffer %p", in_buf); - in_buf_lock.version = NV_ENC_LOCK_INPUT_BUFFER_VER; + in_buf_lock.version = gst_nvenc_get_lock_input_buffer_version (); in_buf_lock.inputBuffer = in_buf; nv_ret = NvEncLockInputBuffer (nvenc->encoder, &in_buf_lock); @@ -2078,7 +2080,7 @@ gst_nv_base_enc_drain_encoder (GstNvBaseEnc * nvenc) return TRUE; } - pic_params.version = NV_ENC_PIC_PARAMS_VER; + pic_params.version = gst_nvenc_get_pic_params_version (); pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; nv_ret = NvEncEncodePicture (nvenc->encoder, &pic_params); diff --git a/sys/nvcodec/gstnvenc.c b/sys/nvcodec/gstnvenc.c index 330ec1b781..e08b611a90 100644 --- a/sys/nvcodec/gstnvenc.c +++ b/sys/nvcodec/gstnvenc.c @@ -355,7 +355,7 @@ gst_nvenc_get_supported_input_formats (gpointer encoder, GUID codec_id, #endif }; - param.version = NV_ENC_CAPS_PARAM_VER; + param.version = gst_nvenc_get_caps_param_version (); param.capsToQuery = NV_ENC_CAPS_SUPPORT_YUV444_ENCODE; if (NvEncGetEncodeCaps (encoder, codec_id, ¶m, &support_yuv444) != NV_ENC_SUCCESS) { @@ -453,7 +453,7 @@ gst_nvenc_get_interlace_modes (gpointer enc, GUID codec_id) GValue val = G_VALUE_INIT; gint interlace_modes = 0; - caps_param.version = NV_ENC_CAPS_PARAM_VER; + caps_param.version = gst_nvenc_get_caps_param_version (); caps_param.capsToQuery = NV_ENC_CAPS_SUPPORT_FIELD_ENCODING; if (NvEncGetEncodeCaps (enc, codec_id, &caps_param, @@ -528,7 +528,7 @@ gst_nvenc_get_supported_codec_profiles (gpointer enc, GUID codec_id) #endif }; - param.version = NV_ENC_CAPS_PARAM_VER; + param.version = gst_nvenc_get_caps_param_version (); param.capsToQuery = NV_ENC_CAPS_SUPPORT_YUV444_ENCODE; if (NvEncGetEncodeCaps (enc, codec_id, ¶m, &support_yuv444) != NV_ENC_SUCCESS) { @@ -626,8 +626,8 @@ gst_nv_enc_register (GstPlugin * plugin, GType type, GUID codec_id, goto cuda_free; } - params.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER; - params.apiVersion = NVENCAPI_VERSION; + params.version = gst_nvenc_get_open_encode_session_ex_params_version (); + params.apiVersion = gst_nvenc_get_api_version (); params.device = cuda_ctx; params.deviceType = NV_ENC_DEVICE_TYPE_CUDA; @@ -655,7 +655,7 @@ gst_nv_enc_register (GstPlugin * plugin, GType type, GUID codec_id, if (!profiles) goto free_format; - caps_param.version = NV_ENC_CAPS_PARAM_VER; + caps_param.version = gst_nvenc_get_caps_param_version (); caps_param.capsToQuery = NV_ENC_CAPS_WIDTH_MAX; if (NvEncGetEncodeCaps (enc, codec_id, &caps_param, &max_width) != NV_ENC_SUCCESS) { @@ -739,10 +739,20 @@ gst_nv_enc_register (GstPlugin * plugin, GType type, GUID codec_id, } } +/* For backward compatibility */ +#define GST_NVENC_API_MAJOR_VERSION 8 +#define GST_NVENC_API_MINOR_VERSION 1 + +#define GST_NVENCAPI_VERSION (GST_NVENC_API_MAJOR_VERSION | (GST_NVENC_API_MINOR_VERSION << 24)) +#define GST_NVENCAPI_STRUCT_VERSION(ver,api_ver) ((uint32_t)(api_ver) | ((ver)<<16) | (0x7 << 28)) + +static guint32 gst_nvenc_api_version = NVENCAPI_VERSION; void gst_nvenc_plugin_init (GstPlugin * plugin) { + NVENCSTATUS ret = NV_ENC_SUCCESS; + GST_DEBUG_CATEGORY_INIT (gst_nvenc_debug, "nvenc", 0, "Nvidia NVENC encoder"); nvenc_api.version = NV_ENCODE_API_FUNCTION_LIST_VER; @@ -751,9 +761,49 @@ gst_nvenc_plugin_init (GstPlugin * plugin) return; } - if (nvEncodeAPICreateInstance (&nvenc_api) != NV_ENC_SUCCESS) { - GST_ERROR ("Failed to get NVEncodeAPI function table!"); - } else { + ret = nvEncodeAPICreateInstance (&nvenc_api); + + /* WARNING: Any developers who want to bump SDK version must ensure that + * following macro values were not changed and also need to check ABI compatibility. + * Otherwise, gst_nvenc_get_ helpers also should be updated. + * Currently SDK 8.1 and 9.0 compatible + * + * NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24)) + * + * NVENCAPI_STRUCT_VERSION(ver) ((uint32_t)NVENCAPI_VERSION | ((ver)<<16) | (0x7 << 28)) + * + * NV_ENC_CAPS_PARAM_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_ENCODE_OUT_PARAMS_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_CREATE_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_CREATE_BITSTREAM_BUFFER_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_CREATE_MV_BUFFER_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_RC_PARAMS_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_CONFIG_VER (NVENCAPI_STRUCT_VERSION(7) | ( 1<<31 )) + * NV_ENC_INITIALIZE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(5) | ( 1<<31 )) + * NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1<<31 )) + * NV_ENC_PRESET_CONFIG_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) + * NV_ENC_PIC_PARAMS_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) + * NV_ENC_MEONLY_PARAMS_VER NVENCAPI_STRUCT_VERSION(3) + * NV_ENC_LOCK_BITSTREAM_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_LOCK_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_MAP_INPUT_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4) + * NV_ENC_REGISTER_RESOURCE_VER NVENCAPI_STRUCT_VERSION(3) + * NV_ENC_STAT_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_EVENT_PARAMS_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER NVENCAPI_STRUCT_VERSION(1) + * NV_ENCODE_API_FUNCTION_LIST_VER NVENCAPI_STRUCT_VERSION(2) + */ + if (ret != NV_ENC_SUCCESS) { + GST_WARNING ("Failed to get the latest NVEncodeAPI function table!"); + gst_nvenc_api_version = GST_NVENCAPI_VERSION; + /* NV_ENCODE_API_FUNCTION_LIST_VER == NVENCAPI_STRUCT_VERSION(2) */ + nvenc_api.version = GST_NVENCAPI_STRUCT_VERSION (2, gst_nvenc_api_version); + + ret = nvEncodeAPICreateInstance (&nvenc_api); + } + + if (ret == NV_ENC_SUCCESS) { CUresult cuda_ret; gint dev_count = 0; @@ -775,6 +825,159 @@ gst_nvenc_plugin_init (GstPlugin * plugin) NV_ENC_CODEC_H264_GUID, "h264", GST_RANK_PRIMARY * 2, dev_count); gst_nv_enc_register (plugin, GST_TYPE_NV_H265_ENC, NV_ENC_CODEC_HEVC_GUID, "h265", GST_RANK_PRIMARY * 2, dev_count); - + } else { + GST_ERROR ("too old driver, could not load api vtable"); } } + +guint32 +gst_nvenc_get_api_version (void) +{ + /* NVENCAPI_VERSION == (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24)) */ + return gst_nvenc_api_version; +} + +guint32 +gst_nvenc_get_caps_param_version (void) +{ + /* NV_ENC_CAPS_PARAM_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_encode_out_params_version (void) +{ + /* NV_ENC_ENCODE_OUT_PARAMS_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_create_input_buffer_version (void) +{ + /* NV_ENC_CREATE_INPUT_BUFFER_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_create_bitstream_buffer_version (void) +{ + /* NV_ENC_CREATE_BITSTREAM_BUFFER_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_create_mv_buffer_version (void) +{ + /* NV_ENC_CREATE_MV_BUFFER_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_rc_params_version (void) +{ + /* NV_ENC_RC_PARAMS_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_config_version (void) +{ + /* NV_ENC_CONFIG_VER == + * (NVENCAPI_STRUCT_VERSION(7) | ( 1<<31 )) */ + return GST_NVENCAPI_STRUCT_VERSION (7, gst_nvenc_api_version) | (1 << 31); +} + +guint32 +gst_nvenc_get_initialize_params_version (void) +{ + /* NV_ENC_INITIALIZE_PARAMS_VER == + * (NVENCAPI_STRUCT_VERSION(5) | ( 1<<31 )) */ + return GST_NVENCAPI_STRUCT_VERSION (5, gst_nvenc_api_version) | (1 << 31); +} + +guint32 +gst_nvenc_get_reconfigure_params_version (void) +{ + /* NV_ENC_RECONFIGURE_PARAMS_VER == + * (NVENCAPI_STRUCT_VERSION(1) | ( 1<<31 )) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version) | (1 << 31); +} + +guint32 +gst_nvenc_get_preset_config_version (void) +{ + /* NV_ENC_PRESET_CONFIG_VER == + * (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) */ + return GST_NVENCAPI_STRUCT_VERSION (4, gst_nvenc_api_version) | (1 << 31); +} + +guint32 +gst_nvenc_get_pic_params_version (void) +{ + /* NV_ENC_PIC_PARAMS_VER == + * (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 )) */ + return GST_NVENCAPI_STRUCT_VERSION (4, gst_nvenc_api_version) | (1 << 31); +} + +guint32 +gst_nvenc_get_meonly_params_version (void) +{ + /* NV_ENC_MEONLY_PARAMS_VER == NVENCAPI_STRUCT_VERSION(3) */ + return GST_NVENCAPI_STRUCT_VERSION (3, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_lock_bitstream_version (void) +{ + /* NV_ENC_LOCK_BITSTREAM_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_lock_input_buffer_version (void) +{ + /* NV_ENC_LOCK_INPUT_BUFFER_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_map_input_resource_version (void) +{ + /* NV_ENC_MAP_INPUT_RESOURCE_VER == NVENCAPI_STRUCT_VERSION(4) */ + return GST_NVENCAPI_STRUCT_VERSION (4, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_registure_resource_version (void) +{ + /* NV_ENC_REGISTER_RESOURCE_VER == NVENCAPI_STRUCT_VERSION(3) */ + return GST_NVENCAPI_STRUCT_VERSION (3, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_stat_version (void) +{ + /* NV_ENC_STAT_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_sequence_param_payload_version (void) +{ + /* NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_event_params_version (void) +{ + /* NV_ENC_EVENT_PARAMS_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} + +guint32 +gst_nvenc_get_open_encode_session_ex_params_version (void) +{ + /* NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER == NVENCAPI_STRUCT_VERSION(1) */ + return GST_NVENCAPI_STRUCT_VERSION (1, gst_nvenc_api_version); +} diff --git a/sys/nvcodec/gstnvenc.h b/sys/nvcodec/gstnvenc.h index cde836119e..492108b5a9 100644 --- a/sys/nvcodec/gstnvenc.h +++ b/sys/nvcodec/gstnvenc.h @@ -28,23 +28,90 @@ GST_DEBUG_CATEGORY_EXTERN (gst_nvenc_debug); +G_GNUC_INTERNAL gboolean gst_nvenc_cmp_guid (GUID g1, GUID g2); +G_GNUC_INTERNAL NV_ENC_BUFFER_FORMAT gst_nvenc_get_nv_buffer_format (GstVideoFormat fmt); +G_GNUC_INTERNAL gboolean gst_nvenc_get_supported_input_formats (gpointer encoder, GUID codec_id, GValue ** formats); - +G_GNUC_INTERNAL GValue * gst_nvenc_get_interlace_modes (gpointer enc, GUID codec_id); +G_GNUC_INTERNAL GValue * gst_nvenc_get_supported_codec_profiles (gpointer enc, GUID codec_id); - +G_GNUC_INTERNAL void gst_nvenc_plugin_init (GstPlugin * plugin); +G_GNUC_INTERNAL +guint32 gst_nvenc_get_api_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_caps_param_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_encode_out_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_create_input_buffer_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_create_bitstream_buffer_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_create_mv_buffer_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_rc_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_config_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_initialize_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_reconfigure_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_preset_config_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_pic_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_meonly_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_lock_bitstream_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_lock_input_buffer_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_map_input_resource_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_registure_resource_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_stat_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_sequence_param_payload_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_event_params_version (void); + +G_GNUC_INTERNAL +guint32 gst_nvenc_get_open_encode_session_ex_params_version (void); + #endif /* __GST_NVENC_H_INCLUDED__ */ diff --git a/sys/nvcodec/gstnvh264enc.c b/sys/nvcodec/gstnvh264enc.c index 2876a351a6..78b7bb38ff 100644 --- a/sys/nvcodec/gstnvh264enc.c +++ b/sys/nvcodec/gstnvh264enc.c @@ -139,7 +139,7 @@ gst_nv_h264_enc_set_profile_and_level (GstNvH264Enc * nvenc, GstCaps * caps) NVENCSTATUS nv_ret; guint32 seq_size; - spp.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER; + spp.version = gst_nvenc_get_sequence_param_payload_version (); spp.inBufferSize = N_BYTES_SPS; spp.spsId = 0; spp.ppsId = 0; diff --git a/sys/nvcodec/gstnvh265enc.c b/sys/nvcodec/gstnvh265enc.c index 0471ab00d7..385e7ee404 100644 --- a/sys/nvcodec/gstnvh265enc.c +++ b/sys/nvcodec/gstnvh265enc.c @@ -165,7 +165,7 @@ gst_nv_h265_enc_set_level_tier_and_profile (GstNvH265Enc * nvenc, NVENCSTATUS nv_ret; guint32 seq_size; - spp.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER; + spp.version = gst_nvenc_get_sequence_param_payload_version (); spp.inBufferSize = N_BYTES_VPS; spp.spsId = 0; spp.ppsId = 0;