summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@gnome.org>2015-08-27 16:28:42 +0200
committerThibault Saunier <tsaunier@gnome.org>2015-08-27 21:58:39 +0200
commitab254648769d206caa36b057cdc21df0f71ebc89 (patch)
tree4fa61901d58c2fb0990d4648763fb15fa785d636
parentfd0cc5cb2af6365eb88c35907128aa9faf9dd0df (diff)
video-source: Simply set framepositionner->zorder = self->priority
Summary: Making the code simpler and handling the transition case where elements are in the same layer (which was failing /setting same zorders until now). Reviewers: Mathieu_Du Differential Revision: https://phabricator.freedesktop.org/D237
-rw-r--r--ges/ges-video-source.c67
-rw-r--r--ges/gstframepositionner.c2
2 files changed, 14 insertions, 55 deletions
diff --git a/ges/ges-video-source.c b/ges/ges-video-source.c
index 52c3464f..b0e05b17 100644
--- a/ges/ges-video-source.c
+++ b/ges/ges-video-source.c
@@ -77,48 +77,31 @@
#include "ges-layer.h"
#include "gstframepositionner.h"
+#define parent_class ges_video_source_parent_class
G_DEFINE_ABSTRACT_TYPE (GESVideoSource, ges_video_source, GES_TYPE_SOURCE);
struct _GESVideoSourcePrivate
{
GstFramePositionner *positionner;
GstElement *capsfilter;
- GESLayer *layer;
};
/* TrackElement VMethods */
-static void
-layer_priority_changed_cb (GESLayer * layer, GParamSpec * arg G_GNUC_UNUSED,
- GESVideoSource * self)
-{
- g_object_set (self->priv->positionner, "zorder",
- 10000 - ges_layer_get_priority (layer), NULL);
-}
-static void
-layer_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
- GESVideoSource * self)
+static gboolean
+_set_priority (GESTimelineElement * element, guint32 priority)
{
- GESVideoSourcePrivate *priv = self->priv;
+ gboolean res;
+ GESVideoSource *self = GES_VIDEO_SOURCE (element);
- if (priv->layer) {
- g_signal_handlers_disconnect_by_func (priv->layer,
- layer_priority_changed_cb, self);
- }
-
- priv->layer = ges_clip_get_layer (clip);
- if (priv->layer == NULL)
- return;
+ res = GES_TIMELINE_ELEMENT_CLASS (parent_class)->set_priority (element,
+ priority);
- /* We do not need any ref ourself as our parent owns one and we are connected
- * to it */
- g_object_unref (priv->layer);
- /* 10000 is the max value of zorder on videomixerpad, hardcoded */
- g_signal_connect (self->priv->layer, "notify::priority",
- G_CALLBACK (layer_priority_changed_cb), self);
+ if (res && self->priv->positionner)
+ g_object_set (self->priv->positionner, "zorder",
+ GES_TIMELINE_ELEMENT_PRIORITY (self), NULL);
- g_object_set (self->priv->positionner, "zorder",
- 10000 - ges_layer_get_priority (self->priv->layer), NULL);
+ return res;
}
static void
@@ -190,9 +173,6 @@ ges_video_source_create_element (GESTrackElement * trksrc)
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
if (parent) {
self->priv->positionner = GST_FRAME_POSITIONNER (positionner);
- g_signal_connect (parent, "notify::layer",
- (GCallback) layer_changed_cb, trksrc);
- layer_changed_cb (GES_CLIP (parent), NULL, self);
gst_object_unref (parent);
} else {
GST_ERROR ("No parent timeline element, SHOULD NOT HAPPEN");
@@ -203,28 +183,6 @@ ges_video_source_create_element (GESTrackElement * trksrc)
return topbin;
}
-static gboolean
-_set_parent (GESTimelineElement * self, GESTimelineElement * parent)
-{
- GESVideoSourcePrivate *priv = GES_VIDEO_SOURCE (self)->priv;
-
- if (self->parent) {
- if (priv->layer) {
- g_signal_handlers_disconnect_by_func (priv->layer,
- layer_priority_changed_cb, self);
- priv->layer = NULL;
- }
-
- g_signal_handlers_disconnect_by_func (self->parent, layer_changed_cb, self);
- }
-
- if (parent && priv->positionner)
- layer_changed_cb (GES_CLIP (parent), NULL, GES_VIDEO_SOURCE (self));
-
-
- return TRUE;
-}
-
static void
ges_video_source_class_init (GESVideoSourceClass * klass)
{
@@ -234,7 +192,8 @@ ges_video_source_class_init (GESVideoSourceClass * klass)
g_type_class_add_private (klass, sizeof (GESVideoSourcePrivate));
- element_class->set_parent = _set_parent;
+ element_class->set_priority = _set_priority;
+
track_class->nleobject_factorytype = "nlesource";
track_class->create_element = ges_video_source_create_element;
video_source_class->create_source = NULL;
diff --git a/ges/gstframepositionner.c b/ges/gstframepositionner.c
index e1b7827e..9d2ece42 100644
--- a/ges/gstframepositionner.c
+++ b/ges/gstframepositionner.c
@@ -289,7 +289,7 @@ gst_frame_positionner_class_init (GstFramePositionnerClass * klass)
*/
g_object_class_install_property (gobject_class, PROP_ZORDER,
g_param_spec_uint ("zorder", "zorder", "z order of the stream",
- 0, 10000, 0, G_PARAM_READWRITE));
+ 0, G_MAXUINT, 0, G_PARAM_READWRITE));
/**
* gesframepositionner:width: