From b64dd336613d903a8b13a6500eeb0e5f7bb332ac Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 28 Oct 2018 15:33:31 +0000 Subject: [PATCH] Revert "video-transition: Make use of the new `compositor::crossfade-ratio` property" This reverts commit 57be9b67998bf5fef81a61c645b167c3857ed35b. --- ges/ges-smart-video-mixer.c | 2 -- ges/ges-video-transition.c | 54 ++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/ges/ges-smart-video-mixer.c b/ges/ges-smart-video-mixer.c index c2d9f2e451..8e749181d2 100644 --- a/ges/ges-smart-video-mixer.c +++ b/ges/ges-smart-video-mixer.c @@ -104,8 +104,6 @@ parse_metadata (GstPad * mixer_pad, GstPadProbeInfo * info, if (!self->disable_zorder_alpha) { g_object_set (mixer_pad, "alpha", meta->alpha, "zorder", meta->zorder, NULL); - } else { - g_object_set (mixer_pad, "alpha", meta->alpha, NULL); } g_object_set (mixer_pad, "xpos", meta->posx, "ypos", diff --git a/ges/ges-video-transition.c b/ges/ges-video-transition.c index 8070bf4b62..d5fc04f7bc 100644 --- a/ges/ges-video-transition.c +++ b/ges/ges-video-transition.c @@ -49,7 +49,8 @@ struct _GESVideoTransitionPrivate GESVideoStandardTransitionType pending_type; /* these enable video interpolation */ - GstTimedValueControlSource *crossfade_control_source; + GstTimedValueControlSource *fade_in_control_source; + GstTimedValueControlSource *fade_out_control_source; GstTimedValueControlSource *smpte_control_source; /* so we can support changing between wipes */ @@ -191,7 +192,8 @@ ges_video_transition_init (GESVideoTransition * self) { self->priv = ges_video_transition_get_instance_private (self); - self->priv->crossfade_control_source = NULL; + self->priv->fade_in_control_source = NULL; + self->priv->fade_out_control_source = NULL; self->priv->smpte_control_source = NULL; self->priv->smpte = NULL; self->priv->mixer_sink = NULL; @@ -229,9 +231,14 @@ ges_video_transition_dispose (GObject * object) GST_DEBUG ("disposing"); - if (priv->crossfade_control_source) { - gst_object_unref (priv->crossfade_control_source); - priv->crossfade_control_source = NULL; + if (priv->fade_in_control_source) { + gst_object_unref (priv->fade_in_control_source); + priv->fade_in_control_source = NULL; + } + + if (priv->fade_out_control_source) { + gst_object_unref (priv->fade_out_control_source); + priv->fade_out_control_source = NULL; } if (priv->smpte_control_source) { @@ -299,17 +306,14 @@ ges_video_transition_set_property (GObject * object, static GstTimedValueControlSource * set_interpolation (GstObject * element, GESVideoTransitionPrivate * priv, - const gchar * propname, gboolean absolute) + const gchar * propname) { GstControlSource *control_source; g_object_set (element, propname, (gfloat) 0.0, NULL); control_source = gst_interpolation_control_source_new (); - gst_object_add_control_binding (GST_OBJECT (element), - absolute ? gst_direct_control_binding_new_absolute (GST_OBJECT (element), - propname, control_source) : gst_direct_control_binding_new (GST_OBJECT (element), propname, control_source)); g_object_set (control_source, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); @@ -333,14 +337,8 @@ ges_video_transition_create_element (GESTrackElement * object) topbin = gst_bin_new ("transition-bin"); - iconva = - gst_parse_bin_from_description - ("videoconvert ! capsfilter caps=\"video/x-raw,format=BGRA\"", TRUE, - NULL); - iconvb = - gst_parse_bin_from_description - ("videoconvert ! capsfilter caps=\"video/x-raw,format=BGRA\"", TRUE, - NULL); + iconva = gst_element_factory_make ("videoconvert", "tr-csp-a"); + iconvb = gst_element_factory_make ("videoconvert", "tr-csp-b"); priv->positioner = gst_element_factory_make ("framepositioner", "frame_tagger"); g_object_set (priv->positioner, "zorder", @@ -350,10 +348,7 @@ ges_video_transition_create_element (GESTrackElement * object) gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, priv->positioner, oconv, NULL); - mixer = - g_object_new (GES_TYPE_SMART_MIXER, "name", - GES_TIMELINE_ELEMENT_NAME (self), NULL); - g_object_set (GES_SMART_MIXER (mixer)->mixer, "background", 3, NULL); + mixer = ges_smart_mixer_new (NULL); GES_SMART_MIXER (mixer)->disable_zorder_alpha = TRUE; gst_bin_add (GST_BIN (topbin), mixer); @@ -389,11 +384,12 @@ ges_video_transition_create_element (GESTrackElement * object) /* set up interpolation */ - priv->crossfade_control_source = - set_interpolation (GST_OBJECT (priv->mixer_sinka), priv, - "crossfade-ratio", TRUE); + priv->fade_out_control_source = + set_interpolation (GST_OBJECT (priv->mixer_sinka), priv, "alpha"); + priv->fade_in_control_source = + set_interpolation (GST_OBJECT (priv->mixer_sinkb), priv, "alpha"); priv->smpte_control_source = - set_interpolation (GST_OBJECT (priv->smpte), priv, "position", FALSE); + set_interpolation (GST_OBJECT (priv->smpte), priv, "position"); priv->mixer = gst_object_ref (mixer); if (priv->pending_type) @@ -461,12 +457,16 @@ ges_video_transition_update_control_sources (GESVideoTransition * self, GST_LOG ("updating controller"); if (type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE) { ges_video_transition_update_control_source - (priv->crossfade_control_source, duration, 1.0, 0.0); + (priv->fade_in_control_source, duration, 0.0, 1.0); + ges_video_transition_update_control_source + (priv->fade_out_control_source, duration, 1.0, 0.0); ges_video_transition_update_control_source (priv->smpte_control_source, duration, 0.0, 0.0); } else { ges_video_transition_update_control_source - (priv->crossfade_control_source, duration, -1.0, -1.0); + (priv->fade_in_control_source, duration, 1.0, 1.0); + ges_video_transition_update_control_source + (priv->fade_out_control_source, duration, 1.0, 1.0); ges_video_transition_update_control_source (priv->smpte_control_source, duration, 1.0, 0.0); }