2010-06-18 09:24:07 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
* Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
|
|
|
|
* 2010 Nokia Corporation
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:ges-track-video-transition
|
2010-07-01 14:48:45 +00:00
|
|
|
* @short_description: implements video crossfade transition
|
2010-06-18 09:24:07 +00:00
|
|
|
*/
|
|
|
|
|
2010-12-09 16:09:11 +00:00
|
|
|
#include <ges/ges.h>
|
2010-06-18 09:24:07 +00:00
|
|
|
#include "ges-internal.h"
|
|
|
|
|
2012-02-10 19:01:03 +00:00
|
|
|
#include <gst/controller/gstdirectcontrolbinding.h>
|
|
|
|
|
2010-06-18 09:24:07 +00:00
|
|
|
G_DEFINE_TYPE (GESTrackVideoTransition, ges_track_video_transition,
|
|
|
|
GES_TYPE_TRACK_TRANSITION);
|
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
struct _GESTrackVideoTransitionPrivate
|
|
|
|
{
|
2011-01-06 09:55:37 +00:00
|
|
|
GESVideoStandardTransitionType type;
|
|
|
|
|
|
|
|
/* these enable video interpolation */
|
2012-02-10 19:01:03 +00:00
|
|
|
GstControlSource *control_source;
|
2011-01-06 09:55:37 +00:00
|
|
|
|
|
|
|
/* so we can support changing between wipes */
|
|
|
|
GstElement *smpte;
|
|
|
|
GstElement *mixer;
|
|
|
|
GstPad *sinka;
|
|
|
|
GstPad *sinkb;
|
|
|
|
|
|
|
|
/* these will be different depending on whether smptealpha or alpha element
|
|
|
|
* is used */
|
|
|
|
gdouble start_value;
|
|
|
|
gdouble end_value;
|
2010-12-04 18:54:13 +00:00
|
|
|
};
|
|
|
|
|
2010-06-18 09:24:07 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
};
|
|
|
|
|
2010-07-14 11:29:23 +00:00
|
|
|
#define fast_element_link(a,b) gst_element_link_pads_full((a),"src",(b),"sink",GST_PAD_LINK_CHECK_NOTHING)
|
|
|
|
|
2010-06-18 13:54:37 +00:00
|
|
|
static GObject *link_element_to_mixer (GstElement * element,
|
|
|
|
GstElement * mixer);
|
|
|
|
|
|
|
|
static GObject *link_element_to_mixer_with_smpte (GstBin * bin,
|
|
|
|
GstElement * element, GstElement * mixer, gint type,
|
|
|
|
GstElement ** smpteref);
|
|
|
|
|
|
|
|
static void
|
2010-07-08 11:20:56 +00:00
|
|
|
ges_track_video_transition_duration_changed (GESTrackObject * self,
|
|
|
|
guint64 duration);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
2010-12-10 11:15:54 +00:00
|
|
|
static GstElement *ges_track_video_transition_create_element (GESTrackObject
|
2010-06-18 14:36:54 +00:00
|
|
|
* self);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
2010-06-18 09:24:07 +00:00
|
|
|
static void ges_track_video_transition_dispose (GObject * object);
|
|
|
|
|
|
|
|
static void ges_track_video_transition_finalize (GObject * object);
|
|
|
|
|
|
|
|
static void ges_track_video_transition_get_property (GObject * object, guint
|
|
|
|
property_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static void ges_track_video_transition_set_property (GObject * object, guint
|
|
|
|
property_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_class_init (GESTrackVideoTransitionClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class;
|
2010-07-08 11:20:56 +00:00
|
|
|
GESTrackObjectClass *toclass;
|
2010-06-18 09:24:07 +00:00
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTrackVideoTransitionPrivate));
|
|
|
|
|
2010-06-18 09:24:07 +00:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
2010-07-08 11:20:56 +00:00
|
|
|
toclass = GES_TRACK_OBJECT_CLASS (klass);
|
2010-06-18 09:24:07 +00:00
|
|
|
|
|
|
|
object_class->get_property = ges_track_video_transition_get_property;
|
|
|
|
object_class->set_property = ges_track_video_transition_set_property;
|
|
|
|
object_class->dispose = ges_track_video_transition_dispose;
|
|
|
|
object_class->finalize = ges_track_video_transition_finalize;
|
|
|
|
|
2010-07-08 11:20:56 +00:00
|
|
|
toclass->duration_changed = ges_track_video_transition_duration_changed;
|
2010-12-10 11:15:54 +00:00
|
|
|
toclass->create_element = ges_track_video_transition_create_element;
|
2010-06-18 09:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_init (GESTrackVideoTransition * self)
|
|
|
|
{
|
2010-12-04 18:54:13 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_TRACK_VIDEO_TRANSITION, GESTrackVideoTransitionPrivate);
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
self->priv->control_source = NULL;
|
|
|
|
self->priv->smpte = NULL;
|
|
|
|
self->priv->mixer = NULL;
|
|
|
|
self->priv->sinka = NULL;
|
|
|
|
self->priv->sinkb = NULL;
|
|
|
|
self->priv->type = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;
|
|
|
|
self->priv->start_value = 0.0;
|
|
|
|
self->priv->end_value = 0.0;
|
2010-06-18 09:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_dispose (GObject * object)
|
|
|
|
{
|
2010-06-18 14:22:21 +00:00
|
|
|
GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object);
|
2011-01-06 09:55:37 +00:00
|
|
|
GESTrackVideoTransitionPrivate *priv = self->priv;
|
2010-06-18 14:22:21 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("disposing");
|
|
|
|
GST_LOG ("mixer: %p smpte: %p sinka: %p sinkb: %p",
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->mixer, priv->smpte, priv->sinka, priv->sinkb);
|
|
|
|
|
2011-12-30 16:15:07 +00:00
|
|
|
if (priv->control_source) {
|
2011-01-06 09:55:37 +00:00
|
|
|
if (priv->control_source)
|
|
|
|
gst_object_unref (priv->control_source);
|
|
|
|
priv->control_source = NULL;
|
2010-06-18 14:22:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
if (priv->sinka && priv->sinkb) {
|
2010-06-18 14:22:21 +00:00
|
|
|
GST_DEBUG ("releasing request pads for mixer");
|
2011-01-06 09:55:37 +00:00
|
|
|
gst_element_release_request_pad (priv->mixer, priv->sinka);
|
|
|
|
gst_element_release_request_pad (priv->mixer, priv->sinkb);
|
|
|
|
gst_object_unref (priv->sinka);
|
|
|
|
gst_object_unref (priv->sinkb);
|
|
|
|
priv->sinka = NULL;
|
|
|
|
priv->sinkb = NULL;
|
2010-06-18 14:22:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
if (priv->mixer) {
|
2010-06-28 16:20:15 +00:00
|
|
|
GST_LOG ("unrefing mixer");
|
2011-01-06 09:55:37 +00:00
|
|
|
gst_object_unref (priv->mixer);
|
|
|
|
priv->mixer = NULL;
|
2010-06-28 16:20:15 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:24:07 +00:00
|
|
|
G_OBJECT_CLASS (ges_track_video_transition_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (ges_track_video_transition_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_get_property (GObject * object,
|
|
|
|
guint property_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
switch (property_id) {
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_video_transition_set_property (GObject * object,
|
|
|
|
guint property_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
switch (property_id) {
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-14 18:27:08 +00:00
|
|
|
static void
|
|
|
|
on_caps_set (GstPad * srca_pad, GParamSpec * pspec, GstElement * capsfilt)
|
|
|
|
{
|
2011-10-11 08:02:11 +00:00
|
|
|
GstCaps *orig_caps;
|
|
|
|
|
2011-12-30 16:15:07 +00:00
|
|
|
orig_caps = gst_pad_query_caps (srca_pad, NULL);
|
2011-10-11 08:02:11 +00:00
|
|
|
|
|
|
|
if (orig_caps) {
|
|
|
|
gint width, height;
|
|
|
|
const GstStructure *str;
|
|
|
|
GstCaps *size_caps;
|
2011-08-14 18:27:08 +00:00
|
|
|
|
|
|
|
/* Get width and height of first video */
|
2011-10-11 08:02:11 +00:00
|
|
|
str = gst_caps_get_structure (orig_caps, 0);
|
2011-08-14 18:27:08 +00:00
|
|
|
gst_structure_get_int (str, "width", &width);
|
|
|
|
gst_structure_get_int (str, "height", &height);
|
|
|
|
|
|
|
|
/* Set capsfilter to the size of the first video */
|
|
|
|
size_caps =
|
2012-02-10 19:35:28 +00:00
|
|
|
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, width,
|
2011-08-14 18:27:08 +00:00
|
|
|
"height", G_TYPE_INT, height, NULL);
|
|
|
|
g_object_set (capsfilt, "caps", size_caps, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 13:54:37 +00:00
|
|
|
static GstElement *
|
2010-12-10 11:15:54 +00:00
|
|
|
ges_track_video_transition_create_element (GESTrackObject * object)
|
2010-06-18 13:54:37 +00:00
|
|
|
{
|
2011-08-14 18:27:08 +00:00
|
|
|
GstElement *topbin, *iconva, *iconvb, *scalea, *scaleb, *capsfilt, *oconv;
|
2010-06-18 13:54:37 +00:00
|
|
|
GObject *target = NULL;
|
|
|
|
const gchar *propname = NULL;
|
|
|
|
GstElement *mixer = NULL;
|
2011-08-14 18:27:08 +00:00
|
|
|
GstPad *sinka_target, *sinkb_target, *src_target, *sinka, *sinkb, *src,
|
|
|
|
*srca_pad;
|
2010-06-18 14:22:21 +00:00
|
|
|
GESTrackVideoTransition *self;
|
2011-01-06 09:55:37 +00:00
|
|
|
GESTrackVideoTransitionPrivate *priv;
|
2012-02-10 19:01:03 +00:00
|
|
|
GstControlSource *control_source;
|
2010-06-18 14:22:21 +00:00
|
|
|
|
|
|
|
self = GES_TRACK_VIDEO_TRANSITION (object);
|
2011-01-06 09:55:37 +00:00
|
|
|
priv = self->priv;
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
GST_LOG ("creating a video bin");
|
|
|
|
|
|
|
|
topbin = gst_bin_new ("transition-bin");
|
2011-10-11 07:51:43 +00:00
|
|
|
iconva = gst_element_factory_make ("videoconvert", "tr-csp-a");
|
|
|
|
iconvb = gst_element_factory_make ("videoconvert", "tr-csp-b");
|
2011-08-14 18:27:08 +00:00
|
|
|
scalea = gst_element_factory_make ("videoscale", "vs-a");
|
|
|
|
scaleb = gst_element_factory_make ("videoscale", "vs-b");
|
|
|
|
capsfilt = gst_element_factory_make ("capsfilter", "capsfilt");
|
2011-10-11 07:51:43 +00:00
|
|
|
oconv = gst_element_factory_make ("videoconvert", "tr-csp-output");
|
2010-06-18 13:54:37 +00:00
|
|
|
|
2011-08-14 18:27:08 +00:00
|
|
|
gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, scalea, scaleb, capsfilt,
|
|
|
|
oconv, NULL);
|
|
|
|
|
2010-10-23 15:38:31 +00:00
|
|
|
/* Prefer videomixer2 to videomixer */
|
|
|
|
mixer = gst_element_factory_make ("videomixer2", NULL);
|
|
|
|
if (mixer == NULL)
|
|
|
|
mixer = gst_element_factory_make ("videomixer", NULL);
|
2011-12-30 16:15:07 +00:00
|
|
|
g_assert (mixer);
|
2010-06-18 13:54:37 +00:00
|
|
|
g_object_set (G_OBJECT (mixer), "background", 1, NULL);
|
|
|
|
gst_bin_add (GST_BIN (topbin), mixer);
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
if (priv->type != GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE) {
|
|
|
|
priv->sinka =
|
2010-06-28 16:23:37 +00:00
|
|
|
(GstPad *) link_element_to_mixer_with_smpte (GST_BIN (topbin), iconva,
|
2011-01-06 09:55:37 +00:00
|
|
|
mixer, priv->type, NULL);
|
|
|
|
priv->sinkb =
|
2010-06-28 16:23:37 +00:00
|
|
|
(GstPad *) link_element_to_mixer_with_smpte (GST_BIN (topbin), iconvb,
|
2011-01-06 09:55:37 +00:00
|
|
|
mixer, priv->type, &priv->smpte);
|
|
|
|
target = (GObject *) priv->smpte;
|
2010-06-18 13:54:37 +00:00
|
|
|
propname = "position";
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->start_value = 1.0;
|
|
|
|
priv->end_value = 0.0;
|
2010-06-18 13:54:37 +00:00
|
|
|
} else {
|
2011-08-14 18:27:08 +00:00
|
|
|
gst_element_link_pads_full (iconva, "src", scalea, "sink",
|
|
|
|
GST_PAD_LINK_CHECK_NOTHING);
|
|
|
|
gst_element_link_pads_full (iconvb, "src", scaleb, "sink",
|
|
|
|
GST_PAD_LINK_CHECK_NOTHING);
|
|
|
|
gst_element_link_pads_full (scaleb, "src", capsfilt, "sink",
|
|
|
|
GST_PAD_LINK_CHECK_NOTHING);
|
|
|
|
|
|
|
|
priv->sinka = (GstPad *) link_element_to_mixer (scalea, mixer);
|
|
|
|
priv->sinkb = (GstPad *) link_element_to_mixer (capsfilt, mixer);
|
2011-01-06 09:55:37 +00:00
|
|
|
target = (GObject *) priv->sinkb;
|
2010-06-18 13:54:37 +00:00
|
|
|
propname = "alpha";
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->start_value = 0.0;
|
|
|
|
priv->end_value = 1.0;
|
2010-06-18 13:54:37 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->mixer = gst_object_ref (mixer);
|
2010-06-28 16:23:37 +00:00
|
|
|
|
2010-07-14 11:29:23 +00:00
|
|
|
fast_element_link (mixer, oconv);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
sinka_target = gst_element_get_static_pad (iconva, "sink");
|
|
|
|
sinkb_target = gst_element_get_static_pad (iconvb, "sink");
|
|
|
|
src_target = gst_element_get_static_pad (oconv, "src");
|
|
|
|
|
|
|
|
sinka = gst_ghost_pad_new ("sinka", sinka_target);
|
|
|
|
sinkb = gst_ghost_pad_new ("sinkb", sinkb_target);
|
|
|
|
src = gst_ghost_pad_new ("src", src_target);
|
|
|
|
|
|
|
|
gst_element_add_pad (topbin, src);
|
|
|
|
gst_element_add_pad (topbin, sinka);
|
|
|
|
gst_element_add_pad (topbin, sinkb);
|
|
|
|
|
2011-08-14 18:27:08 +00:00
|
|
|
srca_pad = gst_element_get_static_pad (scalea, "src");
|
|
|
|
g_signal_connect (srca_pad, "notify::caps", G_CALLBACK (on_caps_set),
|
|
|
|
(GstElement *) capsfilt);
|
|
|
|
|
2010-06-18 13:54:37 +00:00
|
|
|
gst_object_unref (sinka_target);
|
|
|
|
gst_object_unref (sinkb_target);
|
|
|
|
gst_object_unref (src_target);
|
2011-08-14 18:27:08 +00:00
|
|
|
gst_object_unref (srca_pad);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
/* set up interpolation */
|
|
|
|
|
|
|
|
g_object_set (target, propname, (gfloat) 0.0, NULL);
|
|
|
|
|
|
|
|
control_source = gst_interpolation_control_source_new ();
|
2012-02-10 19:01:03 +00:00
|
|
|
gst_object_add_control_binding (GST_OBJECT (target),
|
|
|
|
gst_direct_control_binding_new (GST_OBJECT (target), propname,
|
|
|
|
control_source));
|
2011-12-30 16:15:07 +00:00
|
|
|
g_object_set (control_source, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->control_source = control_source;
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
return topbin;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GObject *
|
|
|
|
link_element_to_mixer (GstElement * element, GstElement * mixer)
|
|
|
|
{
|
|
|
|
GstPad *sinkpad = gst_element_get_request_pad (mixer, "sink_%d");
|
|
|
|
GstPad *srcpad = gst_element_get_static_pad (element, "src");
|
|
|
|
|
2010-07-14 11:29:23 +00:00
|
|
|
gst_pad_link_full (srcpad, sinkpad, GST_PAD_LINK_CHECK_NOTHING);
|
2010-06-18 13:54:37 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
|
|
|
return G_OBJECT (sinkpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GObject *
|
|
|
|
link_element_to_mixer_with_smpte (GstBin * bin, GstElement * element,
|
|
|
|
GstElement * mixer, gint type, GstElement ** smpteref)
|
|
|
|
{
|
2010-06-28 16:23:37 +00:00
|
|
|
GstPad *srcpad, *sinkpad;
|
2010-06-18 13:54:37 +00:00
|
|
|
GstElement *smptealpha = gst_element_factory_make ("smptealpha", NULL);
|
2010-06-28 16:23:37 +00:00
|
|
|
|
2010-06-18 13:54:37 +00:00
|
|
|
g_object_set (G_OBJECT (smptealpha),
|
|
|
|
"type", (gint) type, "invert", (gboolean) TRUE, NULL);
|
|
|
|
gst_bin_add (bin, smptealpha);
|
|
|
|
|
2010-07-14 11:29:23 +00:00
|
|
|
fast_element_link (element, smptealpha);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
/* crack */
|
|
|
|
if (smpteref) {
|
|
|
|
*smpteref = smptealpha;
|
|
|
|
}
|
|
|
|
|
2010-06-28 16:23:37 +00:00
|
|
|
srcpad = gst_element_get_static_pad (smptealpha, "src");
|
|
|
|
sinkpad = gst_element_get_request_pad (mixer, "sink_%d");
|
2010-07-14 11:29:23 +00:00
|
|
|
gst_pad_link_full (srcpad, sinkpad, GST_PAD_LINK_CHECK_NOTHING);
|
2010-06-28 16:23:37 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
|
|
|
return G_OBJECT (sinkpad);
|
2010-06-18 13:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-07-08 11:20:56 +00:00
|
|
|
ges_track_video_transition_duration_changed (GESTrackObject * object,
|
|
|
|
guint64 duration)
|
2010-06-18 13:54:37 +00:00
|
|
|
{
|
2010-12-16 14:00:46 +00:00
|
|
|
GstElement *gnlobj = ges_track_object_get_gnlobject (object);
|
2010-06-18 14:22:21 +00:00
|
|
|
GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object);
|
2011-01-06 09:55:37 +00:00
|
|
|
GESTrackVideoTransitionPrivate *priv = self->priv;
|
2011-12-30 16:15:07 +00:00
|
|
|
GstTimedValueControlSource *ts;
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
GST_LOG ("updating controller");
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
if (G_UNLIKELY (!gnlobj || !priv->control_source))
|
2010-06-18 13:54:37 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-30 16:15:07 +00:00
|
|
|
ts = GST_TIMED_VALUE_CONTROL_SOURCE (priv->control_source);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
2011-12-30 16:15:07 +00:00
|
|
|
GST_INFO ("duration: %" G_GUINT64_FORMAT, duration);
|
2010-06-18 13:54:37 +00:00
|
|
|
GST_LOG ("setting values on controller");
|
|
|
|
|
2011-12-30 16:15:07 +00:00
|
|
|
gst_timed_value_control_source_unset_all (ts);
|
|
|
|
gst_timed_value_control_source_set (ts, 0, priv->start_value);
|
|
|
|
gst_timed_value_control_source_set (ts, duration, priv->end_value);
|
2010-06-18 13:54:37 +00:00
|
|
|
|
|
|
|
GST_LOG ("done updating controller");
|
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
/**
|
|
|
|
* ges_track_video_transition_set_transition_type:
|
|
|
|
* @self: a #GESTrackVideoTransition
|
|
|
|
* @type: a #GESVideoStandardTransitionType
|
|
|
|
*
|
|
|
|
* Sets the transition being used to @type.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the transition type was properly changed, else %FALSE.
|
|
|
|
*/
|
2010-07-08 11:20:56 +00:00
|
|
|
gboolean
|
2011-01-06 09:55:37 +00:00
|
|
|
ges_track_video_transition_set_transition_type (GESTrackVideoTransition * self,
|
2010-12-09 16:09:11 +00:00
|
|
|
GESVideoStandardTransitionType type)
|
2010-06-18 14:22:21 +00:00
|
|
|
{
|
2011-01-06 09:55:37 +00:00
|
|
|
GESTrackVideoTransitionPrivate *priv = self->priv;
|
|
|
|
|
|
|
|
GST_DEBUG ("%p %d => %d", self, priv->type, type);
|
2010-07-06 16:54:33 +00:00
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
if (priv->type && (priv->type != type) &&
|
2010-12-09 16:09:11 +00:00
|
|
|
((type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE) ||
|
2011-01-06 09:55:37 +00:00
|
|
|
(priv->type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE))) {
|
2010-06-18 14:22:21 +00:00
|
|
|
GST_WARNING
|
2010-07-06 16:54:33 +00:00
|
|
|
("Changing between 'crossfade' and other types is not supported");
|
2010-07-08 11:20:56 +00:00
|
|
|
return FALSE;
|
2010-06-18 14:22:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
priv->type = type;
|
|
|
|
if (priv->smpte && (type != GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE))
|
|
|
|
g_object_set (priv->smpte, "type", (gint) type, NULL);
|
2010-07-08 11:20:56 +00:00
|
|
|
return TRUE;
|
2010-06-18 14:22:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 09:55:37 +00:00
|
|
|
/**
|
|
|
|
* ges_track_video_transition_get_transition_type:
|
|
|
|
* @trans: a #GESTrackVideoTransition
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the transition type used by @trans.
|
|
|
|
*
|
2011-01-06 09:55:37 +00:00
|
|
|
* Returns: The transition type used by @trans.
|
|
|
|
*/
|
|
|
|
GESVideoStandardTransitionType
|
|
|
|
ges_track_video_transition_get_transition_type (GESTrackVideoTransition * trans)
|
|
|
|
{
|
|
|
|
return trans->priv->type;
|
|
|
|
}
|
|
|
|
|
2011-01-10 13:28:35 +00:00
|
|
|
/**
|
|
|
|
* ges_track_video_transition_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GESTrackVideoTransition.
|
|
|
|
*
|
|
|
|
* Returns: The newly created #GESTrackVideoTransition, or %NULL if there was an
|
|
|
|
* error.
|
|
|
|
*/
|
2010-06-18 09:24:07 +00:00
|
|
|
GESTrackVideoTransition *
|
|
|
|
ges_track_video_transition_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (GES_TYPE_TRACK_VIDEO_TRANSITION, NULL);
|
|
|
|
}
|