Ejemplo n.º 1
0
gboolean
gst_controller_set_from_list (GstController * self, gchar * property_name,
    GSList * timedvalues)
{
  gboolean res = FALSE;
  GstControlledProperty *prop;

  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
  g_return_val_if_fail (property_name, FALSE);

  g_mutex_lock (self->lock);
  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
    /* FIXME: backward compat, add GstInterpolationControlSource */
    if (!prop->csource)
      gst_controlled_property_add_interpolation_control_source (prop);

    if (!GST_IS_INTERPOLATION_CONTROL_SOURCE (prop->csource))
      goto out;

    res =
        gst_interpolation_control_source_set_from_list
        (GST_INTERPOLATION_CONTROL_SOURCE (prop->csource), timedvalues);
  }

out:
  g_mutex_unlock (self->lock);

  return res;
}
Ejemplo n.º 2
0
gboolean
gst_controller_unset (GstController * self, gchar * property_name,
    GstClockTime timestamp)
{
  gboolean res = FALSE;
  GstControlledProperty *prop;

  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
  g_return_val_if_fail (property_name, FALSE);
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);

  g_mutex_lock (self->lock);
  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
    if (!prop->csource || !GST_IS_INTERPOLATION_CONTROL_SOURCE (prop->csource))
      goto out;

    res =
        gst_interpolation_control_source_unset (GST_INTERPOLATION_CONTROL_SOURCE
        (prop->csource), timestamp);
  }

out:
  g_mutex_unlock (self->lock);

  return res;
}
Ejemplo n.º 3
0
EXPORT_C
#endif

gboolean
gst_interpolation_control_source_set_from_list (GstInterpolationControlSource *
    self, GSList * timedvalues)
{
  GSList *node;
  GstTimedValue *tv;
  gboolean res = FALSE;

  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), FALSE);

  for (node = timedvalues; node; node = g_slist_next (node)) {
    tv = node->data;
    if (!GST_CLOCK_TIME_IS_VALID (tv->timestamp)) {
      GST_WARNING ("GstTimedValued with invalid timestamp passed to %s",
          GST_FUNCTION);
    } else if (!G_IS_VALUE (&tv->value)) {
      GST_WARNING ("GstTimedValued with invalid value passed to %s",
          GST_FUNCTION);
    } else if (G_VALUE_TYPE (&tv->value) != self->priv->type) {
      GST_WARNING ("incompatible value type for property");
    } else {
      g_mutex_lock (self->lock);
      gst_interpolation_control_source_set_internal (self, tv->timestamp,
          &tv->value);
      g_mutex_unlock (self->lock);
      res = TRUE;
    }
  }
  return res;
}
Ejemplo n.º 4
0
EXPORT_C
#endif
const GList *
gst_controller_get_all (GstController * self, gchar * property_name)
{
  const GList *res = NULL;
  GstControlledProperty *prop;

  g_return_val_if_fail (GST_IS_CONTROLLER (self), NULL);
  g_return_val_if_fail (property_name, NULL);

  g_mutex_lock (self->lock);
  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
    if (!prop->csource || !GST_IS_INTERPOLATION_CONTROL_SOURCE (prop->csource))
      goto out;

    res =
        gst_interpolation_control_source_get_all
        (GST_INTERPOLATION_CONTROL_SOURCE (prop->csource));
  }

out:
  g_mutex_unlock (self->lock);

  return res;
}
Ejemplo n.º 5
0
EXPORT_C
#endif

gint
gst_interpolation_control_source_get_count (GstInterpolationControlSource *
    self)
{
  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), 0);
  return self->priv->nvalues;
}
Ejemplo n.º 6
0
EXPORT_C
#endif

