2010-12-09 16:09:11 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
|
|
|
* 2009 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
|
2012-11-04 00:25:20 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-12-09 16:09:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2014-04-07 19:02:48 +00:00
|
|
|
* SECTION: gestransitionclip
|
2017-03-08 21:13:48 +00:00
|
|
|
* @title: GESTransitionClip
|
2014-02-26 03:17:36 +00:00
|
|
|
* @short_description: Transition from one clip to another in a GESLayer
|
2010-12-09 16:09:11 +00:00
|
|
|
*
|
|
|
|
* Creates an object that mixes together the two underlying objects, A and B.
|
|
|
|
* The A object is assumed to have a higher prioirity (lower number) than the
|
|
|
|
* B object. At the transition in point, only A will be visible, and by the
|
2012-11-26 20:27:24 +00:00
|
|
|
* end only B will be visible.
|
|
|
|
*
|
2010-12-09 16:09:11 +00:00
|
|
|
* The shape of the video transition depends on the value of the "vtype"
|
|
|
|
* property. The default value is "crossfade". For audio, only "crossfade" is
|
|
|
|
* supported.
|
|
|
|
*
|
2012-11-26 20:27:24 +00:00
|
|
|
* The ID of the ExtractableType is the nickname of the vtype property value. Note
|
|
|
|
* that this value can be changed after creation and the GESExtractable.asset value
|
|
|
|
* will be updated when needed.
|
2010-12-09 16:09:11 +00:00
|
|
|
*/
|
2018-09-24 14:41:24 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2010-12-09 16:09:11 +00:00
|
|
|
|
|
|
|
#include <ges/ges.h>
|
|
|
|
#include "ges-internal.h"
|
|
|
|
|
2013-01-25 18:16:21 +00:00
|
|
|
struct _GESTransitionClipPrivate
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
2013-01-27 15:41:51 +00:00
|
|
|
GSList *video_transitions;
|
2012-11-26 20:27:24 +00:00
|
|
|
|
|
|
|
const gchar *vtype_name;
|
2010-12-09 16:09:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_VTYPE = 5,
|
|
|
|
};
|
|
|
|
|
2013-02-10 00:49:16 +00:00
|
|
|
static GESTrackElement *_create_track_element (GESClip
|
2012-12-20 23:23:54 +00:00
|
|
|
* self, GESTrackType type);
|
2013-03-01 01:27:50 +00:00
|
|
|
static void _child_added (GESContainer * container,
|
|
|
|
GESTimelineElement * element);
|
|
|
|
static void _child_removed (GESContainer * container,
|
|
|
|
GESTimelineElement * element);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2012-11-26 20:27:24 +00:00
|
|
|
/* Internal methods */
|
2010-12-09 16:09:11 +00:00
|
|
|
static void
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_update_vtype_internal (GESClip *
|
2012-11-26 20:27:24 +00:00
|
|
|
self, GESVideoStandardTransitionType value, gboolean set_asset)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
2011-04-27 13:11:44 +00:00
|
|
|
GSList *tmp;
|
2012-11-26 20:27:24 +00:00
|
|
|
guint index;
|
|
|
|
GEnumClass *enum_class;
|
|
|
|
const gchar *asset_id = NULL;
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *trself = GES_TRANSITION_CLIP (self);
|
2011-04-27 13:11:44 +00:00
|
|
|
|
2012-11-26 20:27:24 +00:00
|
|
|
enum_class = g_type_class_peek (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
for (index = 0; index < enum_class->n_values; index++) {
|
|
|
|
if (enum_class->values[index].value == value) {
|
|
|
|
asset_id = enum_class->values[index].value_nick;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (asset_id == NULL) {
|
|
|
|
GST_WARNING_OBJECT (self, "Wrong transition type value: %i can not set it",
|
|
|
|
value);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-27 15:41:51 +00:00
|
|
|
for (tmp = trself->priv->video_transitions; tmp; tmp = tmp->next) {
|
|
|
|
if (!ges_video_transition_set_transition_type
|
|
|
|
(GES_VIDEO_TRANSITION (tmp->data), value))
|
2011-04-27 13:11:44 +00:00
|
|
|
return;
|
2010-12-09 16:09:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trself->vtype = value;
|
2012-11-26 20:27:24 +00:00
|
|
|
trself->priv->vtype_name = asset_id;
|
|
|
|
|
|
|
|
if (set_asset) {
|
2019-01-14 14:38:19 +00:00
|
|
|
GESAsset *asset =
|
|
|
|
ges_asset_request (GES_TYPE_TRANSITION_CLIP, asset_id, NULL);
|
|
|
|
|
2019-01-18 20:25:11 +00:00
|
|
|
/* We already checked the value, so we can be sure no error occurred */
|
2019-01-14 14:38:19 +00:00
|
|
|
ges_extractable_set_asset (GES_EXTRACTABLE (self), asset);
|
|
|
|
gst_object_unref (asset);
|
2012-11-26 20:27:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GESExtractable interface overrides */
|
2020-02-07 12:39:39 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS; /* Start ignoring GParameter deprecation */
|
2012-11-26 20:27:24 +00:00
|
|
|
static GParameter *
|
|
|
|
extractable_get_parameters_from_id (const gchar * id, guint * n_params)
|
|
|
|
{
|
|
|
|
GEnumClass *enum_class =
|
|
|
|
g_type_class_peek (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
GParameter *params = g_new0 (GParameter, 1);
|
2020-02-07 12:39:39 +00:00
|
|
|
|
2012-11-26 20:27:24 +00:00
|
|
|
GEnumValue *value = g_enum_get_value_by_nick (enum_class, id);
|
|
|
|
|
2012-12-29 20:52:42 +00:00
|
|
|
params[0].name = "vtype";
|
2012-11-26 20:27:24 +00:00
|
|
|
g_value_init (¶ms[0].value, GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
g_value_set_enum (¶ms[0].value, value->value);
|
|
|
|
*n_params = 1;
|
|
|
|
|
|
|
|
return params;
|
2010-12-09 16:09:11 +00:00
|
|
|
}
|
|
|
|
|
2020-02-07 12:39:39 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS; /* End ignoring GParameter deprecation */
|
2012-11-26 20:27:24 +00:00
|
|
|
static gchar *
|
|
|
|
extractable_check_id (GType type, const gchar * id)
|
|
|
|
{
|
|
|
|
guint index;
|
|
|
|
GEnumClass *enum_class;
|
|
|
|
enum_class = g_type_class_peek (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
|
|
|
|
for (index = 0; index < enum_class->n_values; index++) {
|
|
|
|
if (g_strcmp0 (enum_class->values[index].value_nick, id) == 0)
|
|
|
|
return g_strdup (id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
extractable_get_id (GESExtractable * self)
|
|
|
|
{
|
|
|
|
guint index;
|
|
|
|
GEnumClass *enum_class;
|
2013-01-25 18:16:21 +00:00
|
|
|
guint value = GES_TRANSITION_CLIP (self)->vtype;
|
2012-11-26 20:27:24 +00:00
|
|
|
|
|
|
|
enum_class = g_type_class_peek (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
for (index = 0; index < enum_class->n_values; index++) {
|
|
|
|
if (enum_class->values[index].value == value)
|
|
|
|
return g_strdup (enum_class->values[index].value_nick);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:44:12 +00:00
|
|
|
static gboolean
|
2012-11-26 20:27:24 +00:00
|
|
|
extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
|
|
|
{
|
|
|
|
GEnumClass *enum_class;
|
|
|
|
GESVideoStandardTransitionType value;
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *trans = GES_TRANSITION_CLIP (self);
|
2012-11-26 20:27:24 +00:00
|
|
|
const gchar *vtype = ges_asset_get_id (asset);
|
2020-04-07 14:47:07 +00:00
|
|
|
GESAsset *prev_asset = ges_extractable_get_asset (self);
|
|
|
|
GList *tmp;
|
2012-11-26 20:27:24 +00:00
|
|
|
|
2014-09-26 15:44:12 +00:00
|
|
|
if (!(ges_clip_get_supported_formats (GES_CLIP (self)) &
|
|
|
|
GES_TRACK_TYPE_VIDEO)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-11-26 20:27:24 +00:00
|
|
|
/* Update the transition type if we actually changed it */
|
|
|
|
if (g_strcmp0 (vtype, trans->priv->vtype_name)) {
|
|
|
|
guint index;
|
|
|
|
|
|
|
|
value = GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE;
|
|
|
|
enum_class = g_type_class_peek (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE);
|
|
|
|
|
|
|
|
/* Find the in value in use */
|
|
|
|
for (index = 0; index < enum_class->n_values; index++) {
|
|
|
|
if (g_strcmp0 (enum_class->values[index].value_nick, vtype) == 0) {
|
|
|
|
value = enum_class->values[index].value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_update_vtype_internal (GES_CLIP (self), value, FALSE);
|
2012-11-26 20:27:24 +00:00
|
|
|
}
|
2014-09-26 15:44:12 +00:00
|
|
|
|
2020-04-07 14:47:07 +00:00
|
|
|
if (!prev_asset)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
for (tmp = GES_CONTAINER_CHILDREN (self); tmp; tmp = tmp->next) {
|
|
|
|
if (ges_track_element_get_creator_asset (tmp->data) == prev_asset)
|
|
|
|
ges_track_element_set_creator_asset (tmp->data, asset);
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:44:12 +00:00
|
|
|
return TRUE;
|
2012-11-26 20:27:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_extractable_interface_init (GESExtractableInterface * iface)
|
|
|
|
{
|
|
|
|
iface->check_id = (GESExtractableCheckId) extractable_check_id;
|
|
|
|
iface->get_id = extractable_get_id;
|
|
|
|
iface->get_parameters_from_id = extractable_get_parameters_from_id;
|
|
|
|
iface->can_update_asset = TRUE;
|
2014-09-26 15:44:12 +00:00
|
|
|
iface->set_asset_full = extractable_set_asset;
|
2012-11-26 20:27:24 +00:00
|
|
|
}
|
|
|
|
|
2013-01-25 18:16:21 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GESTransitionClip,
|
|
|
|
ges_transition_clip, GES_TYPE_BASE_TRANSITION_CLIP,
|
2018-09-06 01:55:02 +00:00
|
|
|
G_ADD_PRIVATE (GESTransitionClip)
|
2012-11-26 20:27:24 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
|
|
|
|
ges_extractable_interface_init));
|
|
|
|
|
2010-12-09 16:09:11 +00:00
|
|
|
static void
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_get_property (GObject * object,
|
2010-12-09 16:09:11 +00:00
|
|
|
guint property_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *self = GES_TRANSITION_CLIP (object);
|
2010-12-09 16:09:11 +00:00
|
|
|
switch (property_id) {
|
|
|
|
case PROP_VTYPE:
|
|
|
|
g_value_set_enum (value, self->vtype);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_set_property (GObject * object,
|
2010-12-09 16:09:11 +00:00
|
|
|
guint property_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-01-20 15:42:29 +00:00
|
|
|
GESClip *self = GES_CLIP (object);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_VTYPE:
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_update_vtype_internal (self,
|
2012-11-26 20:27:24 +00:00
|
|
|
g_value_get_enum (value), TRUE);
|
2010-12-09 16:09:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-28 16:16:36 +00:00
|
|
|
static gboolean
|
|
|
|
_lookup_child (GESTimelineElement * self, const gchar * prop_name,
|
|
|
|
GObject ** child, GParamSpec ** pspec)
|
|
|
|
{
|
|
|
|
GESTimelineElementClass *element_klass =
|
|
|
|
g_type_class_peek (GES_TYPE_TIMELINE_ELEMENT);
|
|
|
|
|
|
|
|
/* Bypass the container implementation as we handle children properties directly */
|
|
|
|
/* FIXME Implement a syntax to precisely get properties by path */
|
|
|
|
if (element_klass->lookup_child (self, prop_name, child, pspec))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-09 16:09:11 +00:00
|
|
|
static void
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_class_init (GESTransitionClipClass * klass)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2013-01-20 15:42:29 +00:00
|
|
|
GESClipClass *timobj_class = GES_CLIP_CLASS (klass);
|
2013-03-01 01:27:50 +00:00
|
|
|
GESContainerClass *container_class = GES_CONTAINER_CLASS (klass);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-01-25 18:16:21 +00:00
|
|
|
object_class->get_property = ges_transition_clip_get_property;
|
|
|
|
object_class->set_property = ges_transition_clip_set_property;
|
2010-12-09 16:09:11 +00:00
|
|
|
|
|
|
|
/**
|
2013-01-25 18:16:21 +00:00
|
|
|
* GESTransitionClip:vtype:
|
2010-12-09 16:09:11 +00:00
|
|
|
*
|
2011-01-06 11:06:24 +00:00
|
|
|
* a #GESVideoStandardTransitionType representing the wipe to use
|
2010-12-09 16:09:11 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_VTYPE,
|
|
|
|
g_param_spec_enum ("vtype", "VType",
|
|
|
|
"The SMPTE video wipe to use, or 0 for crossfade",
|
|
|
|
GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE,
|
|
|
|
GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2018-07-28 16:16:36 +00:00
|
|
|
GES_TIMELINE_ELEMENT_CLASS (klass)->lookup_child = _lookup_child;
|
2013-03-01 01:27:50 +00:00
|
|
|
container_class->child_added = _child_added;
|
|
|
|
container_class->child_removed = _child_removed;
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-02-10 00:49:16 +00:00
|
|
|
timobj_class->create_track_element = _create_track_element;
|
2010-12-09 16:09:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-25 18:16:21 +00:00
|
|
|
ges_transition_clip_init (GESTransitionClip * self)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
|
|
|
|
2018-09-06 01:55:02 +00:00
|
|
|
self->priv = ges_transition_clip_get_instance_private (self);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
|
|
|
self->vtype = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;
|
2012-11-26 20:27:24 +00:00
|
|
|
self->priv->vtype_name = NULL;
|
2010-12-09 16:09:11 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 13:11:44 +00:00
|
|
|
static void
|
2013-03-01 01:27:50 +00:00
|
|
|
_child_removed (GESContainer * container, GESTimelineElement * element)
|
2011-04-27 13:11:44 +00:00
|
|
|
{
|
2013-03-01 01:27:50 +00:00
|
|
|
GESTransitionClipPrivate *priv = GES_TRANSITION_CLIP (container)->priv;
|
2011-04-27 13:11:44 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
/* If this is called, we should be sure the trackelement exists */
|
2013-03-01 01:27:50 +00:00
|
|
|
if (GES_IS_VIDEO_TRANSITION (element)) {
|
|
|
|
GST_DEBUG_OBJECT (container, "%" GST_PTR_FORMAT " removed", element);
|
|
|
|
priv->video_transitions = g_slist_remove (priv->video_transitions, element);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (element);
|
2011-04-27 13:11:44 +00:00
|
|
|
}
|
2020-03-10 11:38:58 +00:00
|
|
|
/* call parent method */
|
|
|
|
GES_CONTAINER_CLASS (ges_transition_clip_parent_class)->child_removed
|
|
|
|
(container, element);
|
2011-04-27 13:11:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-01 01:27:50 +00:00
|
|
|
_child_added (GESContainer * container, GESTimelineElement * element)
|
2011-04-27 13:11:44 +00:00
|
|
|
{
|
2013-03-01 01:27:50 +00:00
|
|
|
GESTransitionClipPrivate *priv = GES_TRANSITION_CLIP (container)->priv;
|
2011-04-27 13:11:44 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
if (GES_IS_VIDEO_TRANSITION (element)) {
|
2018-07-28 16:16:36 +00:00
|
|
|
GObjectClass *eklass = G_OBJECT_GET_CLASS (element);
|
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
GST_DEBUG_OBJECT (container, "%" GST_PTR_FORMAT " added", element);
|
2013-01-27 15:41:51 +00:00
|
|
|
priv->video_transitions =
|
2013-03-16 22:05:04 +00:00
|
|
|
g_slist_prepend (priv->video_transitions, gst_object_ref (element));
|
2018-07-28 16:16:36 +00:00
|
|
|
|
|
|
|
ges_timeline_element_add_child_property (GES_TIMELINE_ELEMENT (container),
|
|
|
|
g_object_class_find_property (eklass, "invert"), G_OBJECT (element));
|
|
|
|
ges_timeline_element_add_child_property (GES_TIMELINE_ELEMENT (container),
|
|
|
|
g_object_class_find_property (eklass, "border"), G_OBJECT (element));
|
2011-04-27 13:11:44 +00:00
|
|
|
}
|
2020-03-10 11:38:58 +00:00
|
|
|
/* call parent method */
|
|
|
|
GES_CONTAINER_CLASS (ges_transition_clip_parent_class)->child_added
|
|
|
|
(container, element);
|
2011-04-27 13:11:44 +00:00
|
|
|
}
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
static GESTrackElement *
|
2013-02-15 02:34:48 +00:00
|
|
|
_create_track_element (GESClip * clip, GESTrackType type)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTransitionClip *transition = (GESTransitionClip *) clip;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *res = NULL;
|
2011-12-01 03:33:38 +00:00
|
|
|
GESTrackType supportedformats;
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-01-27 15:31:10 +00:00
|
|
|
GST_DEBUG ("Creating a GESTransition");
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
supportedformats = ges_clip_get_supported_formats (clip);
|
2012-12-20 23:23:54 +00:00
|
|
|
if (type == GES_TRACK_TYPE_VIDEO) {
|
2012-02-02 18:29:30 +00:00
|
|
|
if (supportedformats == GES_TRACK_TYPE_UNKNOWN ||
|
|
|
|
supportedformats & GES_TRACK_TYPE_VIDEO) {
|
2013-01-27 15:41:51 +00:00
|
|
|
GESVideoTransition *trans;
|
2012-02-02 18:29:30 +00:00
|
|
|
|
2013-01-27 15:41:51 +00:00
|
|
|
trans = ges_video_transition_new ();
|
|
|
|
ges_video_transition_set_transition_type (trans, transition->vtype);
|
2012-02-02 18:29:30 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
res = GES_TRACK_ELEMENT (trans);
|
2012-02-02 18:29:30 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Not creating transition as video track not on"
|
|
|
|
" supportedformats");
|
|
|
|
}
|
|
|
|
|
2012-12-20 23:23:54 +00:00
|
|
|
} else if (type == GES_TRACK_TYPE_AUDIO) {
|
2012-02-02 18:29:30 +00:00
|
|
|
|
|
|
|
if (supportedformats == GES_TRACK_TYPE_UNKNOWN ||
|
|
|
|
supportedformats & GES_TRACK_TYPE_AUDIO)
|
2013-01-27 15:44:13 +00:00
|
|
|
res = GES_TRACK_ELEMENT (ges_audio_transition_new ());
|
2012-02-02 18:29:30 +00:00
|
|
|
else
|
|
|
|
GST_DEBUG ("Not creating transition as audio track"
|
|
|
|
" not on supportedformats");
|
|
|
|
|
|
|
|
} else
|
2010-12-09 16:09:11 +00:00
|
|
|
GST_WARNING ("Transitions don't handle this track type");
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-25 18:16:21 +00:00
|
|
|
* ges_transition_clip_new:
|
2010-12-09 16:09:11 +00:00
|
|
|
* @vtype: the type of transition to create
|
|
|
|
*
|
2013-01-25 18:16:21 +00:00
|
|
|
* Creates a new #GESTransitionClip.
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2016-05-14 23:04:17 +00:00
|
|
|
* Returns: (transfer floating) (nullable): a newly created #GESTransitionClip,
|
|
|
|
* or %NULL if something went wrong.
|
2010-12-09 16:09:11 +00:00
|
|
|
*/
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *
|
|
|
|
ges_transition_clip_new (GESVideoStandardTransitionType vtype)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
2013-03-03 14:50:10 +00:00
|
|
|
GEnumValue *value;
|
|
|
|
GEnumClass *klass;
|
|
|
|
GESTransitionClip *ret = NULL;
|
|
|
|
|
|
|
|
klass =
|
|
|
|
G_ENUM_CLASS (g_type_class_ref (GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE));
|
|
|
|
if (!klass) {
|
|
|
|
GST_ERROR ("Could not find the StandarTransitionType enum class");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = g_enum_get_value (klass, vtype);
|
|
|
|
if (!value) {
|
|
|
|
GST_ERROR ("Could not find enum value for %i", vtype);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = ges_transition_clip_new_for_nick (((gchar *) value->value_nick));
|
|
|
|
g_type_class_unref (klass);
|
|
|
|
|
|
|
|
return ret;
|
2010-12-09 16:09:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-25 18:16:21 +00:00
|
|
|
* ges_transition_clip_new_for_nick:
|
2010-12-09 16:09:11 +00:00
|
|
|
* @nick: a string representing the type of transition to create
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2013-01-25 18:16:21 +00:00
|
|
|
* Creates a new #GESTransitionClip for the provided @nick.
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2016-05-14 23:04:17 +00:00
|
|
|
* Returns: (transfer floating) (nullable): The newly created #GESTransitionClip,
|
|
|
|
* or %NULL if something went wrong
|
2010-12-09 16:09:11 +00:00
|
|
|
*/
|
|
|
|
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *
|
|
|
|
ges_transition_clip_new_for_nick (gchar * nick)
|
2010-12-09 16:09:11 +00:00
|
|
|
{
|
2013-01-25 18:16:21 +00:00
|
|
|
GESTransitionClip *ret = NULL;
|
2013-03-03 14:50:10 +00:00
|
|
|
GESAsset *asset = ges_asset_request (GES_TYPE_TRANSITION_CLIP, nick, NULL);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-03-03 14:50:10 +00:00
|
|
|
if (asset != NULL) {
|
|
|
|
ret = GES_TRANSITION_CLIP (ges_asset_extract (asset, NULL));
|
2010-12-09 16:09:11 +00:00
|
|
|
|
2013-03-03 14:50:10 +00:00
|
|
|
gst_object_unref (asset);
|
|
|
|
} else
|
|
|
|
GST_WARNING ("No asset found for nick: %s", nick);
|
2010-12-09 16:09:11 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|