ges/ges-timeline-transition.{c,h}: add convenience routine for creating
authorBrandon Lewis <brandon.lewis@collabora.co.uk>
Thu, 27 May 2010 10:02:10 +0000 (12:02 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 9 Jun 2010 09:28:08 +0000 (11:28 +0200)
transitions
docs/libs/ges-sections.txt: add routine to documentation

docs/libs/ges-sections.txt
ges/ges-timeline-transition.c
ges/ges-timeline-transition.h

index 2b78b59c58996657ac729bc57815ca543b1a8c48..44d793058203ed024c92babe4aecb2994bbf363d 100644 (file)
@@ -243,6 +243,7 @@ GES_TYPE_TIMELINE_FILE_SOURCE
 GESTimelineTransition
 GESTimelineTransitionClass
 ges_timeline_transition_new
+ges_timeline_transition_new_for_nick
 <SUBSECTION Standard>
 GES_IS_TIMELINE_TRANSITION
 GES_IS_TIMELINE_TRANSITION_CLASS
index b3e0389e26ff512f227712e534cd8aed7f9b6f88..0a56c01edea29741ba7d90786bcf668bb57d4305 100644 (file)
@@ -109,3 +109,39 @@ ges_timeline_transition_new (GEnumValue * vtype)
   ret->vtype = vtype;
   return ret;
 }
+
+static GEnumClass *smpte_enum_class = NULL;
+
+static
+_ensure_smpte_enum_class ()
+{
+  if (!smpte_enum_class) {
+    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");
+
+    smpte_enum_class = G_ENUM_CLASS (g_type_class_ref (pspec->value_type));
+  }
+
+}
+
+GESTimelineTransition *
+ges_timeline_transition_new_for_nick (char *nick)
+{
+
+  _ensure_smpte_enum_class ();
+
+  if (!strcmp ("crossfade", nick)) {
+    return ges_timeline_transition_new (NULL);
+  }
+
+  GEnumValue *value = g_enum_get_value_by_nick (smpte_enum_class, nick);
+
+  if (!value) {
+    return NULL;
+  }
+
+  return ges_timeline_transition_new (value);
+}
index e3cb11edcca5f4372ea49a2e293be713e22adf1d..4a612a1ad7962ce2a5e31f92ac8bbe3336e0243e 100644 (file)
@@ -55,6 +55,7 @@ struct _GESTimelineTransitionClass {
 GType ges_timeline_transition_get_type (void);
 
 GESTimelineTransition *ges_timeline_transition_new (GEnumValue * vtype);
+GESTimelineTransition *ges_timeline_transition_new_for_nick (char *nick);
 
 G_END_DECLS