Blame gst/gstcontrolbinding.c

Packit f546b1
/* GStreamer
Packit f546b1
 *
Packit f546b1
 * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
Packit f546b1
 *
Packit f546b1
 * gstcontrolbinding.c: Attachment for control sources
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 */
Packit f546b1
/**
Packit f546b1
 * SECTION:gstcontrolbinding
Packit f546b1
 * @title: GstControlBinding
Packit f546b1
 * @short_description: attachment for control source sources
Packit f546b1
 *
Packit f546b1
 * A base class for value mapping objects that attaches control sources to gobject
Packit f546b1
 * properties. Such an object is taking one or more #GstControlSource instances,
Packit f546b1
 * combines them and maps the resulting value to the type and value range of the
Packit f546b1
 * bound property.
Packit f546b1
 */
Packit f546b1
/* FIXME(ensonic): should we make gst_object_add_control_binding() internal
Packit f546b1
 * - we create the control_binding for a certain object anyway
Packit f546b1
 * - we could call gst_object_add_control_binding() at the end of
Packit f546b1
 *   gst_control_binding_constructor()
Packit f546b1
 * - the weak-ref on object is not nice, as is the same as gst_object_parent()
Packit f546b1
 *   once the object is added to the parent
Packit f546b1
 *
Packit f546b1
 * - another option would be to defer what is done in _constructor to when
Packit f546b1
 *   the parent is set (need to listen to the signal then)
Packit f546b1
 *   then basically I could
Packit f546b1
 *   a) remove the obj arg and wait the binding to be added or
Packit f546b1
 *   b) add the binding from constructor, unref object there and make obj
Packit f546b1
 *      writeonly
Packit f546b1
 */
Packit f546b1
Packit f546b1
#include "gst_private.h"
Packit f546b1
Packit f546b1
#include <glib-object.h>
Packit f546b1
#include <gst/gst.h>
Packit f546b1
Packit f546b1
#include "gstcontrolbinding.h"
Packit f546b1
Packit f546b1
#include <math.h>
Packit f546b1
Packit f546b1
#define GST_CAT_DEFAULT control_binding_debug
Packit f546b1
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
Packit f546b1
Packit f546b1
#define _do_init \
Packit f546b1
  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstcontrolbinding", 0, \
Packit f546b1
      "dynamic parameter control source attachment");
Packit f546b1
Packit f546b1
static GObject *gst_control_binding_constructor (GType type,
Packit f546b1
    guint n_construct_params, GObjectConstructParam * construct_params);
Packit f546b1
static void gst_control_binding_set_property (GObject * object, guint prop_id,
Packit f546b1
    const GValue * value, GParamSpec * pspec);
Packit f546b1
static void gst_control_binding_get_property (GObject * object, guint prop_id,
Packit f546b1
    GValue * value, GParamSpec * pspec);
Packit f546b1
static void gst_control_binding_dispose (GObject * object);
Packit f546b1
static void gst_control_binding_finalize (GObject * object);
Packit f546b1
Packit f546b1
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstControlBinding, gst_control_binding,
Packit f546b1
    GST_TYPE_OBJECT, _do_init);
