static void
ges_title_clip_set_property (GObject * object, guint property_id,
    const GValue * value, GParamSpec * pspec)
{
  GESTitleClip *uriclip = GES_TITLE_CLIP (object);

  switch (property_id) {
    case PROP_TEXT:
      ges_title_clip_set_text (uriclip, g_value_get_string (value));
      break;
    case PROP_FONT_DESC:
      ges_title_clip_set_font_desc (uriclip, g_value_get_string (value));
      break;
    case PROP_HALIGNMENT:
      ges_title_clip_set_halignment (uriclip, g_value_get_enum (value));
      break;
    case PROP_VALIGNMENT:
      ges_title_clip_set_valignment (uriclip, g_value_get_enum (value));
      break;
    case PROP_COLOR:
      ges_title_clip_set_color (uriclip, g_value_get_uint (value));
      break;
    case PROP_BACKGROUND:
      ges_title_clip_set_background (uriclip, g_value_get_uint (value));
      break;
    case PROP_XPOS:
      ges_title_clip_set_xpos (uriclip, g_value_get_double (value));
      break;
    case PROP_YPOS:
      ges_title_clip_set_ypos (uriclip, g_value_get_double (value));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
  }
}
static void
ges_title_clip_get_property (GObject * object, guint property_id,
    GValue * value, GParamSpec * pspec)
{
  GESTitleClipPrivate *priv = GES_TITLE_CLIP (object)->priv;

  switch (property_id) {
    case PROP_TEXT:
      g_value_set_string (value, priv->text);
      break;
    case PROP_FONT_DESC:
      g_value_set_string (value, priv->font_desc);
      break;
    case PROP_HALIGNMENT:
      g_value_set_enum (value, priv->halign);
      break;
    case PROP_VALIGNMENT:
      g_value_set_enum (value, priv->valign);
      break;
    case PROP_COLOR:
      g_value_set_uint (value, priv->color);
      break;
    case PROP_BACKGROUND:
      g_value_set_uint (value, priv->background);
      break;
    case PROP_XPOS:
      g_value_set_double (value, priv->xpos);
      break;
    case PROP_YPOS:
      g_value_set_double (value, priv->ypos);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
  }
}
static GESTrackElement *
ges_title_clip_create_track_element (GESClip * clip, GESTrackType type)
{

  GESTitleClipPrivate *priv = GES_TITLE_CLIP (clip)->priv;
  GESTrackElement *res = NULL;

  GST_DEBUG_OBJECT (clip, "a GESTitleSource");

  if (type == GES_TRACK_TYPE_VIDEO) {
    res = (GESTrackElement *) ges_title_source_new ();
    GST_DEBUG_OBJECT (clip, "text property");
    ges_title_source_set_text ((GESTitleSource *) res, priv->text);
    ges_title_source_set_font_desc ((GESTitleSource *) res, priv->font_desc);
    ges_title_source_set_halignment ((GESTitleSource *) res, priv->halign);
    ges_title_source_set_valignment ((GESTitleSource *) res, priv->valign);
    ges_title_source_set_text_color ((GESTitleSource *) res, priv->color);
    ges_title_source_set_background_color ((GESTitleSource *) res,
        priv->background);
    ges_title_source_set_xpos ((GESTitleSource *) res, priv->xpos);
    ges_title_source_set_ypos ((GESTitleSource *) res, priv->ypos);
  }

  return res;
}
/**
 * ges_title_clip_new:
 *
 * Creates a new #GESTitleClip
 *
 * Returns: The newly created #GESTitleClip, or NULL if there was an
 * error.
 */
GESTitleClip *
ges_title_clip_new (void)
{
  GESTitleClip *new_clip;
  GESAsset *asset = ges_asset_request (GES_TYPE_TITLE_CLIP, NULL, NULL);

  new_clip = GES_TITLE_CLIP (ges_asset_extract (asset, NULL));
  gst_object_unref (asset);

  return new_clip;
}
static void
_child_added (GESContainer * container, GESTimelineElement * element)
{
  GESTitleClipPrivate *priv = GES_TITLE_CLIP (container)->priv;

  if (GES_IS_TITLE_SOURCE (element)) {
    GST_DEBUG_OBJECT (container, "%" GST_PTR_FORMAT " added", element);
    priv->track_titles = g_slist_prepend (priv->track_titles,
        gst_object_ref (element));
  }
}
static void
_child_removed (GESContainer * container, GESTimelineElement * element)
{
  GESTitleClipPrivate *priv = GES_TITLE_CLIP (container)->priv;

  /* If this is called, we should be sure the element exists */
  if (GES_IS_TITLE_SOURCE (element)) {
    GST_DEBUG_OBJECT (container, "%" GST_PTR_FORMAT " removed", element);
    priv->track_titles = g_slist_remove (priv->track_titles, element);
    gst_object_unref (element);
  }
}
static void
ges_title_clip_dispose (GObject * object)
{
  GESTitleClip *self = GES_TITLE_CLIP (object);

  if (self->priv->text)
    g_free (self->priv->text);
  if (self->priv->font_desc)
    g_free (self->priv->font_desc);

  G_OBJECT_CLASS (ges_title_clip_parent_class)->dispose (object);
}
static void
ges_title_clip_get_property (GObject * object, guint property_id,
    GValue * value, GParamSpec * pspec)
{
  GESTitleClipPrivate *priv = GES_TITLE_CLIP (object)->priv;

  switch (property_id) {
    case PROP_TEXT:
      ges_track_element_get_child_property (priv->track_titles->data, "text",
          value);
      break;
    case PROP_FONT_DESC:
      ges_track_element_get_child_property (priv->track_titles->data,
          "font-desc", value);
      break;
    case PROP_HALIGNMENT:
      ges_track_element_get_child_property (priv->track_titles->data,
          "halignment", value);
      break;
    case PROP_VALIGNMENT:
      ges_track_element_get_child_property (priv->track_titles->data,
          "valignment", value);
      break;
    case PROP_COLOR:
      ges_track_element_get_child_property (priv->track_titles->data, "color",
          value);
      break;
    case PROP_BACKGROUND:
      ges_track_element_get_child_property (priv->track_titles->data,
          "foreground-color", value);
      break;
    case PROP_XPOS:
      ges_track_element_get_child_property (priv->track_titles->data, "xpos",
          value);
      break;
    case PROP_YPOS:
      ges_track_element_get_child_property (priv->track_titles->data, "ypos",
          value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
  }
}