kmssink: add can-scale property

https://bugzilla.gnome.org/show_bug.cgi?id=784599
This commit is contained in:
Haihua Hu 2017-09-12 15:46:01 +08:00 committed by Nicolas Dufresne
parent beb32ab37d
commit ff9a4390cb

View file

@ -79,6 +79,7 @@ enum
PROP_CONNECTOR_ID,
PROP_PLANE_ID,
PROP_FORCE_MODESETTING,
PROP_CAN_SCALE,
PROP_N
};
@ -525,8 +526,6 @@ gst_kms_sink_start (GstBaseSink * bsink)
if (!get_drm_caps (self))
goto bail;
self->can_scale = TRUE;
res = drmModeGetResources (self->fd);
if (!res)
goto resources_failed;
@ -1410,6 +1409,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
case PROP_FORCE_MODESETTING:
sink->modesetting_enabled = g_value_get_boolean (value);
break;
case PROP_CAN_SCALE:
sink->can_scale = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1440,6 +1442,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
case PROP_FORCE_MODESETTING:
g_value_set_boolean (value, sink->modesetting_enabled);
break;
case PROP_CAN_SCALE:
g_value_set_boolean (value, sink->can_scale);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1465,6 +1470,7 @@ gst_kms_sink_init (GstKMSSink * sink)
sink->fd = -1;
sink->conn_id = -1;
sink->plane_id = -1;
sink->can_scale = TRUE;
gst_poll_fd_init (&sink->pollfd);
sink->poll = gst_poll_new (TRUE);
gst_video_info_init (&sink->vinfo);
@ -1561,6 +1567,16 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass)
"When enabled, the sink try to configure the display mode", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
/**
* kmssink:can-scale:
*
* User can tell kmssink if the driver can support scale.
*/
g_properties[PROP_CAN_SCALE] =
g_param_spec_boolean ("can-scale", "can scale",
"User can tell kmssink if the driver can support scale", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
g_object_class_install_properties (gobject_class, PROP_N, g_properties);
}