mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
controller: add api to check for active controllers (needed for e.g. volume)
This commit is contained in:
parent
0f2d8ab5c2
commit
efd4402ee0
5 changed files with 73 additions and 4 deletions
|
@ -569,6 +569,7 @@ gst_controller_add_properties_valist
|
|||
gst_controller_remove_properties
|
||||
gst_controller_remove_properties_list
|
||||
gst_controller_remove_properties_valist
|
||||
gst_controller_is_active
|
||||
gst_controller_set_disabled
|
||||
gst_controller_set_property_disabled
|
||||
gst_controller_suggest_next_sync
|
||||
|
@ -1575,6 +1576,7 @@ gst_object_control_properties
|
|||
gst_object_uncontrol_properties
|
||||
gst_object_suggest_next_sync
|
||||
gst_object_sync_values
|
||||
gst_object_has_active_automation
|
||||
gst_object_set_automation_disabled
|
||||
gst_object_set_property_automation_disabled
|
||||
gst_object_get_control_source
|
||||
|
|
|
@ -490,6 +490,34 @@ gst_controller_remove_properties (GstController * self, ...)
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_controller_is_active:
|
||||
* @self: the #GstController which should be disabled
|
||||
*
|
||||
* Check if the controller is active. It is active if it has at least one
|
||||
* controlled property that is not disabled.
|
||||
*
|
||||
* Returns: %TRUE if the controller is active
|
||||
*/
|
||||
gboolean
|
||||
gst_controller_is_active (GstController * self)
|
||||
{
|
||||
gboolean active = FALSE;
|
||||
GList *node;
|
||||
GstControlledProperty *prop;
|
||||
|
||||
g_return_if_fail (GST_IS_CONTROLLER (self));
|
||||
|
||||
g_mutex_lock (self->lock);
|
||||
for (node = self->properties; node; node = node->next) {
|
||||
prop = node->data;
|
||||
active |= !prop->disabled;
|
||||
}
|
||||
g_mutex_unlock (self->lock);
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_controller_set_property_disabled:
|
||||
* @self: the #GstController which should be disabled
|
||||
|
@ -501,7 +529,6 @@ gst_controller_remove_properties (GstController * self, ...)
|
|||
* some time, i.e. gst_controller_sync_values() will do nothing for the
|
||||
* property.
|
||||
*/
|
||||
|
||||
void
|
||||
gst_controller_set_property_disabled (GstController * self,
|
||||
const gchar * property_name, gboolean disabled)
|
||||
|
@ -518,7 +545,6 @@ gst_controller_set_property_disabled (GstController * self,
|
|||
g_mutex_unlock (self->lock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_controller_set_disabled:
|
||||
* @self: the #GstController which should be disabled
|
||||
|
|
|
@ -93,6 +93,7 @@ gboolean gst_controller_remove_properties_valist (GstController * self, va_list
|
|||
gboolean gst_controller_remove_properties_list (GstController * self, GList *list);
|
||||
gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gboolean gst_controller_is_active (GstController * self);
|
||||
void gst_controller_set_disabled (GstController *self, gboolean disabled);
|
||||
void gst_controller_set_property_disabled (GstController *self, const gchar * property_name, gboolean disabled);
|
||||
gboolean gst_controller_set_control_source (GstController *self, const gchar * property_name, GstControlSource *csource);
|
||||
|
|
|
@ -1059,7 +1059,36 @@ gst_object_sync_values (GstObject * object, GstClockTime timestamp)
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
// FIXME: docs
|
||||
/**
|
||||
* gst_object_has_active_automation:
|
||||
* @object: the object that has controlled properties
|
||||
*
|
||||
* Check if the object has an active controller. It has one if it has at least
|
||||
* one controlled property that is not disabled.
|
||||
*
|
||||
* Returns: %TRUE if the controller is active
|
||||
*/
|
||||
gboolean
|
||||
gst_object_has_active_automation (GstObject * object)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_if_fail (GST_IS_OBJECT (object));
|
||||
|
||||
if (object->ctrl)
|
||||
res = gst_controller_is_active ((GstController *) object->ctrl);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_object_set_automation_disabled:
|
||||
* @object: the object that has controlled properties
|
||||
* @disabled: boolean that specifies whether to disable the controller
|
||||
* or not.
|
||||
*
|
||||
* This function is used to disable all properties of the #GstController
|
||||
* for some time, i.e. gst_object_sync_values() will do nothing..
|
||||
*/
|
||||
void
|
||||
gst_object_set_automation_disabled (GstObject * object, gboolean disabled)
|
||||
{
|
||||
|
@ -1069,7 +1098,17 @@ gst_object_set_automation_disabled (GstObject * object, gboolean disabled)
|
|||
gst_controller_set_disabled (object->ctrl, disabled);
|
||||
}
|
||||
|
||||
// FIXME: docs
|
||||
/**
|
||||
* gst_object_set_property_automation_disabled:
|
||||
* @object: the object that has controlled properties
|
||||
* @property_name: property to disable
|
||||
* @disabled: boolean that specifies whether to disable the controller
|
||||
* or not.
|
||||
*
|
||||
* This function is used to disable the #GstController on a property for
|
||||
* some time, i.e. gst_controller_sync_values() will do nothing for the
|
||||
* property.
|
||||
*/
|
||||
void
|
||||
gst_object_set_property_automation_disabled (GstObject * object,
|
||||
const gchar * property_name, gboolean disabled)
|
||||
|
|
|
@ -238,6 +238,7 @@ gboolean gst_object_uncontrol_properties (GstObject * object, ...) G_GNUC_NULL_T
|
|||
GstClockTime gst_object_suggest_next_sync (GstObject * object);
|
||||
gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
|
||||
|
||||
gboolean gst_object_has_active_automation (GstObject *object);
|
||||
void gst_object_set_automation_disabled (GstObject *object, gboolean disabled);
|
||||
void gst_object_set_property_automation_disabled (GstObject *object, const gchar * property_name, gboolean disabled);
|
||||
|
||||
|
|
Loading…
Reference in a new issue