GList *
gst_interpolation_control_source_get_all (GstInterpolationControlSource * self)
{
  GList *res = NULL;

  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), NULL);

  g_mutex_lock (self->lock);
  if (self->priv->values)
    res = g_list_copy (self->priv->values);
  g_mutex_unlock (self->lock);

  return res;
}
Ejemplo n.º 7
0
/*
 * gst_controlled_property_set_interpolation_mode:
 * @self: the controlled property object to change
 * @mode: the new interpolation mode
 *
 * Sets the given Interpolation mode for the controlled property and activates
 * the respective interpolation hooks.
 *
 * Deprecated: Use #GstControlSource, for example #GstInterpolationControlSource
 * directly.
 *
 * Returns: %TRUE for success
 */
static gboolean
gst_controlled_property_set_interpolation_mode (GstControlledProperty * self,
    GstInterpolateMode mode)
{
  GstInterpolationControlSource *icsource;

  /* FIXME: backward compat, add GstInterpolationControlSource */
  if (!self->csource)
    gst_controlled_property_add_interpolation_control_source (self);

  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self->csource),
      FALSE);

  icsource = GST_INTERPOLATION_CONTROL_SOURCE (self->csource);

  return gst_interpolation_control_source_set_interpolation_mode (icsource,
      mode);
}
Ejemplo n.º 8
0
EXPORT_C
#endif

gboolean
gst_interpolation_control_source_set (GstInterpolationControlSource * self,
    GstClockTime timestamp, GValue * value)
{
  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), FALSE);
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
  g_return_val_if_fail (G_IS_VALUE (value), FALSE);
  g_return_val_if_fail (G_VALUE_TYPE (value) == self->priv->type, FALSE);

  g_mutex_lock (self->lock);
  gst_interpolation_control_source_set_internal (self, timestamp, value);
  g_mutex_unlock (self->lock);

  return TRUE;
}
Ejemplo n.º 9
0
EXPORT_C
#endif

void
gst_interpolation_control_source_unset_all (GstInterpolationControlSource *
    self)
{
  g_return_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self));

  g_mutex_lock (self->lock);
  /* free GstControlPoint structures */
  g_list_foreach (self->priv->values, (GFunc) gst_control_point_free, NULL);
  g_list_free (self->priv->values);
  self->priv->last_requested_value = NULL;
  self->priv->values = NULL;
  self->priv->nvalues = 0;
  self->priv->valid_cache = FALSE;

  g_mutex_unlock (self->lock);
}
Ejemplo n.º 10
0
gboolean
gst_controller_unset_all (GstController * self, gchar * property_name)
{
  GstControlledProperty *prop;

  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
  g_return_val_if_fail (property_name, FALSE);

  g_mutex_lock (self->lock);
  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
    if (!prop->csource || !GST_IS_INTERPOLATION_CONTROL_SOURCE (prop->csource))
      goto out;

    gst_interpolation_control_source_unset_all (GST_INTERPOLATION_CONTROL_SOURCE
        (prop->csource));
  }

out:
  g_mutex_unlock (self->lock);

  return TRUE;
}
Ejemplo n.º 11
0
EXPORT_C
#endif

gboolean
gst_interpolation_control_source_unset (GstInterpolationControlSource * self,
    GstClockTime timestamp)
{
  GList *node;
  gboolean res = FALSE;

  g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), FALSE);
  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);

  g_mutex_lock (self->lock);
  /* check if a control point for the timestamp exists */
  if ((node = g_list_find_custom (self->priv->values, &timestamp,
              gst_control_point_find))) {
    GstControlPoint *cp = node->data;

    if (cp->timestamp == 0) {
      /* Restore the default node */
      g_value_reset (&cp->value);
      g_value_copy (&self->priv->default_value, &cp->value);
    } else {
      if (node == self->priv->last_requested_value)
        self->priv->last_requested_value = NULL;
      gst_control_point_free (node->data);      /* free GstControlPoint */
      self->priv->values = g_list_delete_link (self->priv->values, node);
      self->priv->nvalues--;
    }
    self->priv->valid_cache = FALSE;
    res = TRUE;
  }
  g_mutex_unlock (self->lock);

  return res;
}