qsv: Remove strcpy for DRM device path

Simplify code. It's just one-time allocation, so don't need to worry
about leaking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1835>
This commit is contained in:
Seungha Yang 2022-03-03 04:22:15 +09:00 committed by GStreamer Marge Bot
parent 799616aea9
commit 00f773bd10
6 changed files with 6 additions and 16 deletions

View file

@ -66,7 +66,7 @@ struct _GstQsvDecoderClass
gint64 adapter_luid;
/* VA display device path, for Linux */
gchar display_path[64];
gchar *display_path;
};
GType gst_qsv_decoder_get_type (void);

View file

@ -66,7 +66,7 @@ struct _GstQsvEncoderClass
gint64 adapter_luid;
/* VA display device path, for Linux */
gchar display_path[64];
gchar *display_path;
gboolean (*set_format) (GstQsvEncoder * encoder,
GstVideoCodecState * state,

View file

@ -54,10 +54,7 @@ gst_qsv_h264_dec_class_init (GstQsvH264DecClass * klass, gpointer data)
qsvdec_class->codec_id = MFX_CODEC_AVC;
qsvdec_class->impl_index = cdata->impl_index;
qsvdec_class->adapter_luid = cdata->adapter_luid;
if (cdata->display_path) {
strncpy (qsvdec_class->display_path, cdata->display_path,
sizeof (qsvdec_class->display_path));
}
qsvdec_class->display_path = cdata->display_path;
gst_element_class_set_static_metadata (element_class,
"Intel Quick Sync Video H.264 Decoder",
@ -74,7 +71,6 @@ gst_qsv_h264_dec_class_init (GstQsvH264DecClass * klass, gpointer data)
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);
g_free (cdata->display_path);
g_free (cdata);
}

View file

@ -272,8 +272,7 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data)
qsvenc_class->codec_id = MFX_CODEC_AVC;
qsvenc_class->impl_index = cdata->impl_index;
qsvenc_class->adapter_luid = cdata->adapter_luid;
if (cdata->display_path)
strcpy (qsvenc_class->display_path, cdata->display_path);
qsvenc_class->display_path = cdata->display_path;
object_class->finalize = gst_qsv_h264_enc_finalize;
object_class->set_property = gst_qsv_h264_enc_set_property;
@ -452,7 +451,6 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data)
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);
g_free (cdata->display_path);
g_free (cdata);
}

View file

@ -192,8 +192,7 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data)
qsvenc_class->codec_id = MFX_CODEC_AVC;
qsvenc_class->impl_index = cdata->impl_index;
qsvenc_class->adapter_luid = cdata->adapter_luid;
if (cdata->display_path)
strcpy (qsvenc_class->display_path, cdata->display_path);
qsvenc_class->display_path = cdata->display_path;
object_class->finalize = gst_qsv_h265_enc_finalize;
object_class->set_property = gst_qsv_h265_enc_set_property;
@ -280,7 +279,6 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data)
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);
g_free (cdata->display_path);
g_free (cdata);
}

View file

@ -146,8 +146,7 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data)
qsvenc_class->codec_id = MFX_CODEC_VP9;
qsvenc_class->impl_index = cdata->impl_index;
qsvenc_class->adapter_luid = cdata->adapter_luid;
if (cdata->display_path)
strcpy (qsvenc_class->display_path, cdata->display_path);
qsvenc_class->display_path = cdata->display_path;
object_class->finalize = gst_qsv_vp9_enc_finalize;
object_class->set_property = gst_qsv_vp9_enc_set_property;
@ -220,7 +219,6 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data)
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);
g_free (cdata->display_path);
g_free (cdata);
}