diff --git a/girs/GES-1.0.gir b/girs/GES-1.0.gir
index b5b94b9fff..b5151e374b 100644
--- a/girs/GES-1.0.gir
+++ b/girs/GES-1.0.gir
@@ -4459,6 +4459,43 @@ else FALSE.
+
+ Metadata type that holds information about the positioning, size,
+transparency and composition operator of a video frame in the timeline
+composition.
+
+
+ the parent #GstMeta.
+
+
+
+
+
+
+ The desired x position.
+
+
+
+ The desired y position.
+
+
+
+ The desired height of the video.
+
+
+
+ The desired width of the video.
+
+
+
+ The desired z order.
+
+
+
+ The blending operator for the source.
+
+
+
A #GESGroup controls one or more #GESContainer-s (usually #GESClip-s,
but it can also control other #GESGroup-s). Its children must share
@@ -16197,6 +16234,20 @@ for later use.
+
+ Attaches positioning metadata to a #GstBuffer.
+
+
+ a pointer to the added #GESFrameCompositionMeta.
+
+
+
+
+ #GstBuffer to which protection metadata should be added.
+
+
+
+
Clean up any resources created by GES in ges_init().
@@ -16253,6 +16304,13 @@ formatter asset.
+
+
+
+
+
+
+
GES needs to be initialized after GStreamer itself. This section
contains the various functions to do so.
diff --git a/subprojects/gst-editing-services/docs/sitemap.txt b/subprojects/gst-editing-services/docs/sitemap.txt
index 27ae10c97a..74ff26bcdb 100644
--- a/subprojects/gst-editing-services/docs/sitemap.txt
+++ b/subprojects/gst-editing-services/docs/sitemap.txt
@@ -23,6 +23,7 @@ gi-index
ges-effect-asset.h
ges-track-element-asset.h
ges-source-clip-asset.h
+ ges-frame-composition-meta.h
ges-effect.h
ges-extractable.h
ges-group.h
@@ -61,4 +62,4 @@ gi-index
ges-prelude.h
deprecated.md
ges-pitivi-formatter.h
- ges-multi-file-source.h
\ No newline at end of file
+ ges-multi-file-source.h
diff --git a/subprojects/gst-editing-services/ges/ges-frame-composition-meta.c b/subprojects/gst-editing-services/ges/ges-frame-composition-meta.c
new file mode 100644
index 0000000000..d8c5a52513
--- /dev/null
+++ b/subprojects/gst-editing-services/ges/ges-frame-composition-meta.c
@@ -0,0 +1,135 @@
+/* GStreamer
+ * Copyright (C) 2013 Mathieu Duponchelle
+ * Copyright (C) 2013 Thibault Saunier
+ * Copyright (C) 2020 Thibault Saunier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+/**
+ * SECTION: gesframecompositionmeta
+ * @title: GESFrameCompositionMeta interface
+ * @short_description: A Meta providing positioning information for a given
+ * video frame
+ *
+ * Since: 1.24
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ges-frame-composition-meta.h"
+#include "gstframepositioner.h"
+
+static gboolean ges_frame_composition_meta_init (GstMeta * meta,
+ gpointer params, GstBuffer * buffer);
+static gboolean ges_frame_composition_meta_transform (GstBuffer * dest,
+ GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data);
+
+GType
+ges_frame_composition_meta_api_get_type (void)
+{
+ static GType type;
+ static const gchar *tags[] = { "video", NULL };
+
+ if (g_once_init_enter (&type)) {
+ GType _type = gst_meta_api_type_register ("GstFrameCompositionApi", tags);
+ g_once_init_leave (&type, _type);
+ }
+ return type;
+}
+
+static const GstMetaInfo *
+ges_frame_composition_meta_get_info (void)
+{
+ static const GstMetaInfo *meta_info = NULL;
+
+ if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
+ const GstMetaInfo *meta =
+ gst_meta_register (ges_frame_composition_meta_api_get_type (),
+ "GESFrameCompositionMeta",
+ sizeof (GESFrameCompositionMeta), ges_frame_composition_meta_init, NULL,
+ ges_frame_composition_meta_transform);
+ g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) meta);
+ }
+ return meta_info;
+}
+
+static gboolean
+ges_frame_composition_meta_init (GstMeta * meta, gpointer params,
+ GstBuffer * buffer)
+{
+ int default_operator_value = 0;
+ GESFrameCompositionMeta *smeta;
+
+ smeta = (GESFrameCompositionMeta *) meta;
+
+ gst_compositor_operator_get_type_and_default_value (&default_operator_value);
+
+ smeta->alpha = 0.0;
+ smeta->posx = smeta->posy = smeta->height = smeta->width = 0;
+ smeta->zorder = 0;
+ smeta->operator = default_operator_value;
+
+ return TRUE;
+}
+
+static gboolean
+ges_frame_composition_meta_transform (GstBuffer * dest, GstMeta * meta,
+ GstBuffer * buffer, GQuark type, gpointer data)
+{
+ GESFrameCompositionMeta *dmeta, *smeta;
+
+ smeta = (GESFrameCompositionMeta *) meta;
+
+ if (GST_META_TRANSFORM_IS_COPY (type)) {
+ /* only copy if the complete data is copied as well */
+ dmeta =
+ (GESFrameCompositionMeta *) gst_buffer_add_meta (dest,
+ ges_frame_composition_meta_get_info (), NULL);
+ dmeta->alpha = smeta->alpha;
+ dmeta->posx = smeta->posx;
+ dmeta->posy = smeta->posy;
+ dmeta->width = smeta->width;
+ dmeta->height = smeta->height;
+ dmeta->zorder = smeta->zorder;
+ dmeta->operator = smeta->operator;
+ }
+
+ return TRUE;
+}
+
+/**
+ * ges_buffer_add_frame_composition_meta:
+ * @buffer: #GstBuffer to which protection metadata should be added.
+ *
+ * Attaches positioning metadata to a #GstBuffer.
+ *
+ * Returns: (transfer none): a pointer to the added #GESFrameCompositionMeta.
+ *
+ * Since: 1.24
+ */
+GESFrameCompositionMeta *
+ges_buffer_add_frame_composition_meta (GstBuffer * buffer)
+{
+ GESFrameCompositionMeta *meta;
+
+ meta =
+ (GESFrameCompositionMeta *) gst_buffer_add_meta (buffer,
+ ges_frame_composition_meta_get_info (), NULL);
+ return meta;
+}
diff --git a/subprojects/gst-editing-services/ges/ges-frame-composition-meta.h b/subprojects/gst-editing-services/ges/ges-frame-composition-meta.h
new file mode 100644
index 0000000000..c997752842
--- /dev/null
+++ b/subprojects/gst-editing-services/ges/ges-frame-composition-meta.h
@@ -0,0 +1,73 @@
+/* GStreamer
+ * Copyright (C) 2013 Mathieu Duponchelle
+ * Copyright (C) 2013 Thibault Saunier
+ * Copyright (C) 2020 Thibault Saunier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+#pragma once
+
+#include
+#include
+#include
+
+G_BEGIN_DECLS
+
+/**
+ * ges_frame_composition_meta_api_get_type: (attributes doc.skip=true)
+ */
+GES_API
+GType ges_frame_composition_meta_api_get_type (void);
+
+/**
+ * GES_TYPE_META_FRAME_COMPOSITION: (attributes doc.skip=true)
+ */
+#define GES_TYPE_META_FRAME_COMPOSITION (ges_frame_composition_meta_api_get_type())
+
+/**
+ * GESFrameCompositionMeta:
+ * @meta: the parent #GstMeta.
+ * @posx: The desired x position.
+ * @posy: The desired y position.
+ * @height: The desired height of the video.
+ * @width: The desired width of the video.
+ * @zorder: The desired z order.
+ * @operator:The blending operator for the source.
+ *
+ * Metadata type that holds information about the positioning, size,
+ * transparency and composition operator of a video frame in the timeline
+ * composition.
+ *
+ * Since: 1.24
+ */
+typedef struct _GESFrameCompositionMeta GESFrameCompositionMeta;
+struct _GESFrameCompositionMeta {
+ GstMeta meta;
+
+ gdouble alpha;
+ gint posx;
+ gint posy;
+ gint height;
+ gint width;
+ guint zorder;
+ gint operator;
+};
+
+GES_API
+GESFrameCompositionMeta * ges_buffer_add_frame_composition_meta (GstBuffer * buffer);
+
+G_END_DECLS
diff --git a/subprojects/gst-editing-services/ges/ges-smart-video-mixer.c b/subprojects/gst-editing-services/ges/ges-smart-video-mixer.c
index 758d36850b..f71bb24c88 100644
--- a/subprojects/gst-editing-services/ges/ges-smart-video-mixer.c
+++ b/subprojects/gst-editing-services/ges/ges-smart-video-mixer.c
@@ -21,6 +21,7 @@
#endif
#include "gstframepositioner.h"
+#include "ges-frame-composition-meta.h"
#include "ges-types.h"
#include "ges-internal.h"
#include "ges-smart-video-mixer.h"
@@ -204,19 +205,19 @@ ges_smart_mixer_get_mixer_pad (GESSmartMixer * self, GstPad ** mixerpad)
}
static void
-set_pad_properties_from_positioner_meta (GstPad * mixer_pad, GstSample * sample,
- GESSmartMixerPad * ghost)
+set_pad_properties_from_composition_meta (GstPad * mixer_pad,
+ GstSample * sample, GESSmartMixerPad * ghost)
{
- GstFramePositionerMeta *meta;
+ GESFrameCompositionMeta *meta;
GstBuffer *buf = gst_sample_get_buffer (sample);
GESSmartMixer *self = GES_SMART_MIXER (GST_OBJECT_PARENT (ghost));
meta =
- (GstFramePositionerMeta *) gst_buffer_get_meta (buf,
- gst_frame_positioner_meta_api_get_type ());
+ (GESFrameCompositionMeta *) gst_buffer_get_meta (buf,
+ GES_TYPE_META_FRAME_COMPOSITION);
if (!meta) {
- GST_WARNING ("The current source should use a framepositioner");
+ GST_WARNING ("The current source should use a framecomposition");
return;
}
@@ -373,7 +374,7 @@ compositor_sync_properties_with_meta (GstElement * compositor,
GST_AGGREGATOR_PAD (sinkpad));
if (sample) {
- set_pad_properties_from_positioner_meta (sinkpad,
+ set_pad_properties_from_composition_meta (sinkpad,
sample, GES_SMART_MIXER_PAD (info->ghostpad));
gst_sample_unref (sample);
} else {
diff --git a/subprojects/gst-editing-services/ges/ges.h b/subprojects/gst-editing-services/ges/ges.h
index 882758bfd9..4a685ca4cd 100644
--- a/subprojects/gst-editing-services/ges/ges.h
+++ b/subprojects/gst-editing-services/ges/ges.h
@@ -82,6 +82,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/subprojects/gst-editing-services/ges/gstframepositioner.c b/subprojects/gst-editing-services/ges/gstframepositioner.c
index e2bb6bdccf..34783baf1f 100644
--- a/subprojects/gst-editing-services/ges/gstframepositioner.c
+++ b/subprojects/gst-editing-services/ges/gstframepositioner.c
@@ -26,6 +26,7 @@
#include
#include "gstframepositioner.h"
+#include "ges-frame-composition-meta.h"
#include "ges-internal.h"
GST_DEBUG_CATEGORY_STATIC (_framepositioner);
@@ -43,12 +44,6 @@ static void gst_frame_positioner_get_property (GObject * object,
static GstFlowReturn gst_frame_positioner_transform_ip (GstBaseTransform *
trans, GstBuffer * buf);
-static gboolean
-gst_frame_positioner_meta_init (GstMeta * meta, gpointer params,
- GstBuffer * buffer);
-static gboolean gst_frame_positioner_meta_transform (GstBuffer * dest,
- GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data);
-
enum
{
PROP_0,
@@ -693,84 +688,10 @@ gst_frame_positioner_get_property (GObject * object, guint property_id,
}
}
-GType
-gst_frame_positioner_meta_api_get_type (void)
-{
- static GType type;
- static const gchar *tags[] = { "video", NULL };
-
- if (g_once_init_enter (&type)) {
- GType _type = gst_meta_api_type_register ("GstFramePositionerApi", tags);
- g_once_init_leave (&type, _type);
- }
- return type;
-}
-
-static const GstMetaInfo *
-gst_frame_positioner_get_info (void)
-{
- static const GstMetaInfo *meta_info = NULL;
-
- if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
- const GstMetaInfo *meta =
- gst_meta_register (gst_frame_positioner_meta_api_get_type (),
- "GstFramePositionerMeta",
- sizeof (GstFramePositionerMeta), gst_frame_positioner_meta_init,
- NULL,
- gst_frame_positioner_meta_transform);
- g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) meta);
- }
- return meta_info;
-}
-
-static gboolean
-gst_frame_positioner_meta_init (GstMeta * meta, gpointer params,
- GstBuffer * buffer)
-{
- int default_operator_value = 0;
- GstFramePositionerMeta *smeta;
-
- smeta = (GstFramePositionerMeta *) meta;
-
- gst_compositor_operator_get_type_and_default_value (&default_operator_value);
-
- smeta->alpha = 0.0;
- smeta->posx = smeta->posy = smeta->height = smeta->width = 0;
- smeta->zorder = 0;
- smeta->operator = default_operator_value;
-
- return TRUE;
-}
-
-static gboolean
-gst_frame_positioner_meta_transform (GstBuffer * dest, GstMeta * meta,
- GstBuffer * buffer, GQuark type, gpointer data)
-{
- GstFramePositionerMeta *dmeta, *smeta;
-
- smeta = (GstFramePositionerMeta *) meta;
-
- if (GST_META_TRANSFORM_IS_COPY (type)) {
- /* only copy if the complete data is copied as well */
- dmeta =
- (GstFramePositionerMeta *) gst_buffer_add_meta (dest,
- gst_frame_positioner_get_info (), NULL);
- dmeta->alpha = smeta->alpha;
- dmeta->posx = smeta->posx;
- dmeta->posy = smeta->posy;
- dmeta->width = smeta->width;
- dmeta->height = smeta->height;
- dmeta->zorder = smeta->zorder;
- dmeta->operator = smeta->operator;
- }
-
- return TRUE;
-}
-
static GstFlowReturn
gst_frame_positioner_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
- GstFramePositionerMeta *meta;
+ GESFrameCompositionMeta *meta;
GstFramePositioner *framepositioner = GST_FRAME_POSITIONNER (trans);
GstClockTime timestamp = GST_BUFFER_PTS (buf);
@@ -778,9 +699,7 @@ gst_frame_positioner_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
gst_object_sync_values (GST_OBJECT (trans), timestamp);
}
- meta =
- (GstFramePositionerMeta *) gst_buffer_add_meta (buf,
- gst_frame_positioner_get_info (), NULL);
+ meta = ges_buffer_add_frame_composition_meta (buf);
GST_OBJECT_LOCK (framepositioner);
meta->alpha = framepositioner->alpha;
diff --git a/subprojects/gst-editing-services/ges/gstframepositioner.h b/subprojects/gst-editing-services/ges/gstframepositioner.h
index 1be7037d6f..d7ce135b79 100644
--- a/subprojects/gst-editing-services/ges/gstframepositioner.h
+++ b/subprojects/gst-editing-services/ges/gstframepositioner.h
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
typedef struct _GstFramePositioner GstFramePositioner;
typedef struct _GstFramePositionerClass GstFramePositionerClass;
-typedef struct _GstFramePositionerMeta GstFramePositionerMeta;
struct _GstFramePositioner
{
@@ -73,25 +72,11 @@ struct _GstFramePositionerClass
GstBaseTransformClass base_framepositioner_class;
};
-struct _GstFramePositionerMeta {
- GstMeta meta;
-
- gdouble alpha;
- gint posx;
- gint posy;
- gint height;
- gint width;
- guint zorder;
- gint operator;
-};
-
G_GNUC_INTERNAL GType gst_compositor_operator_get_type_and_default_value (int *default_operator_value);
G_GNUC_INTERNAL void ges_frame_positioner_set_source_and_filter (GstFramePositioner *pos,
GESTrackElement *trksrc,
GstElement *capsfilter);
G_GNUC_INTERNAL GType gst_frame_positioner_get_type (void);
-G_GNUC_INTERNAL GType
-gst_frame_positioner_meta_api_get_type (void);
G_END_DECLS
diff --git a/subprojects/gst-editing-services/ges/meson.build b/subprojects/gst-editing-services/ges/meson.build
index 014ce76234..147517947a 100644
--- a/subprojects/gst-editing-services/ges/meson.build
+++ b/subprojects/gst-editing-services/ges/meson.build
@@ -1,6 +1,7 @@
ges_sources = files([
'ges.c',
'ges-enums.c',
+ 'ges-frame-composition-meta.c',
'ges-meta-container.c',
'ges-timeline.c',
'ges-layer.c',
@@ -73,6 +74,7 @@ ges_headers = files([
'ges-types.h',
'ges.h',
'ges-prelude.h',
+ 'ges-frame-composition-meta.h',
'ges-enums.h',
'ges-gerror.h',
'ges-meta-container.h',