GESTextHAlign valign;
GSList *track_titles;
guint32 color;
+ gdouble xpos;
+ gdouble ypos;
};
enum
PROP_HALIGNMENT,
PROP_VALIGNMENT,
PROP_COLOR,
+ PROP_XPOS,
+ PROP_YPOS,
};
static GESTrackObject
case PROP_COLOR:
g_value_set_uint (value, priv->color);
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);
}
case PROP_COLOR:
ges_timeline_title_source_set_color (tfs, g_value_get_uint (value));
break;
+ case PROP_XPOS:
+ ges_timeline_title_source_set_xpos (tfs, g_value_get_double (value));
+ break;
+ case PROP_YPOS:
+ ges_timeline_title_source_set_ypos (tfs, g_value_get_double (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
g_param_spec_uint ("color", "Color", "The color of the text",
0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ /**
+ * GESTimelineTitleSource:xpos
+ *
+ * The horizontal position of the text
+ */
+
+ g_object_class_install_property (object_class, PROP_XPOS,
+ g_param_spec_double ("xpos", "Xpos", "The horizontal position",
+ 0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * GESTimelineTitleSource:ypos
+ *
+ * The vertical position of the text
+ */
+
+ g_object_class_install_property (object_class, PROP_YPOS,
+ g_param_spec_double ("ypos", "Ypos", "The vertical position",
+ 0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
self->priv->halign = DEFAULT_HALIGNMENT;
self->priv->valign = DEFAULT_VALIGNMENT;
self->priv->color = G_MAXUINT32;
+ self->priv->xpos = 0.5;
+ self->priv->ypos = 0.5;
}
/**
}
}
+/**
+ * ges_timeline_title_source_set_xpos:
+ * @self: the #GESTimelineTitleSource* to set
+ * @position: The horizontal position @self is being set to
+ *
+ * Sets the horizontal position of the text.
+ *
+ */
+void
+ges_timeline_title_source_set_xpos (GESTimelineTitleSource * self,
+ gdouble position)
+{
+ GSList *tmp;
+
+ GST_DEBUG ("self:%p, xpos:%f", self, position);
+
+ self->priv->xpos = position;
+
+ for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) {
+ ges_track_title_source_set_xpos (GES_TRACK_TITLE_SOURCE (tmp->data),
+ self->priv->xpos);
+ }
+}
+
+/**
+ * ges_timeline_title_source_set_ypos:
+ * @self: the #GESTimelineTitleSource* to set
+ * @position: The vertical position @self is being set to
+ *
+ * Sets the vertical position of the text.
+ *
+ */
+void
+ges_timeline_title_source_set_ypos (GESTimelineTitleSource * self,
+ gdouble position)
+{
+ GSList *tmp;
+
+ GST_DEBUG ("self:%p, ypos:%f", self, position);
+
+ self->priv->ypos = position;
+
+ for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) {
+ ges_track_title_source_set_ypos (GES_TRACK_TITLE_SOURCE (tmp->data),
+ self->priv->ypos);
+ }
+}
+
/**
* ges_timeline_title_source_get_text:
* @self: a #GESTimelineTitleSource
return self->priv->color;
}
+/**
+ * ges_timeline_title_source_get_xpos:
+ * @self: a #GESTimelineTitleSource
+ *
+ * Get the horizontal position used by @self.
+ *
+ * Returns: The horizontal position used by @self.
+ *
+ */
+const gdouble
+ges_timeline_title_source_get_xpos (GESTimelineTitleSource * self)
+{
+ return self->priv->xpos;
+}
+
+/**
+ * ges_timeline_title_source_get_ypos:
+ * @self: a #GESTimelineTitleSource
+ *
+ * Get the vertical position used by @self.
+ *
+ * Returns: The vertical position used by @self.
+ *
+ */
+const gdouble
+ges_timeline_title_source_get_ypos (GESTimelineTitleSource * self)
+{
+ return self->priv->ypos;
+}
+
static void
ges_timeline_title_source_track_object_released (GESTimelineObject * obj,
GESTrackObject * tckobj)
ges_track_title_source_set_valignment ((GESTrackTitleSource *) res,
priv->valign);
ges_track_title_source_set_color ((GESTrackTitleSource *) res, priv->color);
+ ges_track_title_source_set_xpos ((GESTrackTitleSource *) res, priv->xpos);
+ ges_track_title_source_set_ypos ((GESTrackTitleSource *) res, priv->ypos);
}
else if (track->type == GES_TRACK_TYPE_AUDIO) {
ges_timeline_title_source_set_color (GESTimelineTitleSource * self,
guint32 color);
+void
+ges_timeline_title_source_set_xpos (GESTimelineTitleSource * self,
+ gdouble position);
+
+void
+ges_timeline_title_source_set_ypos (GESTimelineTitleSource * self,
+ gdouble position);
+
const gchar*
ges_timeline_title_source_get_font_desc (GESTimelineTitleSource * self);
const guint32
ges_timeline_title_source_get_color (GESTimelineTitleSource * self);
+const gdouble
+ges_timeline_title_source_get_xpos (GESTimelineTitleSource * self);
+
+const gdouble
+ges_timeline_title_source_get_ypos (GESTimelineTitleSource * self);
+
gboolean ges_timeline_title_source_is_muted (GESTimelineTitleSource * self);
const gchar* ges_timeline_title_source_get_text (GESTimelineTitleSource * self);
GESTextHAlign halign;
GESTextVAlign valign;
guint32 color;
+ gdouble xpos;
+ gdouble ypos;
GstElement *text_el;
GstElement *background_el;
};
self->priv->halign = DEFAULT_HALIGNMENT;
self->priv->valign = DEFAULT_VALIGNMENT;
self->priv->color = G_MAXUINT32;
+ self->priv->xpos = 0.5;
+ self->priv->ypos = 0.5;
self->priv->background_el = NULL;
}
g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_BLACK,
NULL);
g_object_set (text, "color", (guint32) self->priv->color, NULL);
+ g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL);
+ g_object_set (text, "ypos", (gdouble) self->priv->ypos, NULL);
gst_bin_add_many (GST_BIN (topbin), background, text, NULL);
g_object_set (self->priv->text_el, "color", color, NULL);
}
+/**
+ * ges_track_title_source_set_xpos:
+ * @self: the #GESTrackTitleSource* to set
+ * @position: the horizontal position @self is being set to
+ *
+ * Sets the horizontal position of the text.
+ */
+void
+ges_track_title_source_set_xpos (GESTrackTitleSource * self, gdouble position)
+{
+ GST_DEBUG ("self:%p, xpos:%f", self, position);
+
+ self->priv->xpos = position;
+ if (self->priv->text_el)
+ g_object_set (self->priv->text_el, "xpos", position, NULL);
+}
+
+/**
+ * ges_track_title_source_set_ypos:
+ * @self: the #GESTrackTitleSource* to set
+ * @position: the color @self is being set to
+ *
+ * Sets the vertical position of the text.
+ */
+void
+ges_track_title_source_set_ypos (GESTrackTitleSource * self, gdouble position)
+{
+ GST_DEBUG ("self:%p, ypos:%d", self, position);
+
+ self->priv->ypos = position;
+ if (self->priv->text_el)
+ g_object_set (self->priv->text_el, "ypos", position, NULL);
+}
+
/**
* ges_track_title_source_get_text:
* @source: a #GESTrackTitleSource
return source->priv->color;
}
+/**
+ * ges_track_title_source_get_xpos:
+ * @source: a #GESTrackTitleSource
+ *
+ * Get the horizontal position used by @source.
+ *
+ * Returns: The horizontal position used by @source.
+ */
+const gdouble
+ges_track_title_source_get_xpos (GESTrackTitleSource * source)
+{
+ return source->priv->xpos;
+}
+
+/**
+ * ges_track_title_source_get_ypos:
+ * @source: a #GESTrackTitleSource
+ *
+ * Get the vertical position used by @source.
+ *
+ * Returns: The vertical position used by @source.
+ */
+const gdouble
+ges_track_title_source_get_ypos (GESTrackTitleSource * source)
+{
+ return source->priv->ypos;
+}
/**
* ges_track_title_source_new:
void ges_track_title_source_set_color (GESTrackTitleSource *self,
guint32 color);
+void ges_track_title_source_set_xpos (GESTrackTitleSource *self,
+ gdouble position);
+void ges_track_title_source_set_ypos (GESTrackTitleSource *self,
+ gdouble position);
+
const gchar *ges_track_title_source_get_text (GESTrackTitleSource *source);
const gchar *ges_track_title_source_get_font_desc (GESTrackTitleSource *source);
GESTextHAlign ges_track_title_source_get_halignment (GESTrackTitleSource *source);
GESTextVAlign ges_track_title_source_get_valignment (GESTrackTitleSource *source);
const guint32 ges_track_title_source_get_color (GESTrackTitleSource *source);
+const gdouble ges_track_title_source_get_xpos (GESTrackTitleSource *source);
+const gdouble ges_track_title_source_get_ypos (GESTrackTitleSource *source);
GESTrackTitleSource* ges_track_title_source_new (void);
KEY ("Object3", "halignment", "center");
KEY ("Object3", "valignment", "baseline");
KEY ("Object3", "color", "4294967295");
+ KEY ("Object3", "xpos", "0.5");
+ KEY ("Object3", "ypos", "0.5");
COMPARE;
/* tear-down */
gchar *text;
gint halign, valign;
guint32 color;
+ gdouble xpos;
+ gdouble ypos;
ges_init ();
color = ges_track_title_source_get_color (GES_TRACK_TITLE_SOURCE (trobj));
assert_equals_int (color, 2147483647);
+ /* test xpos */
+ g_object_set (source, "xpos", (gdouble) 0.25, NULL);
+ g_object_get (source, "xpos", &xpos, NULL);
+ assert_equals_int (xpos, 0.25);
+
+ xpos = ges_track_title_source_get_xpos (GES_TRACK_TITLE_SOURCE (trobj));
+ assert_equals_int (xpos, 0.25);
+
+ /* test ypos */
+ g_object_set (source, "ypos", (gdouble) 0.66, NULL);
+ g_object_get (source, "ypos", &ypos, NULL);
+ assert_equals_int (ypos, 0.66);
+
+ xpos = ges_track_title_source_get_xpos (GES_TRACK_TITLE_SOURCE (trobj));
+ assert_equals_int (ypos, 0.66);
+
GST_DEBUG ("removing the source");
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) source);