kmssink: Escape DRM property names

This allow setting properties that contains spaces. The spaces are
replaced with '-'. As an example, one can set the connector proper
"scaling mode" with the following:

  ... ! kmssink connector-properties="s,scaling-mode=1"

https://bugzilla.gnome.org/show_bug.cgi?id=797027
This commit is contained in:
Nicolas Dufresne 2018-08-29 11:53:13 -04:00
parent 63dca26fac
commit 2f30287b5f

View file

@ -573,6 +573,12 @@ set_drm_property (gint fd, guint32 object, guint32 object_type,
drmModePropertyPtr property;
property = drmModeGetProperty (fd, properties->props[i]);
/* GstStructure parser limits the set of supported character, so we
* replace the invalid characters with '-'. In DRM, this is generally
* replacing spaces into '-'. */
g_strcanon (property->name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS, '-');
if (!strcmp (property->name, prop_name)) {
drmModeObjectSetProperty (fd, object, object_type,
property->prop_id, value);