From 498414e78207cb4b5b4a1ec27745ad0eeaa3fa82 Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Wed, 26 May 2010 13:05:18 +0200 Subject: [PATCH] tests/examples/transition.c: make -t option work with values supported by smpte + "crossfade" --- tests/examples/transition.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/examples/transition.c b/tests/examples/transition.c index c9c7df138d..2a9e501dfd 100644 --- a/tests/examples/transition.c +++ b/tests/examples/transition.c @@ -155,14 +155,14 @@ main (int argc, char **argv) GOptionContext *ctx; GESTimelinePipeline *pipeline; GMainLoop *mainloop; - gint type; + gchar *type = "crossfade"; gchar *uri = NULL; gdouble tdur; GOptionEntry options[] = { - {"type", 't', 0, G_OPTION_ARG_INT, &type, - "type of transition to create (smpte numeric)", ""}, - {"duration", 'd', 0.0, G_OPTION_ARG_DOUBLE, &tdur, + {"type", 't', 0, G_OPTION_ARG_STRING, &type, + "type of transition to create", ""}, + {"duration", 'd', 0, G_OPTION_ARG_DOUBLE, &tdur, "duration of transition", "seconds"}, {NULL} }; @@ -188,6 +188,18 @@ main (int argc, char **argv) ges_init (); + /* get list of available transitions */ + GstElement *element = gst_element_factory_make ("smpte", NULL); + GstElementClass *element_class = GST_ELEMENT_GET_CLASS (element); + + GParamSpec *pspec = + g_object_class_find_property (G_OBJECT_CLASS (element_class), "type"); + + GEnumClass *smpte_enum_class = + G_ENUM_CLASS (g_type_class_ref (pspec->value_type)); + + GEnumValue *ttype = get_transition_type (type, smpte_enum_class); + gdouble adur = (gdouble) atof (argv[2]); gdouble bdur = (gdouble) atof (argv[4]); -- 2.34.1