static GstElement * ges_title_source_create_source (GESTrackElement * object) { GstElement *topbin, *background, *text; GstPad *src, *pad; GESTitleSource *self = GES_TITLE_SOURCE (object); GESTitleSourcePrivate *priv = self->priv; const gchar *bg_props[] = { "pattern", "foreground-color", NULL }; const gchar *text_props[] = { "text", "font-desc", "valignment", "halignment", "color", "xpos", "ypos", "outline-color", "shaded-background", NULL }; topbin = gst_bin_new ("titlesrc-bin"); background = gst_element_factory_make ("videotestsrc", "titlesrc-bg"); text = gst_element_factory_make ("textoverlay", "titlsrc-text"); if (priv->text) { g_object_set (text, "text", priv->text, NULL); } if (priv->font_desc) { g_object_set (text, "font-desc", priv->font_desc, NULL); } g_object_set (text, "valignment", (gint) priv->valign, "halignment", (gint) priv->halign, NULL); g_object_set (text, "color", (guint) self->priv->color, NULL); g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL); g_object_set (text, "ypos", (gdouble) self->priv->ypos, NULL); g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_SOLID, NULL); g_object_set (background, "foreground-color", (guint) self->priv->background, NULL); gst_bin_add_many (GST_BIN (topbin), background, text, NULL); gst_element_link_pads_full (background, "src", text, "video_sink", GST_PAD_LINK_CHECK_NOTHING); pad = gst_element_get_static_pad (text, "src"); src = gst_ghost_pad_new ("src", pad); gst_object_unref (pad); gst_element_add_pad (topbin, src); gst_object_ref (text); gst_object_ref (background); priv->text_el = text; priv->background_el = background; ges_track_element_add_children_props (object, text, NULL, NULL, text_props); ges_track_element_add_children_props (object, background, NULL, NULL, bg_props); return topbin; }
/** * ges_title_clip_set_ypos: * @self: the #GESTitleClip* to set * @position: The vertical position @self is being set to * * Sets the vertical position of the text. */ void ges_title_clip_set_ypos (GESTitleClip * self, gdouble position) { GSList *tmp; GST_DEBUG_OBJECT (self, "ypos:%f", position); self->priv->ypos = position; for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_ypos (GES_TITLE_SOURCE (tmp->data), self->priv->ypos); } }
/** * ges_title_clip_set_background: * @self: the #GESTitleClip* to set * @background: The color @self is being set to * * Sets the background of the text. */ void ges_title_clip_set_background (GESTitleClip * self, guint32 background) { GSList *tmp; GST_DEBUG_OBJECT (self, "background:%d", background); self->priv->background = background; for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_background_color (GES_TITLE_SOURCE (tmp->data), self->priv->background); } }
/** * ges_title_clip_set_color: * @self: the #GESTitleClip* to set * @color: The color @self is being set to * * Sets the color of the text. */ void ges_title_clip_set_color (GESTitleClip * self, guint32 color) { GSList *tmp; GST_DEBUG_OBJECT (self, "color:%d", color); self->priv->color = color; for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_text_color (GES_TITLE_SOURCE (tmp->data), self->priv->color); } }
/** * ges_title_clip_set_valignment: * @self: the #GESTitleClip* to set vertical alignement of text on * @valign: #GESTextVAlign * * Sets the vertical aligment of the text. * */ void ges_title_clip_set_valignment (GESTitleClip * self, GESTextVAlign valign) { GSList *tmp; GST_DEBUG_OBJECT (self, "valign:%d", valign); self->priv->valign = valign; for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_valignment (GES_TITLE_SOURCE (tmp->data), self->priv->valign); } }
/** * ges_title_clip_set_text: * @self: the #GESTitleClip* to set text on * @text: the text to render. an internal copy of this text will be * made. * * Sets the text this clip will render. * */ void ges_title_clip_set_text (GESTitleClip * self, const gchar * text) { GSList *tmp; GST_DEBUG_OBJECT (self, "text:%s", text); if (self->priv->text) g_free (self->priv->text); self->priv->text = g_strdup (text); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_text (GES_TITLE_SOURCE (tmp->data), self->priv->text); } }
/** * ges_title_clip_set_font_desc: * @self: the #GESTitleClip* * @font_desc: the pango font description * * Sets the pango font description of the text. * */ void ges_title_clip_set_font_desc (GESTitleClip * self, const gchar * font_desc) { GSList *tmp; GST_DEBUG_OBJECT (self, "font_desc:%s", font_desc); if (self->priv->font_desc) g_free (self->priv->font_desc); self->priv->font_desc = g_strdup (font_desc); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { ges_title_source_set_font_desc (GES_TITLE_SOURCE (tmp->data), self->priv->font_desc); } }
static void ges_title_source_dispose (GObject * object) { GESTitleSource *self = GES_TITLE_SOURCE (object); if (self->priv->text) { g_free (self->priv->text); } if (self->priv->font_desc) { g_free (self->priv->font_desc); } if (self->priv->text_el) { gst_object_unref (self->priv->text_el); self->priv->text_el = NULL; } if (self->priv->background_el) { gst_object_unref (self->priv->background_el); self->priv->background_el = NULL; } G_OBJECT_CLASS (ges_title_source_parent_class)->dispose (object); }