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; }
static GstElement * ges_effect_create_element (GESTrackElement * object) { GstElement *effect; gchar *bin_desc; GError *error = NULL; GESEffect *self = GES_EFFECT (object); GESTrack *track = ges_track_element_get_track (object); const gchar *wanted_categories[] = { "Effect", NULL }; if (!track) { GST_WARNING ("The object %p should be in a Track for the element to be created", object); return NULL; } if (track->type == GES_TRACK_TYPE_VIDEO) { bin_desc = g_strconcat ("videoconvert name=pre_video_convert ! ", self->priv->bin_description, " ! videoconvert name=post_video_convert", NULL); } else if (track->type == GES_TRACK_TYPE_AUDIO) { bin_desc = g_strconcat ("audioconvert ! audioresample !", self->priv->bin_description, NULL); } else { GST_DEBUG ("Track type not supported"); return NULL; } effect = gst_parse_bin_from_description (bin_desc, TRUE, &error); g_free (bin_desc); if (error != NULL) { GST_ERROR ("An error occured while creating the GstElement: %s", error->message); g_error_free (error); return NULL; } GST_DEBUG ("Created effect %p", effect); ges_track_element_add_children_props (object, effect, wanted_categories, NULL, NULL); return effect; }
static GstElement * ges_video_test_source_create_source (GESTrackElement * self) { gint pattern; GstElement *testsrc, *capsfilter; const gchar *props[] = { "pattern", NULL }; testsrc = gst_element_factory_make ("videotestsrc", NULL); capsfilter = gst_element_factory_make ("capsfilter", NULL); pattern = ((GESVideoTestSource *) self)->priv->pattern; g_object_set (testsrc, "pattern", pattern, NULL); g_object_set (capsfilter, "caps", gst_caps_new_empty_simple ("video/x-raw"), NULL); ges_track_element_add_children_props (self, testsrc, NULL, NULL, props); return ges_source_create_topbin ("videotestsrc", testsrc, capsfilter, NULL); }