Color property of the text overlay can be set and get.
gchar *font_desc;
GESTextHAlign halign;
GESTextVAlign valign;
+ guint32 color;
};
enum
PROP_FONT_DESC,
PROP_HALIGNMENT,
PROP_VALIGNMENT,
+ PROP_COLOR,
};
static GESTrackObject
case PROP_VALIGNMENT:
g_value_set_enum (value, priv->valign);
break;
+ case PROP_COLOR:
+ g_value_set_uint (value, priv->color);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
case PROP_VALIGNMENT:
ges_timeline_text_overlay_set_valign (tfs, g_value_get_enum (value));
break;
+ case PROP_COLOR:
+ ges_timeline_text_overlay_set_color (tfs, g_value_get_uint (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
timobj_class->create_track_object =
ges_timeline_text_overlay_create_track_object;
timobj_class->need_fill_track = FALSE;
+
+ /**
+ * GESTimelineTextOverlay:color
+ *
+ * The color of the text
+ */
+
+ g_object_class_install_property (object_class, PROP_COLOR,
+ g_param_spec_uint ("color", "Color", "The color of the text",
+ 0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
self->priv->font_desc = NULL;
self->priv->halign = DEFAULT_PROP_HALIGNMENT;
self->priv->valign = DEFAULT_PROP_VALIGNMENT;
+ self->priv->color = G_MAXUINT32;
}
/**
}
+/**
+ * ges_timeline_text_overlay_set_color:
+ * @self: the #GESTimelineTextOverlay* to set
+ * @color: The color @self is being set to
+ *
+ * Sets the color of the text.
+ *
+ */
+void
+ges_timeline_text_overlay_set_color (GESTimelineTextOverlay * self,
+ guint32 color)
+{
+ GList *tmp, *trackobjects;
+ GESTimelineObject *object = (GESTimelineObject *) self;
+
+ GST_DEBUG ("self:%p, color:%d", self, color);
+
+ self->priv->color = color;
+
+ trackobjects = ges_timeline_object_get_track_objects (object);
+ for (tmp = trackobjects; tmp; tmp = tmp->next) {
+ GESTrackObject *trackobject = (GESTrackObject *) tmp->data;
+
+ if (ges_track_object_get_track (trackobject)->type == GES_TRACK_TYPE_VIDEO)
+ ges_track_text_overlay_set_color (GES_TRACK_TEXT_OVERLAY
+ (trackobject), self->priv->color);
+
+ g_object_unref (GES_TRACK_OBJECT (tmp->data));
+ }
+ g_list_free (trackobjects);
+}
+
/**
* ges_timeline_text_overlay_get_text:
* @self: a #GESTimelineTextOverlay
return self->priv->valign;
}
+/**
+ * ges_timeline_text_overlay_get_color:
+ * @self: a #GESTimelineTextOverlay
+ *
+ * Get the color used by @source.
+ *
+ * Returns: The color used by @source.
+ */
+
+const guint32
+ges_timeline_text_overlay_get_color (GESTimelineTextOverlay * self)
+{
+ return self->priv->color;
+}
+
+
static GESTrackObject *
ges_timeline_text_overlay_create_track_object (GESTimelineObject * obj,
GESTrack * track)
priv->halign);
ges_track_text_overlay_set_valignment ((GESTrackTextOverlay *) res,
priv->valign);
+ ges_track_text_overlay_set_color ((GESTrackTextOverlay *) res, priv->color);
}
return res;
ges_timeline_text_overlay_set_halign (GESTimelineTextOverlay * self,
GESTextHAlign halign);
+void
+ges_timeline_text_overlay_set_color (GESTimelineTextOverlay * self,
+ guint32 color);
+
const gchar* ges_timeline_text_overlay_get_text (GESTimelineTextOverlay * self);
const gchar*
GESTextVAlign
ges_timeline_text_overlay_get_valignment (GESTimelineTextOverlay * self);
+const guint32
+ges_timeline_text_overlay_get_color (GESTimelineTextOverlay * self);
+
GESTextHAlign
ges_timeline_text_overlay_get_halignment (GESTimelineTextOverlay * self);
gchar *font_desc;
GESTextHAlign halign;
GESTextVAlign valign;
+ guint32 color;
GstElement *text_el;
};
self->priv->text_el = NULL;
self->priv->halign = DEFAULT_HALIGNMENT;
self->priv->valign = DEFAULT_VALIGNMENT;
+ self->priv->color = G_MAXUINT32;
}
static void
g_object_set (text, "halignment", (gint) self->priv->halign, "valignment",
(gint) self->priv->valign, NULL);
+ g_object_set (text, "color", (guint32) self->priv->color, NULL);
ret = gst_bin_new ("overlay-bin");
gst_bin_add_many (GST_BIN (ret), text, iconv, oconv, NULL);
void
ges_track_text_overlay_set_text (GESTrackTextOverlay * self, const gchar * text)
{
+ GST_DEBUG ("self:%p, text:%s", self, text);
+
if (self->priv->text)
g_free (self->priv->text);
ges_track_text_overlay_set_font_desc (GESTrackTextOverlay * self,
const gchar * font_desc)
{
+ GST_DEBUG ("self:%p, font_desc:%s", self, font_desc);
+
if (self->priv->font_desc)
g_free (self->priv->font_desc);
ges_track_text_overlay_set_valignment (GESTrackTextOverlay * self,
GESTextVAlign valign)
{
+ GST_DEBUG ("self:%p, halign:%d", self, valign);
+
self->priv->valign = valign;
- GST_LOG ("set valignment to: %d", valign);
if (self->priv->text_el)
g_object_set (self->priv->text_el, "valignment", valign, NULL);
}
ges_track_text_overlay_set_halignment (GESTrackTextOverlay * self,
GESTextHAlign halign)
{
+ GST_DEBUG ("self:%p, halign:%d", self, halign);
+
self->priv->halign = halign;
- GST_LOG ("set halignment to: %d", halign);
if (self->priv->text_el)
g_object_set (self->priv->text_el, "halignment", halign, NULL);
}
+/**
+ * ges_track_text_overlay_set_color:
+ * @self: the #GESTrackTextOverlay* to set
+ * @color: The color @self is being set to
+ *
+ * Sets the color of the text.
+ *
+ */
+void
+ges_track_text_overlay_set_color (GESTrackTextOverlay * self, guint32 color)
+{
+ GST_DEBUG ("self:%p, color:%d", self, color);
+
+ self->priv->color = color;
+ if (self->priv->text_el)
+ g_object_set (self->priv->text_el, "color", color, NULL);
+}
+
/**
* ges_track_text_overlay_get_text:
* @self: a GESTrackTextOverlay
return self->priv->valign;
}
+/**
+ * ges_track_text_overlay_get_color:
+ * @self: a GESTrackTextOverlay
+ *
+ * Get the color used by @source.
+ *
+ * Returns: The color used by @source.
+ */
+
+const guint32
+ges_track_text_overlay_get_color (GESTrackTextOverlay * self)
+{
+ return self->priv->color;
+}
+
/**
* ges_track_text_overlay_new:
*
void ges_track_text_overlay_set_valignment(GESTrackTextOverlay *self,
GESTextVAlign valign);
+void ges_track_text_overlay_set_color(GESTrackTextOverlay *self,
+ guint32 color);
const gchar *ges_track_text_overlay_get_text(GESTrackTextOverlay *self);
const char *ges_track_text_overlay_get_font_desc(GESTrackTextOverlay *self);
GESTextHAlign ges_track_text_overlay_get_halignment(GESTrackTextOverlay *self);
GESTextVAlign ges_track_text_overlay_get_valignment(GESTrackTextOverlay *self);
+const guint32 ges_track_text_overlay_get_color (GESTrackTextOverlay *self);
GESTrackTextOverlay* ges_track_text_overlay_new (void);
GESTimelineTextOverlay *source;
gchar *text;
gint halign, valign;
+ guint32 color;
ges_init ();
assert_equals_int (halign, GES_TEXT_HALIGN_LEFT);
assert_equals_int (valign, GES_TEXT_VALIGN_TOP);
+ /* test color */
+ g_object_set (source, "color", (gint) 2147483647, NULL);
+ g_object_get (source, "color", &color, NULL);
+ assert_equals_int (color, 2147483647);
+
+ color = ges_track_text_overlay_get_color (GES_TRACK_TEXT_OVERLAY (trobj));
+ assert_equals_int (color, 2147483647);
+
GST_DEBUG ("removing the source");
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) source);