summaryrefslogtreecommitdiff
path: root/sys/nvenc/gstnvh264enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nvenc/gstnvh264enc.c')
-rw-r--r--sys/nvenc/gstnvh264enc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/nvenc/gstnvh264enc.c b/sys/nvenc/gstnvh264enc.c
index df25e7a59..cc7e156f2 100644
--- a/sys/nvenc/gstnvh264enc.c
+++ b/sys/nvenc/gstnvh264enc.c
@@ -119,6 +119,9 @@ _get_supported_profiles (GstNvH264Enc * nvenc)
GValue val = G_VALUE_INIT;
guint i, n, n_profiles;
+ if (nvenc->supported_profiles)
+ return TRUE;
+
nv_ret =
NvEncGetEncodeProfileGUIDCount (GST_NV_BASE_ENC (nvenc)->encoder,
NV_ENC_CODEC_H264_GUID, &n);
@@ -161,8 +164,8 @@ _get_supported_profiles (GstNvH264Enc * nvenc)
return FALSE;
GST_OBJECT_LOCK (nvenc);
- g_free (nvenc->supported_profiles);
- nvenc->supported_profiles = g_memdup (&list, sizeof (GValue));
+ nvenc->supported_profiles = g_new0 (GValue, 1);
+ *nvenc->supported_profiles = list;
GST_OBJECT_UNLOCK (nvenc);
return TRUE;
@@ -211,6 +214,8 @@ gst_nv_h264_enc_close (GstVideoEncoder * enc)
GstNvH264Enc *nvenc = GST_NV_H264_ENC (enc);
GST_OBJECT_LOCK (nvenc);
+ if (nvenc->supported_profiles)
+ g_value_unset (nvenc->supported_profiles);
g_free (nvenc->supported_profiles);
nvenc->supported_profiles = NULL;
GST_OBJECT_UNLOCK (nvenc);
@@ -244,6 +249,7 @@ _get_interlace_modes (GstNvH264Enc * nvenc)
gst_value_list_append_value (list, &val);
g_value_set_static_string (&val, "mixed");
gst_value_list_append_value (list, &val);
+ g_value_unset (&val);
}
/* TODO: figure out what nvenc frame based interlacing means in gst terms */
@@ -269,6 +275,7 @@ gst_nv_h264_enc_getcaps (GstVideoEncoder * enc, GstCaps * filter)
val = _get_interlace_modes (nvenc);
gst_caps_set_value (supported_incaps, "interlace-mode", val);
+ g_value_unset (val);
g_free (val);
GST_LOG_OBJECT (enc, "codec input caps %" GST_PTR_FORMAT, supported_incaps);