ges: Expose ges mixer to be used as effects
authorThibault Saunier <tsaunier@igalia.com>
Sat, 17 Aug 2019 15:59:38 +0000 (11:59 -0400)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 28 Aug 2019 13:51:02 +0000 (13:51 +0000)
ges/ges-effect.c
ges/ges.c

index cc900b0..3dd08a7 100644 (file)
  * @title: GESEffect
  * @short_description: adds an effect build from a parse-launch style
  * bin description to a stream in a GESSourceClip or a GESLayer
+ *
+ * Currently we only support effects with 1 sinkpad and 1 sourcepad
+ * with the exception of `gesaudiomixer` and `gescompositor` which
+ * can be used as effects.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -291,6 +295,10 @@ ges_effect_create_element (GESTrackElement * object)
 
   GESTrackType type = ges_track_element_get_track_type (object);
 
+  if (!g_strcmp0 (self->priv->bin_description, "gesaudiomixer") ||
+      !g_strcmp0 (self->priv->bin_description, "gescompositor"))
+    return gst_element_factory_make (self->priv->bin_description, NULL);
+
   if (type == GES_TRACK_TYPE_VIDEO) {
     bin_desc = g_strconcat ("videoconvert name=pre_video_convert ! ",
         self->priv->bin_description, " ! videoconvert name=post_video_convert",
index 4e76ba4..a4e98aa 100644 (file)
--- a/ges/ges.c
+++ b/ges/ges.c
@@ -34,6 +34,8 @@
 #include <stdlib.h>
 #include <ges/ges.h>
 #include "ges/gstframepositioner.h"
+#include "ges/ges-smart-adder.h"
+#include "ges/ges-smart-video-mixer.h"
 #include "ges-internal.h"
 
 #ifndef DISABLE_XPTV
@@ -115,6 +117,7 @@ ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
   g_type_class_ref (GES_TYPE_TRANSITION_CLIP);
   g_type_class_ref (GES_TYPE_OVERLAY_CLIP);
   g_type_class_ref (GES_TYPE_OVERLAY_TEXT_CLIP);
+  g_type_class_ref (GES_TYPE_EFFECT_CLIP);
 
   g_type_class_ref (GES_TYPE_GROUP);
 
@@ -123,6 +126,8 @@ ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
 
   ges_asset_cache_init ();
 
+  gst_element_register (NULL, "gesaudiomixer", 0, GES_TYPE_SMART_ADDER);
+  gst_element_register (NULL, "gescompositor", 0, GES_TYPE_SMART_MIXER);
   gst_element_register (NULL, "framepositioner", 0, GST_TYPE_FRAME_POSITIONNER);
   gst_element_register (NULL, "gespipeline", 0, GES_TYPE_PIPELINE);
 
@@ -212,6 +217,7 @@ ges_deinit (void)
   g_type_class_unref (g_type_class_peek (GES_TYPE_TRANSITION_CLIP));
   g_type_class_unref (g_type_class_peek (GES_TYPE_OVERLAY_CLIP));
   g_type_class_unref (g_type_class_peek (GES_TYPE_OVERLAY_TEXT_CLIP));
+  g_type_class_unref (g_type_class_peek (GES_TYPE_EFFECT_CLIP));
 
   g_type_class_unref (g_type_class_peek (GES_TYPE_GROUP));
   /* Register track elements */