mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
video-transition: Add a framepositioner at the end of the transitio
So downstream compositor knows the zorder of the various streams
This commit is contained in:
parent
5207d6dfca
commit
d1c01678bc
1 changed files with 30 additions and 2 deletions
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <gst/controller/gstdirectcontrolbinding.h>
|
#include <gst/controller/gstdirectcontrolbinding.h>
|
||||||
|
|
||||||
|
#define parent_class ges_video_transition_parent_class
|
||||||
G_DEFINE_TYPE (GESVideoTransition, ges_video_transition, GES_TYPE_TRANSITION);
|
G_DEFINE_TYPE (GESVideoTransition, ges_video_transition, GES_TYPE_TRANSITION);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -63,6 +64,8 @@ struct _GESVideoTransitionPrivate
|
||||||
/* This is in case the smpte doesn't exist yet */
|
/* This is in case the smpte doesn't exist yet */
|
||||||
gint pending_border_value;
|
gint pending_border_value;
|
||||||
gboolean pending_inverted;
|
gboolean pending_inverted;
|
||||||
|
|
||||||
|
GstElement *positionner;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -105,11 +108,28 @@ duration_changed_cb (GESTrackElement * self, GParamSpec * arg G_GNUC_UNUSED)
|
||||||
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self)));
|
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_set_priority (GESTimelineElement * element, guint32 priority)
|
||||||
|
{
|
||||||
|
gboolean res;
|
||||||
|
GESVideoTransition *self = GES_VIDEO_TRANSITION (element);
|
||||||
|
|
||||||
|
res = GES_TIMELINE_ELEMENT_CLASS (parent_class)->set_priority (element,
|
||||||
|
priority);
|
||||||
|
|
||||||
|
if (res && self->priv->positionner)
|
||||||
|
g_object_set (self->priv->positionner, "zorder",
|
||||||
|
G_MAXUINT - priority, NULL);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_video_transition_class_init (GESVideoTransitionClass * klass)
|
ges_video_transition_class_init (GESVideoTransitionClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class;
|
GObjectClass *object_class;
|
||||||
GESTrackElementClass *toclass;
|
GESTrackElementClass *toclass;
|
||||||
|
GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESVideoTransitionPrivate));
|
g_type_class_add_private (klass, sizeof (GESVideoTransitionPrivate));
|
||||||
|
|
||||||
|
@ -159,6 +179,8 @@ ges_video_transition_class_init (GESVideoTransitionClass * klass)
|
||||||
|
|
||||||
toclass = GES_TRACK_ELEMENT_CLASS (klass);
|
toclass = GES_TRACK_ELEMENT_CLASS (klass);
|
||||||
toclass->create_element = ges_video_transition_create_element;
|
toclass->create_element = ges_video_transition_create_element;
|
||||||
|
|
||||||
|
element_class->set_priority = _set_priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -308,9 +330,14 @@ ges_video_transition_create_element (GESTrackElement * object)
|
||||||
|
|
||||||
iconva = gst_element_factory_make ("videoconvert", "tr-csp-a");
|
iconva = gst_element_factory_make ("videoconvert", "tr-csp-a");
|
||||||
iconvb = gst_element_factory_make ("videoconvert", "tr-csp-b");
|
iconvb = gst_element_factory_make ("videoconvert", "tr-csp-b");
|
||||||
|
priv->positionner =
|
||||||
|
gst_element_factory_make ("framepositionner", "frame_tagger");
|
||||||
|
g_object_set (priv->positionner, "zorder",
|
||||||
|
G_MAXUINT - GES_TIMELINE_ELEMENT_PRIORITY (self), NULL);
|
||||||
oconv = gst_element_factory_make ("videoconvert", "tr-csp-output");
|
oconv = gst_element_factory_make ("videoconvert", "tr-csp-output");
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, oconv, NULL);
|
gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, priv->positionner,
|
||||||
|
oconv, NULL);
|
||||||
|
|
||||||
mixer = ges_smart_mixer_new (NULL);
|
mixer = ges_smart_mixer_new (NULL);
|
||||||
g_assert (mixer);
|
g_assert (mixer);
|
||||||
|
@ -327,7 +354,8 @@ ges_video_transition_create_element (GESTrackElement * object)
|
||||||
g_object_set (priv->mixer_sinka, "zorder", 0, NULL);
|
g_object_set (priv->mixer_sinka, "zorder", 0, NULL);
|
||||||
g_object_set (priv->mixer_sinkb, "zorder", 1, NULL);
|
g_object_set (priv->mixer_sinkb, "zorder", 1, NULL);
|
||||||
|
|
||||||
fast_element_link (mixer, oconv);
|
fast_element_link (mixer, priv->positionner);
|
||||||
|
fast_element_link (priv->positionner, oconv);
|
||||||
|
|
||||||
sinka_target = gst_element_get_static_pad (iconva, "sink");
|
sinka_target = gst_element_get_static_pad (iconva, "sink");
|
||||||
sinkb_target = gst_element_get_static_pad (iconvb, "sink");
|
sinkb_target = gst_element_get_static_pad (iconvb, "sink");
|
||||||
|
|
Loading…
Reference in a new issue