static void
gst_auto_convert_set_property (GObject * object,
    guint prop_id, const GValue * value, GParamSpec * pspec)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    case PROP_FACTORIES:
      if (g_atomic_pointer_get (&autoconvert->factories) == NULL) {
        GList *factories = g_value_get_pointer (value);
        factories = g_list_copy (factories);
        if (g_atomic_pointer_compare_and_exchange (&autoconvert->factories,
                NULL, factories))
          g_list_foreach (factories, (GFunc) g_object_ref, NULL);
        else
          g_list_free (factories);
      } else {
        GST_WARNING_OBJECT (object, "Can not reset factories after they"
            " have been set or auto-discovered");
      }
      break;
  }
}
Beispiel #2
0
static GstStateChangeReturn
gst_auto_convert_change_state (GstElement * element, GstStateChange transition)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (element);
  GstStateChangeReturn ret;

  switch (transition) {
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
  if (ret == GST_STATE_CHANGE_FAILURE)
    return ret;

  switch (transition) {
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      g_list_foreach (autoconvert->cached_events, (GFunc) gst_mini_object_unref,
          NULL);
      g_list_free (autoconvert->cached_events);
      autoconvert->cached_events = NULL;
      break;
    default:
      break;
  }

  return ret;
}
Beispiel #3
0
static void
gst_auto_convert_set_property (GObject * object,
    guint prop_id, const GValue * value, GParamSpec * pspec)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    case PROP_FACTORIES:
      GST_AUTOCONVERT_LOCK (autoconvert);
      if (autoconvert->factories == NULL) {
        GList *factories = g_value_get_pointer (value);
        autoconvert->factories = g_list_copy (factories);
        g_list_foreach (autoconvert->factories, (GFunc) g_object_ref, NULL);
      } else
        GST_WARNING_OBJECT (object, "Can not reset factories after they"
            " have been set or auto-discovered");
      GST_AUTOCONVERT_UNLOCK (autoconvert);
      break;
    case PROP_INITIAL_IDENTITY:
      GST_AUTOCONVERT_LOCK (autoconvert);
      autoconvert->initial_identity = g_value_get_boolean (value);
      GST_AUTOCONVERT_UNLOCK (autoconvert);
      break;
  }
}
Beispiel #4
0
static void
gst_auto_convert_dispose (GObject * object)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL);

  GST_AUTOCONVERT_LOCK (autoconvert);
  if (autoconvert->current_subelement) {
    gst_object_unref (autoconvert->current_subelement);
    autoconvert->current_subelement = NULL;
    autoconvert->current_internal_sinkpad = NULL;
    autoconvert->current_internal_srcpad = NULL;
  }

  g_list_foreach (autoconvert->cached_events, (GFunc) gst_mini_object_unref,
      NULL);
  g_list_free (autoconvert->cached_events);
  autoconvert->cached_events = NULL;

  if (autoconvert->factories) {
    gst_plugin_feature_list_free (autoconvert->factories);
    autoconvert->factories = NULL;
  }
  GST_AUTOCONVERT_UNLOCK (autoconvert);

  G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_auto_convert_get_property (GObject * object,
    guint prop_id, GValue * value, GParamSpec * pspec)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    case PROP_FACTORIES:
      g_value_set_pointer (value,
          g_atomic_pointer_get (&autoconvert->factories));
      break;
  }
}
static void
gst_auto_convert_dispose (GObject * object)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  g_clear_object (&autoconvert->current_subelement);
  g_clear_object (&autoconvert->current_internal_sinkpad);
  g_clear_object (&autoconvert->current_internal_srcpad);

  for (;;) {
    GList *factories = g_atomic_pointer_get (&autoconvert->factories);

    if (g_atomic_pointer_compare_and_exchange (&autoconvert->factories,
            factories, NULL)) {
      gst_plugin_feature_list_free (factories);
      break;
    }
  }

  G_OBJECT_CLASS (gst_auto_convert_parent_class)->dispose (object);
}
Beispiel #7
0
static void
gst_auto_convert_get_property (GObject * object,
    guint prop_id, GValue * value, GParamSpec * pspec)
{
  GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object);

  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    case PROP_FACTORIES:
      GST_AUTOCONVERT_LOCK (autoconvert);
      g_value_set_pointer (value, &autoconvert->factories);
      GST_AUTOCONVERT_UNLOCK (autoconvert);
      break;
    case PROP_INITIAL_IDENTITY:
      GST_AUTOCONVERT_LOCK (autoconvert);
      g_value_set_boolean (value, autoconvert->initial_identity);
      GST_AUTOCONVERT_UNLOCK (autoconvert);
      break;
  }
}