Packit f546b1
Packit f546b1
struct _GstControlBindingPrivate
Packit f546b1
{
Packit f546b1
  GWeakRef object;
Packit f546b1
};
Packit f546b1
Packit f546b1
enum
Packit f546b1
{
Packit f546b1
  PROP_0,
Packit f546b1
  PROP_OBJECT,
Packit f546b1
  PROP_NAME,
Packit f546b1
  PROP_LAST
Packit f546b1
};
Packit f546b1
Packit f546b1
static GParamSpec *properties[PROP_LAST];
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_class_init (GstControlBindingClass * klass)
Packit f546b1
{
Packit f546b1
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
Packit f546b1
Packit f546b1
  g_type_class_add_private (klass, sizeof (GstControlBindingPrivate));
Packit f546b1
Packit f546b1
  gobject_class->constructor = gst_control_binding_constructor;
Packit f546b1
  gobject_class->set_property = gst_control_binding_set_property;
Packit f546b1
  gobject_class->get_property = gst_control_binding_get_property;
Packit f546b1
  gobject_class->dispose = gst_control_binding_dispose;
Packit f546b1
  gobject_class->finalize = gst_control_binding_finalize;
Packit f546b1
Packit f546b1
  properties[PROP_OBJECT] =
Packit f546b1
      g_param_spec_object ("object", "Object",
Packit f546b1
      "The object of the property", GST_TYPE_OBJECT,
Packit f546b1
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
Packit f546b1
Packit f546b1
  properties[PROP_NAME] =
Packit f546b1
      g_param_spec_string ("name", "Name", "The name of the property", NULL,
Packit f546b1
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
Packit f546b1
Packit f546b1
Packit f546b1
  g_object_class_install_properties (gobject_class, PROP_LAST, properties);
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_init (GstControlBinding * binding)
Packit f546b1
{
Packit f546b1
  binding->ABI.abi.priv =
Packit f546b1
      G_TYPE_INSTANCE_GET_PRIVATE (binding, GST_TYPE_CONTROL_BINDING,
Packit f546b1
      GstControlBindingPrivate);
Packit f546b1
  g_weak_ref_init (&binding->ABI.abi.priv->object, NULL);
Packit f546b1
}
Packit f546b1
Packit f546b1
static GObject *
Packit f546b1
gst_control_binding_constructor (GType type, guint n_construct_params,
Packit f546b1
    GObjectConstructParam * construct_params)
Packit f546b1
{
Packit f546b1
  GstControlBinding *binding;
Packit f546b1
  GParamSpec *pspec;
Packit f546b1
  GstObject *object;
Packit f546b1
Packit f546b1
  binding =
Packit f546b1
      GST_CONTROL_BINDING (G_OBJECT_CLASS (gst_control_binding_parent_class)
Packit f546b1
      ->constructor (type, n_construct_params, construct_params));
Packit f546b1
Packit f546b1
  object = g_weak_ref_get (&binding->ABI.abi.priv->object);
Packit f546b1
  if (!object) {
Packit f546b1
    GST_WARNING_OBJECT (object, "no object set");
Packit f546b1
    return (GObject *) binding;
Packit f546b1
  }
Packit f546b1
Packit f546b1
  GST_INFO_OBJECT (object, "trying to put property '%s' under control",
Packit f546b1
      binding->name);
Packit f546b1
Packit f546b1
  /* check if the object has a property of that name */
Packit f546b1
  if ((pspec =
Packit f546b1
          g_object_class_find_property (G_OBJECT_GET_CLASS (object),
Packit f546b1
              binding->name))) {
Packit f546b1
    GST_DEBUG_OBJECT (object, "  psec->flags : 0x%08x", pspec->flags);
Packit f546b1
Packit f546b1
    /* check if this param is witable && controlable && !construct-only */
Packit f546b1
    if ((pspec->flags & (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE |
Packit f546b1
                G_PARAM_CONSTRUCT_ONLY)) ==
Packit f546b1
        (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
Packit f546b1
      binding->pspec = pspec;
Packit f546b1
    } else {
Packit f546b1
      GST_WARNING_OBJECT (object,
Packit f546b1
          "property '%s' on class '%s' needs to "
Packit f546b1
          "be writeable, controlable and not construct_only", binding->name,
Packit f546b1
          G_OBJECT_TYPE_NAME (object));
Packit f546b1
    }
Packit f546b1
  } else {
Packit f546b1
    GST_WARNING_OBJECT (object, "class '%s' has no property '%s'",
Packit f546b1
        G_OBJECT_TYPE_NAME (object), binding->name);
Packit f546b1
  }
Packit f546b1
Packit f546b1
  gst_object_unref (object);
Packit f546b1
Packit f546b1
  return (GObject *) binding;
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_dispose (GObject * object)
Packit f546b1
{
Packit f546b1
  GstControlBinding *self = GST_CONTROL_BINDING (object);
Packit f546b1
Packit f546b1
  /* we did not took a reference */
Packit f546b1
  g_object_remove_weak_pointer ((GObject *) self->__object,
Packit f546b1
      (gpointer *) & self->__object);
Packit f546b1
  self->__object = NULL;
Packit f546b1
  g_weak_ref_clear (&self->ABI.abi.priv->object);
Packit f546b1
Packit f546b1
  ((GObjectClass *) gst_control_binding_parent_class)->dispose (object);
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_finalize (GObject * object)
Packit f546b1
{
Packit f546b1
  GstControlBinding *self = GST_CONTROL_BINDING (object);
Packit f546b1
Packit f546b1
  g_free (self->name);
Packit f546b1
Packit f546b1
  ((GObjectClass *) gst_control_binding_parent_class)->finalize (object);
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_set_property (GObject * object, guint prop_id,
Packit f546b1
    const GValue * value, GParamSpec * pspec)
Packit f546b1
{
Packit f546b1
  GstControlBinding *self = GST_CONTROL_BINDING (object);
Packit f546b1
Packit f546b1
  switch (prop_id) {
Packit f546b1
    case PROP_OBJECT:
Packit f546b1
      /* do not ref to avoid a ref cycle */
Packit f546b1
      self->__object = g_value_get_object (value);
Packit f546b1
      g_object_add_weak_pointer ((GObject *) self->__object,
Packit f546b1
          (gpointer *) & self->__object);
Packit f546b1
Packit f546b1
      g_weak_ref_set (&self->ABI.abi.priv->object, self->__object);
Packit f546b1
      break;
Packit f546b1
    case PROP_NAME:
Packit f546b1
      self->name = g_value_dup_string (value);
Packit f546b1
      break;
Packit f546b1
    default:
Packit f546b1
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Packit f546b1
      break;
Packit f546b1
  }
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_control_binding_get_property (GObject * object, guint prop_id,
Packit f546b1
    GValue * value, GParamSpec * pspec)
Packit f546b1
{
Packit f546b1
  GstControlBinding *self = GST_CONTROL_BINDING (object);
Packit f546b1
Packit f546b1
  switch (prop_id) {
Packit f546b1
    case PROP_OBJECT:
Packit f546b1
      g_value_take_object (value, g_weak_ref_get (&self->ABI.abi.priv->object));
Packit f546b1
      break;
Packit f546b1
    case PROP_NAME:
Packit f546b1
      g_value_set_string (value, self->name);
Packit f546b1
      break;
Packit f546b1
    default:
Packit f546b1
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Packit f546b1
      break;
Packit f546b1
  }
Packit f546b1
}
Packit f546b1
Packit f546b1
/* functions */
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_sync_values:
Packit f546b1
 * @binding: the control binding
Packit f546b1
 * @object: the object that has controlled properties
Packit f546b1
 * @timestamp: the time that should be processed
Packit f546b1
 * @last_sync: the last time this was called
Packit f546b1
 *
Packit f546b1
 * Sets the property of the @object, according to the #GstControlSources that
Packit f546b1
 * handle them and for the given timestamp.
Packit f546b1
 *
Packit f546b1
 * If this function fails, it is most likely the application developers fault.
Packit f546b1
 * Most probably the control sources are not setup correctly.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if the controller value could be applied to the object
Packit f546b1
 * property, %FALSE otherwise
Packit f546b1
 */
Packit f546b1
gboolean
Packit f546b1
gst_control_binding_sync_values (GstControlBinding * binding,
Packit f546b1
    GstObject * object, GstClockTime timestamp, GstClockTime last_sync)
Packit f546b1
{
Packit f546b1
  GstControlBindingClass *klass;
Packit f546b1
  gboolean ret = FALSE;
Packit f546b1
Packit f546b1
  g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
Packit f546b1
Packit f546b1
  if (binding->disabled)
Packit f546b1
    return TRUE;
Packit f546b1
Packit f546b1
  klass = GST_CONTROL_BINDING_GET_CLASS (binding);
Packit f546b1
Packit f546b1
  if (G_LIKELY (klass->sync_values != NULL)) {
Packit f546b1
    ret = klass->sync_values (binding, object, timestamp, last_sync);
Packit f546b1
  } else {
Packit f546b1
    GST_WARNING_OBJECT (binding, "missing sync_values implementation");
Packit f546b1
  }
Packit f546b1
  return ret;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_get_value:
Packit f546b1
 * @binding: the control binding
Packit f546b1
 * @timestamp: the time the control-change should be read from
Packit f546b1
 *
Packit f546b1
 * Gets the value for the given controlled property at the requested time.
Packit f546b1
 *
Packit f546b1
 * Returns: (nullable): the GValue of the property at the given time,
Packit f546b1
 * or %NULL if the property isn't controlled.
Packit f546b1
 */
Packit f546b1
GValue *
Packit f546b1
gst_control_binding_get_value (GstControlBinding * binding,
Packit f546b1
    GstClockTime timestamp)
Packit f546b1
{
Packit f546b1
  GstControlBindingClass *klass;
Packit f546b1
  GValue *ret = NULL;
Packit f546b1
Packit f546b1
  g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), NULL);
Packit f546b1
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), NULL);
Packit f546b1
Packit f546b1
  klass = GST_CONTROL_BINDING_GET_CLASS (binding);
Packit f546b1
Packit f546b1
  if (G_LIKELY (klass->get_value != NULL)) {
Packit f546b1
    ret = klass->get_value (binding, timestamp);
Packit f546b1
  } else {
Packit f546b1
    GST_WARNING_OBJECT (binding, "missing get_value implementation");
Packit f546b1
  }
Packit f546b1
  return ret;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_get_value_array: (skip)
Packit f546b1
 * @binding: the control binding
Packit f546b1
 * @timestamp: the time that should be processed
Packit f546b1
 * @interval: the time spacing between subsequent values
Packit f546b1
 * @n_values: the number of values
Packit f546b1
 * @values: (array length=n_values): array to put control-values in
Packit f546b1
 *
Packit f546b1
 * Gets a number of values for the given controlled property starting at the
Packit f546b1
 * requested time. The array @values need to hold enough space for @n_values of
Packit f546b1
 * the same type as the objects property's type.
Packit f546b1
 *
Packit f546b1
 * This function is useful if one wants to e.g. draw a graph of the control
Packit f546b1
 * curve or apply a control curve sample by sample.
Packit f546b1
 *
Packit f546b1
 * The values are unboxed and ready to be used. The similar function
Packit f546b1
 * gst_control_binding_get_g_value_array() returns the array as #GValues and is
Packit f546b1
 * more suitable for bindings.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if the given array could be filled, %FALSE otherwise
Packit f546b1
 */
Packit f546b1
gboolean
Packit f546b1
gst_control_binding_get_value_array (GstControlBinding * binding,
Packit f546b1
    GstClockTime timestamp, GstClockTime interval, guint n_values,
Packit f546b1
    gpointer values)
Packit f546b1
{
Packit f546b1
  GstControlBindingClass *klass;
Packit f546b1
  gboolean ret = FALSE;
Packit f546b1
Packit f546b1
  g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
Packit f546b1
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
Packit f546b1
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
Packit f546b1
  g_return_val_if_fail (values, FALSE);
Packit f546b1
Packit f546b1
  klass = GST_CONTROL_BINDING_GET_CLASS (binding);
Packit f546b1
Packit f546b1
  if (G_LIKELY (klass->get_value_array != NULL)) {
Packit f546b1
    ret =
Packit f546b1
        klass->get_value_array (binding, timestamp, interval, n_values, values);
Packit f546b1
  } else {
Packit f546b1
    GST_WARNING_OBJECT (binding, "missing get_value_array implementation");
Packit f546b1
  }
Packit f546b1
  return ret;
Packit f546b1
}
Packit f546b1
Packit f546b1
#define CONVERT_ARRAY(type,TYPE) \
Packit f546b1
{ \
Packit f546b1
  g##type *v = g_new (g##type,n_values); \
Packit f546b1
  ret = gst_control_binding_get_value_array (binding, timestamp, interval, \
Packit f546b1
      n_values, v); \
Packit f546b1
  if (ret) { \
Packit f546b1
    for (i = 0; i < n_values; i++) { \
Packit f546b1
      g_value_init (&values[i], G_TYPE_##TYPE); \
Packit f546b1
      g_value_set_##type (&values[i], v[i]); \
Packit f546b1
    } \
Packit f546b1
  } \
Packit f546b1
  g_free (v); \
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_get_g_value_array:
Packit f546b1
 * @binding: the control binding
Packit f546b1
 * @timestamp: the time that should be processed
Packit f546b1
 * @interval: the time spacing between subsequent values
Packit f546b1
 * @n_values: the number of values
Packit f546b1
 * @values: (array length=n_values): array to put control-values in
Packit f546b1
 *
Packit f546b1
 * Gets a number of #GValues for the given controlled property starting at the
Packit f546b1
 * requested time. The array @values need to hold enough space for @n_values of
Packit f546b1
 * #GValue.
Packit f546b1
 *
Packit f546b1
 * This function is useful if one wants to e.g. draw a graph of the control
Packit f546b1
 * curve or apply a control curve sample by sample.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if the given array could be filled, %FALSE otherwise
Packit f546b1
 */
Packit f546b1
gboolean
Packit f546b1
gst_control_binding_get_g_value_array (GstControlBinding * binding,
Packit f546b1
    GstClockTime timestamp, GstClockTime interval, guint n_values,
Packit f546b1
    GValue * values)
Packit f546b1
{
Packit f546b1
  GstControlBindingClass *klass;
Packit f546b1
  gboolean ret = FALSE;
Packit f546b1
Packit f546b1
  g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
Packit f546b1
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
Packit f546b1
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
Packit f546b1
  g_return_val_if_fail (values, FALSE);
Packit f546b1
Packit f546b1
  klass = GST_CONTROL_BINDING_GET_CLASS (binding);
Packit f546b1
Packit f546b1
  if (G_LIKELY (klass->get_g_value_array != NULL)) {
Packit f546b1
    ret =
Packit f546b1
        klass->get_g_value_array (binding, timestamp, interval, n_values,
Packit f546b1
        values);
Packit f546b1
  } else {
Packit f546b1
    guint i;
Packit f546b1
    GType type, base;
Packit f546b1
Packit f546b1
    base = type = G_PARAM_SPEC_VALUE_TYPE (GST_CONTROL_BINDING_PSPEC (binding));
Packit f546b1
    while ((type = g_type_parent (type)))
Packit f546b1
      base = type;
Packit f546b1
Packit f546b1
    GST_INFO_OBJECT (binding, "missing get_g_value_array implementation, we're "
Packit f546b1
        "emulating it");
Packit f546b1
    switch (base) {
Packit f546b1
      case G_TYPE_INT:
Packit f546b1
        CONVERT_ARRAY (int, INT);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_UINT:
Packit f546b1
        CONVERT_ARRAY (uint, UINT);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_LONG:
Packit f546b1
        CONVERT_ARRAY (long, LONG);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_ULONG:
Packit f546b1
        CONVERT_ARRAY (ulong, ULONG);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_INT64:
Packit f546b1
        CONVERT_ARRAY (int64, INT64);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_UINT64:
Packit f546b1
        CONVERT_ARRAY (uint64, UINT64);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_FLOAT:
Packit f546b1
        CONVERT_ARRAY (float, FLOAT);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_DOUBLE:
Packit f546b1
        CONVERT_ARRAY (double, DOUBLE);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_BOOLEAN:
Packit f546b1
        CONVERT_ARRAY (boolean, BOOLEAN);
Packit f546b1
        break;
Packit f546b1
      case G_TYPE_ENUM:
Packit f546b1
      {
Packit f546b1
        gint *v = g_new (gint, n_values);
Packit f546b1
        ret = gst_control_binding_get_value_array (binding, timestamp, interval,
Packit f546b1
            n_values, v);
Packit f546b1
        if (ret) {
Packit f546b1
          for (i = 0; i < n_values; i++) {
Packit f546b1
            g_value_init (&values[i], type);
Packit f546b1
            g_value_set_enum (&values[i], v[i]);
Packit f546b1
          }
Packit f546b1
        }
Packit f546b1
        g_free (v);
Packit f546b1
      }
Packit f546b1
        break;
Packit f546b1
      default:
Packit f546b1
        GST_WARNING ("incomplete implementation for paramspec type '%s'",
Packit f546b1
            G_PARAM_SPEC_TYPE_NAME (GST_CONTROL_BINDING_PSPEC (binding)));
Packit f546b1
        GST_CONTROL_BINDING_PSPEC (binding) = NULL;
Packit f546b1
        break;
Packit f546b1
    }
Packit f546b1
  }
Packit f546b1
  return ret;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_set_disabled:
Packit f546b1
 * @binding: the control binding
Packit f546b1
 * @disabled: boolean that specifies whether to disable the controller
Packit f546b1
 * or not.
Packit f546b1
 *
Packit f546b1
 * This function is used to disable a control binding for some time, i.e.
Packit f546b1
 * gst_object_sync_values() will do nothing.
Packit f546b1
 */
Packit f546b1
void
Packit f546b1
gst_control_binding_set_disabled (GstControlBinding * binding,
Packit f546b1
    gboolean disabled)
Packit f546b1
{
Packit f546b1
  g_return_if_fail (GST_IS_CONTROL_BINDING (binding));
Packit f546b1
  binding->disabled = disabled;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_control_binding_is_disabled:
Packit f546b1
 * @binding: the control binding
Packit f546b1
 *
Packit f546b1
 * Check if the control binding is disabled.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if the binding is inactive
Packit f546b1
 */
Packit f546b1
gboolean
Packit f546b1
gst_control_binding_is_disabled (GstControlBinding * binding)
Packit f546b1
{
Packit f546b1
  g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), TRUE);
Packit f546b1
  return ! !binding->disabled;
Packit f546b1
}