Commit 0292e86b authored by Luis de Bethencourt's avatar Luis de Bethencourt
Browse files

examples: add color option to overlay example

parent c62e18e2
...@@ -30,9 +30,10 @@ GESTimelineObject *make_source (char *path, guint64 start, guint64 duration, ...@@ -30,9 +30,10 @@ GESTimelineObject *make_source (char *path, guint64 start, guint64 duration,
gint priority); gint priority);
GESTimelineObject *make_overlay (char *text, guint64 start, guint64 duration, GESTimelineObject *make_overlay (char *text, guint64 start, guint64 duration,
gint priority); gint priority, guint32 color);
GESTimelinePipeline *make_timeline (char *path, float duration, char *text); GESTimelinePipeline *make_timeline (char *path, float duration, char *text,
guint32 color);
GESTimelineObject * GESTimelineObject *
make_source (char *path, guint64 start, guint64 duration, gint priority) make_source (char *path, guint64 start, guint64 duration, gint priority)
...@@ -53,7 +54,8 @@ make_source (char *path, guint64 start, guint64 duration, gint priority) ...@@ -53,7 +54,8 @@ make_source (char *path, guint64 start, guint64 duration, gint priority)
} }
GESTimelineObject * GESTimelineObject *
make_overlay (char *text, guint64 start, guint64 duration, gint priority) make_overlay (char *text, guint64 start, guint64 duration, gint priority,
guint32 color)
{ {
GESTimelineObject *ret = GESTimelineObject *ret =
GES_TIMELINE_OBJECT (ges_timeline_text_overlay_new ()); GES_TIMELINE_OBJECT (ges_timeline_text_overlay_new ());
...@@ -62,13 +64,14 @@ make_overlay (char *text, guint64 start, guint64 duration, gint priority) ...@@ -62,13 +64,14 @@ make_overlay (char *text, guint64 start, guint64 duration, gint priority)
"text", (gchar *) text, "text", (gchar *) text,
"start", (guint64) start, "start", (guint64) start,
"duration", (guint64) duration, "duration", (guint64) duration,
"priority", (guint32) priority, "in-point", (guint64) 0, NULL); "priority", (guint32) priority,
"in-point", (guint64) 0, "color", (guint32) color, NULL);
return ret; return ret;
} }
GESTimelinePipeline * GESTimelinePipeline *
make_timeline (char *path, float duration, char *text) make_timeline (char *path, float duration, char *text, guint32 color)
{ {
GESTimeline *timeline; GESTimeline *timeline;
GESTrack *trackv, *tracka; GESTrack *trackv, *tracka;
...@@ -99,7 +102,7 @@ make_timeline (char *path, float duration, char *text) ...@@ -99,7 +102,7 @@ make_timeline (char *path, float duration, char *text)
aduration = (guint64) (duration * GST_SECOND); aduration = (guint64) (duration * GST_SECOND);
srca = make_source (path, 0, aduration, 1); srca = make_source (path, 0, aduration, 1);
overlay = make_overlay (text, 0, aduration, 0); overlay = make_overlay (text, 0, aduration, 0, color);
ges_timeline_layer_add_object (layer1, srca); ges_timeline_layer_add_object (layer1, srca);
ges_timeline_layer_add_object (layer1, overlay); ges_timeline_layer_add_object (layer1, overlay);
...@@ -115,6 +118,7 @@ main (int argc, char **argv) ...@@ -115,6 +118,7 @@ main (int argc, char **argv)
GMainLoop *mainloop; GMainLoop *mainloop;
gdouble duration; gdouble duration;
char *path, *text; char *path, *text;
guint64 color;
GOptionEntry options[] = { GOptionEntry options[] = {
{"duration", 'd', 0, G_OPTION_ARG_DOUBLE, &duration, {"duration", 'd', 0, G_OPTION_ARG_DOUBLE, &duration,
...@@ -123,6 +127,8 @@ main (int argc, char **argv) ...@@ -123,6 +127,8 @@ main (int argc, char **argv)
"path to file", "path"}, "path to file", "path"},
{"text", 't', 0, G_OPTION_ARG_STRING, &text, {"text", 't', 0, G_OPTION_ARG_STRING, &text,
"text to render", "text"}, "text to render", "text"},
{"color", 'c', 0, G_OPTION_ARG_INT64, &color,
"color of the text", "color"},
{NULL} {NULL}
}; };
...@@ -147,7 +153,7 @@ main (int argc, char **argv) ...@@ -147,7 +153,7 @@ main (int argc, char **argv)
ges_init (); ges_init ();
pipeline = make_timeline (path, duration, text); pipeline = make_timeline (path, duration, text, color);
mainloop = g_main_loop_new (NULL, FALSE); mainloop = g_main_loop_new (NULL, FALSE);
g_timeout_add_seconds ((duration) + 1, (GSourceFunc) g_main_loop_quit, g_timeout_add_seconds ((duration) + 1, (GSourceFunc) g_main_loop_quit,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment