meta-container: Add a VOLUME default meta to layers
authorThibault Saunier <thibault.saunier@collabora.com>
Mon, 22 Apr 2013 03:21:58 +0000 (00:21 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Sun, 23 Jun 2013 22:28:53 +0000 (18:28 -0400)
ges/ges-layer.c
ges/ges-meta-container.h
tests/check/ges/layer.c

index 2f2503f..365c95c 100644 (file)
@@ -128,6 +128,15 @@ ges_layer_dispose (GObject * object)
   G_OBJECT_CLASS (ges_layer_parent_class)->dispose (object);
 }
 
+static gboolean
+_register_metas (GESLayer * layer)
+{
+  ges_meta_container_register_meta_float (GES_META_CONTAINER (layer),
+      GES_META_READ_WRITE, GES_META_VOLUME, 1.0);
+
+  return TRUE;
+}
+
 static void
 ges_meta_container_interface_init (GESMetaContainerInterface * iface)
 {
@@ -202,6 +211,8 @@ ges_layer_init (GESLayer * self)
   self->priv->auto_transition = FALSE;
   self->min_gnl_priority = MIN_GNL_PRIO;
   self->max_gnl_priority = LAYER_HEIGHT + MIN_GNL_PRIO;
+
+  _register_metas (self);
 }
 
 /**
index d900fc6..200dab5 100644 (file)
@@ -84,6 +84,24 @@ G_BEGIN_DECLS
  */
 #define GES_META_FORMATTER_RANK                       "rank"
 
+/**
+ * GES_META_VOLUME:
+ *
+ * The volume, can be used for audio track or layers
+ *
+ * The volume for a track or a layer, it is register as a float
+ */
+#define GES_META_VOLUME                              "volume"
+
+/**
+ * GES_META_VOLUME_DEFAULT:
+ *
+ * The default volume
+ *
+ * The default volume for a track or a layer as a float
+ */
+#define GES_META_VOLUME_DEFAULT                       1.0
+
 typedef struct _GESMetaContainer          GESMetaContainer;
 typedef struct _GESMetaContainerInterface GESMetaContainerInterface;
 
index ccb12da..f2c9e46 100644 (file)
@@ -1763,7 +1763,7 @@ test_foreach (const GESMetaContainer * container, const gchar * key,
     GValue * value, gpointer user_data)
 {
   fail_unless ((0 == g_strcmp0 (key, "some-string")) ||
-      (0 == g_strcmp0 (key, "some-int")));
+      (0 == g_strcmp0 (key, "some-int")) || (0 == g_strcmp0 (key, "volume")));
 }
 
 GST_START_TEST (test_layer_meta_foreach)