tests/examples/transition.c: add routines for identifying transitions
authorBrandon Lewis <brandon.lewis@collabora.co.uk>
Wed, 26 May 2010 11:04:06 +0000 (13:04 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 9 Jun 2010 09:28:08 +0000 (11:28 +0200)
tests/examples/transition.c

index 7cb966bcbaa9bb24750ec258c0937a5142039d93..c9c7df138daa639bfcebb07dc490e4fb87aba5ed 100644 (file)
@@ -64,6 +64,40 @@ print_transition_data (GESTimelineObject * tr)
   return FALSE;
 }
 
+void
+print_value_names (GEnumClass * enum_class)
+{
+  if (enum_class) {
+    int i;
+    for (i = 0; i < enum_class->n_values; i++) {
+      GEnumValue value = enum_class->values[i];
+      g_print ("%s (%d): %s\n", value.value_nick, value.value,
+          value.value_name);
+    }
+  }
+}
+
+GEnumValue *
+get_transition_type (char *nick, GEnumClass * smpte_enum_class)
+{
+  GEnumValue *value = g_enum_get_value_by_nick (smpte_enum_class, nick);
+
+  g_print ("%s\n", nick);
+
+  if (!strcmp ("crossfade", nick)) {
+    return NULL;
+  }
+
+  if (!value) {
+    g_print ("Error: Invalid transition type. Valid transitions are:\n");
+    print_value_names (smpte_enum_class);
+    exit (-1);
+  }
+
+  return value;
+}
+
+
 GESTimelinePipeline *
 make_timeline (double tdur, char *patha, float adur, char *pathb, float bdur)
 {