mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Make GESTrackEffect abstract and move its implementation to GESTrackParseLaunchEffect
test: update the effect test suite
This commit is contained in:
parent
1afc342e99
commit
ea3625f4b9
12 changed files with 400 additions and 253 deletions
|
@ -43,6 +43,7 @@ platform as well as Windows. It is released under the GNU Library General Public
|
|||
<xi:include href="xml/ges-track.xml"/>
|
||||
<xi:include href="xml/ges-track-object.xml"/>
|
||||
<xi:include href="xml/ges-track-source.xml"/>
|
||||
<xi:include href="xml/ges-track-effect.xml"/>
|
||||
<xi:include href="xml/ges-track-operation.xml"/>
|
||||
<xi:include href="xml/ges-timeline-transition.xml"/>
|
||||
</chapter>
|
||||
|
@ -68,7 +69,7 @@ platform as well as Windows. It is released under the GNU Library General Public
|
|||
<xi:include href="xml/ges-track-video-transition.xml"/>
|
||||
<xi:include href="xml/ges-track-audio-transition.xml"/>
|
||||
<xi:include href="xml/ges-track-image-source.xml"/>
|
||||
<xi:include href="xml/ges-track-effect.xml"/>
|
||||
<xi:include href="xml/ges-track-parse-launch-effect.xml"/>
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
|
|
|
@ -729,7 +729,6 @@ ges_keyfile_formatter_get_type
|
|||
<FILE>ges-track-effect</FILE>
|
||||
<TITLE>GESTrackEffect</TITLE>
|
||||
GESTrackEffect
|
||||
ges_track_effect_new_from_bin_desc
|
||||
<SUBSECTION Standard>
|
||||
GESTrackEffectClass
|
||||
GESTrackEffectPrivate
|
||||
|
@ -741,3 +740,20 @@ GES_TRACK_EFFECT_GET_CLASS
|
|||
GES_TYPE_TRACK_EFFECT
|
||||
ges_track_effect_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>ges-track-parse-launch-effect</FILE>
|
||||
<TITLE>GESTrackParseLaunchEffect</TITLE>
|
||||
GESTrackParseLaunchEffect
|
||||
ges_track_parse_launch_effect_new_from_bin_desc
|
||||
<SUBSECTION Standard>
|
||||
GESTrackParseLaunchEffectClass
|
||||
GESTrackParseLaunchEffectPrivate
|
||||
GES_IS_TRACK_PARSE_LAUNCH_EFFECT
|
||||
GES_IS_TRACK_PARSE_LAUNCH_EFFECT_CLASS
|
||||
GES_TRACK_PARSE_LAUNCH_EFFECT
|
||||
GES_TRACK_PARSE_LAUNCH_EFFECT_CLASS
|
||||
GES_TRACK_PARSE_LAUNCH_EFFECT_GET_CLASS
|
||||
GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT
|
||||
ges_track_parse_launch_effect_get_type
|
||||
</SECTION>
|
||||
|
|
|
@ -28,6 +28,7 @@ ges_track_get_type
|
|||
ges_track_image_source_get_type
|
||||
ges_track_object_get_type
|
||||
ges_track_effect_get_type
|
||||
ges_track_parse_launch_effect_get_type
|
||||
ges_track_operation_get_type
|
||||
ges_track_source_get_type
|
||||
ges_track_text_overlay_get_type
|
||||
|
|
|
@ -41,6 +41,7 @@ libges_@GST_MAJORMINOR@_la_SOURCES = \
|
|||
ges-track-title-source.c \
|
||||
ges-track-text-overlay.c \
|
||||
ges-track-effect.c \
|
||||
ges-track-parse-launch-effect.c \
|
||||
ges-screenshot.c \
|
||||
ges-formatter.c \
|
||||
ges-keyfile-formatter.c \
|
||||
|
@ -69,6 +70,7 @@ libges_@GST_MAJORMINOR@include_HEADERS = \
|
|||
ges-timeline-overlay.h \
|
||||
ges-timeline-text-overlay.h \
|
||||
ges-track-effect.h \
|
||||
ges-track-parse-launch-effect.h \
|
||||
ges-track.h \
|
||||
ges-track-object.h \
|
||||
ges-track-source.h \
|
||||
|
|
|
@ -138,7 +138,7 @@ ges_tl_effect_create_track_object (GESTimelineObject * self, GESTrack * track)
|
|||
if (track->type == GES_TRACK_TYPE_VIDEO) {
|
||||
if (effect->priv->video_bin_description != NULL) {
|
||||
GST_DEBUG ("Creating a GESTrackEffect for the video track");
|
||||
return GES_TRACK_OBJECT (ges_track_effect_new_from_bin_desc
|
||||
return GES_TRACK_OBJECT (ges_track_parse_launch_effect_new_from_bin_desc
|
||||
(effect->priv->video_bin_description));
|
||||
}
|
||||
GST_DEBUG ("Can't create the track Object, the\
|
||||
|
@ -147,7 +147,7 @@ ges_tl_effect_create_track_object (GESTimelineObject * self, GESTrack * track)
|
|||
if (track->type == GES_TRACK_TYPE_AUDIO) {
|
||||
if (effect->priv->audio_bin_description != NULL) {
|
||||
GST_DEBUG ("Creating a GESTrackEffect for the audio track");
|
||||
return GES_TRACK_OBJECT (ges_track_effect_new_from_bin_desc
|
||||
return GES_TRACK_OBJECT (ges_track_parse_launch_effect_new_from_bin_desc
|
||||
(effect->priv->audio_bin_description));
|
||||
}
|
||||
GST_DEBUG ("Can't create the track Object, the\
|
||||
|
|
|
@ -28,83 +28,18 @@
|
|||
#include "ges-track-object.h"
|
||||
#include "ges-track-effect.h"
|
||||
|
||||
G_DEFINE_TYPE (GESTrackEffect, ges_track_effect, GES_TYPE_TRACK_OPERATION);
|
||||
|
||||
static void ges_track_effect_dispose (GObject * object);
|
||||
static void ges_track_effect_finalize (GObject * object);
|
||||
static GstElement *ges_track_effect_create_element (GESTrackObject * self);
|
||||
static GHashTable *ges_track_effect_get_props_hashtable (GESTrackObject * self);
|
||||
static GHashTable
|
||||
* ges_track_effect_get_props_hashtable_from_bin_desc (GESTrackObject *
|
||||
self);
|
||||
G_DEFINE_ABSTRACT_TYPE (GESTrackEffect, ges_track_effect,
|
||||
GES_TYPE_TRACK_OPERATION);
|
||||
|
||||
struct _GESTrackEffectPrivate
|
||||
{
|
||||
gchar *bin_description;
|
||||
void *nothing;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BIN_DESCRIPTION,
|
||||
};
|
||||
|
||||
static void
|
||||
ges_track_effect_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_effect_set_property (GObject * object,
|
||||
guint property_id, const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GESTrackEffect *self = GES_TRACK_EFFECT (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_BIN_DESCRIPTION:
|
||||
self->priv->bin_description = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_effect_class_init (GESTrackEffectClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GESTrackObjectClass *obj_bg_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
obj_bg_class = GES_TRACK_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GESTrackEffectPrivate));
|
||||
|
||||
object_class->get_property = ges_track_effect_get_property;
|
||||
object_class->set_property = ges_track_effect_set_property;
|
||||
object_class->dispose = ges_track_effect_dispose;
|
||||
object_class->finalize = ges_track_effect_finalize;
|
||||
|
||||
obj_bg_class->create_element = ges_track_effect_create_element;
|
||||
obj_bg_class->get_props_hastable = ges_track_effect_get_props_hashtable;
|
||||
|
||||
/**
|
||||
* GESTrackEffect:bin_description:
|
||||
*
|
||||
* The description of the effect bin with a gst-launch-style
|
||||
* pipeline description.
|
||||
* exemple: videobalance saturation=1.5 hue=+0.5
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_BIN_DESCRIPTION,
|
||||
g_param_spec_string ("bin-description",
|
||||
"bin description",
|
||||
"Bin description of the effect",
|
||||
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -114,164 +49,3 @@ ges_track_effect_init (GESTrackEffect * self)
|
|||
G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TRACK_EFFECT,
|
||||
GESTrackEffectPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_effect_dispose (GObject * object)
|
||||
{
|
||||
G_OBJECT_CLASS (ges_track_effect_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_effect_finalize (GObject * object)
|
||||
{
|
||||
GESTrackEffect *self = GES_TRACK_EFFECT (object);
|
||||
|
||||
if (self->priv->bin_description)
|
||||
g_free (self->priv->bin_description);
|
||||
|
||||
G_OBJECT_CLASS (ges_track_effect_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/* This function is more for testing puposes */
|
||||
static GHashTable *
|
||||
ges_track_effect_get_props_hashtable_from_bin_desc (GESTrackObject * self)
|
||||
{
|
||||
gpointer data;
|
||||
GstIterator *it;
|
||||
GParamSpec **parray;
|
||||
GObjectClass *class;
|
||||
guint i, nb_specs;
|
||||
const gchar *name, *klass;
|
||||
GstElementFactory *factory;
|
||||
GstElement *child, *element;
|
||||
gchar **categories, *categorie;
|
||||
|
||||
gboolean done = FALSE;
|
||||
GHashTable *ret = NULL;
|
||||
|
||||
element = ges_track_object_get_element (self);
|
||||
|
||||
ret = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||
|
||||
/* We go over child elements recursivly, and add writable properties to the
|
||||
* hashtable
|
||||
* FIXME: Add a blacklist of properties */
|
||||
it = gst_bin_iterate_recurse (GST_BIN (element));
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (it, &data)) {
|
||||
case GST_ITERATOR_OK:
|
||||
child = GST_ELEMENT_CAST (data);
|
||||
factory = gst_element_get_factory (child);
|
||||
klass = gst_element_factory_get_klass (factory);
|
||||
categories = g_strsplit (klass, "/", 0);
|
||||
|
||||
i = 0;
|
||||
for (categorie = categories[0]; categorie;) {
|
||||
if (g_strcmp0 (categorie, "Effect") == 0) {
|
||||
|
||||
class = G_OBJECT_GET_CLASS (child);
|
||||
parray = g_object_class_list_properties (class, &nb_specs);
|
||||
for (i = 0; i < nb_specs; i++) {
|
||||
if (parray[i]->flags & G_PARAM_WRITABLE) {
|
||||
name = g_param_spec_get_name (parray[i]);
|
||||
g_hash_table_insert (ret,
|
||||
g_strconcat (G_OBJECT_CLASS_NAME (class),
|
||||
"-", name, NULL), g_object_ref (child));
|
||||
}
|
||||
}
|
||||
GST_DEBUG ("%i configurable properties added to %p", child,
|
||||
nb_specs);
|
||||
gst_object_unref (child);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
categorie = categories[i];
|
||||
}
|
||||
g_strfreev (categories);
|
||||
break;
|
||||
|
||||
case GST_ITERATOR_RESYNC:
|
||||
GST_DEBUG ("iterator resync");
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
|
||||
case GST_ITERATOR_DONE:
|
||||
GST_DEBUG ("iterator done");
|
||||
done = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gst_iterator_free (it);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Virtual methods */
|
||||
static GHashTable *
|
||||
ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
||||
{
|
||||
|
||||
if (GES_TRACK_EFFECT (self)->priv->bin_description)
|
||||
return ges_track_effect_get_props_hashtable_from_bin_desc (self);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GstElement *
|
||||
ges_track_effect_create_element (GESTrackObject * object)
|
||||
{
|
||||
GstElement *csp, *ret, *effect;
|
||||
GstPad *src_target, *sink_target;
|
||||
GstPad *src, *sink;
|
||||
|
||||
GError *error = NULL;
|
||||
GESTrackEffect *self = GES_TRACK_EFFECT (object);
|
||||
|
||||
effect =
|
||||
gst_parse_bin_from_description (self->priv->bin_description, TRUE,
|
||||
&error);
|
||||
if (error != NULL)
|
||||
return NULL;
|
||||
|
||||
csp = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
||||
|
||||
ret = gst_bin_new ("effect-bin");
|
||||
gst_bin_add_many (GST_BIN (ret), effect, csp, NULL);
|
||||
gst_element_link (csp, ret);
|
||||
|
||||
src_target = gst_element_get_static_pad (effect, "src");
|
||||
sink_target = gst_element_get_static_pad (csp, "sink");
|
||||
|
||||
src = gst_ghost_pad_new ("src", src_target);
|
||||
sink = gst_ghost_pad_new ("video_sink", sink_target);
|
||||
|
||||
gst_object_unref (src_target);
|
||||
gst_object_unref (sink_target);
|
||||
|
||||
gst_element_add_pad (ret, src);
|
||||
gst_element_add_pad (ret, sink);
|
||||
|
||||
GST_DEBUG ("Created %p", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_track_effect_new_from_bin_desc:
|
||||
* @bin_description: The gst-launch like bin description of the effect
|
||||
*
|
||||
* Creates a new #GESTrackEffect from the description of the bin. This is
|
||||
* a convenience method for testing puposes.
|
||||
*
|
||||
* Returns: a newly created #GESTrackEffect, or %NULL if something went
|
||||
* wrong.
|
||||
*/
|
||||
GESTrackEffect *
|
||||
ges_track_effect_new_from_bin_desc (const gchar * bin_description)
|
||||
{
|
||||
return g_object_new (GES_TYPE_TRACK_EFFECT, "bin-description",
|
||||
bin_description, NULL);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <ges/ges-track-operation.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GES_TYPE_TRACK_EFFECT ges_track_effect_get_type()
|
||||
#define GES_TRACK_EFFECT(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TRACK_EFFECT, GESTrackEffect))
|
||||
|
@ -70,7 +71,5 @@ struct _GESTrackEffectClass
|
|||
|
||||
GType ges_track_effect_get_type (void);
|
||||
|
||||
GESTrackEffect *ges_track_effect_new_from_bin_desc (const gchar * bin_description);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* _GES_TRACK_EFFECT */
|
||||
|
|
268
ges/ges-track-parse-launch-effect.c
Normal file
268
ges/ges-track-parse-launch-effect.c
Normal file
|
@ -0,0 +1,268 @@
|
|||
/* GStreamer Editing Services
|
||||
* Copyright (C) 2010 Thibault Saunier <thibault.saunier@collabora.co.uk>
|
||||
*
|
||||
* 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-parse-launch-effect
|
||||
* @short_description: adds an effect build from a parse-launch style
|
||||
* bin description to a stream in a #GESTimelineSource or a #GESTimelineLayer
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ges-internal.h"
|
||||
#include "ges-track-object.h"
|
||||
#include "ges-track-effect.h"
|
||||
#include "ges-track-parse-launch-effect.h"
|
||||
|
||||
G_DEFINE_TYPE (GESTrackParseLaunchEffect, ges_track_parse_launch_effect,
|
||||
GES_TYPE_TRACK_EFFECT);
|
||||
|
||||
static void ges_track_parse_launch_effect_dispose (GObject * object);
|
||||
static void ges_track_parse_launch_effect_finalize (GObject * object);
|
||||
static GstElement *ges_track_parse_launch_effect_create_element (GESTrackObject
|
||||
* self);
|
||||
static GHashTable
|
||||
* ges_track_parse_launch_effect_get_props_hashtable (GESTrackObject * self);
|
||||
static GHashTable
|
||||
* ges_track_parse_launch_effect_get_props_hashtable_from_bin_desc
|
||||
(GESTrackObject * self);
|
||||
|
||||
struct _GESTrackParseLaunchEffectPrivate
|
||||
{
|
||||
gchar *bin_description;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BIN_DESCRIPTION,
|
||||
};
|
||||
|
||||
static void
|
||||
ges_track_parse_launch_effect_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_parse_launch_effect_set_property (GObject * object,
|
||||
guint property_id, const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GESTrackParseLaunchEffect *self = GES_TRACK_PARSE_LAUNCH_EFFECT (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_BIN_DESCRIPTION:
|
||||
self->priv->bin_description = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_parse_launch_effect_class_init (GESTrackParseLaunchEffectClass *
|
||||
klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GESTrackObjectClass *obj_bg_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
obj_bg_class = GES_TRACK_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GESTrackParseLaunchEffectPrivate));
|
||||
|
||||
object_class->get_property = ges_track_parse_launch_effect_get_property;
|
||||
object_class->set_property = ges_track_parse_launch_effect_set_property;
|
||||
object_class->dispose = ges_track_parse_launch_effect_dispose;
|
||||
object_class->finalize = ges_track_parse_launch_effect_finalize;
|
||||
|
||||
obj_bg_class->create_element = ges_track_parse_launch_effect_create_element;
|
||||
obj_bg_class->get_props_hastable =
|
||||
ges_track_parse_launch_effect_get_props_hashtable;
|
||||
|
||||
/**
|
||||
* GESTrackParseLaunchEffect:bin_description:
|
||||
*
|
||||
* The description of the effect bin with a gst-launch-style
|
||||
* pipeline description.
|
||||
* exemple: videobalance saturation=1.5 hue=+0.5
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_BIN_DESCRIPTION,
|
||||
g_param_spec_string ("bin-description",
|
||||
"bin description",
|
||||
"Bin description of the effect",
|
||||
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_parse_launch_effect_init (GESTrackParseLaunchEffect * self)
|
||||
{
|
||||
self->priv =
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT,
|
||||
GESTrackParseLaunchEffectPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_parse_launch_effect_dispose (GObject * object)
|
||||
{
|
||||
G_OBJECT_CLASS (ges_track_parse_launch_effect_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ges_track_parse_launch_effect_finalize (GObject * object)
|
||||
{
|
||||
GESTrackParseLaunchEffect *self = GES_TRACK_PARSE_LAUNCH_EFFECT (object);
|
||||
|
||||
if (self->priv->bin_description)
|
||||
g_free (self->priv->bin_description);
|
||||
|
||||
G_OBJECT_CLASS (ges_track_parse_launch_effect_parent_class)->finalize
|
||||
(object);
|
||||
}
|
||||
|
||||
/* This function is more for testing puposes */
|
||||
static GHashTable *
|
||||
ges_track_parse_launch_effect_get_props_hashtable_from_bin_desc (GESTrackObject
|
||||
* self)
|
||||
{
|
||||
gpointer data;
|
||||
GstIterator *it;
|
||||
GParamSpec **parray;
|
||||
GObjectClass *class;
|
||||
guint i, nb_specs;
|
||||
const gchar *name, *klass;
|
||||
GstElementFactory *factory;
|
||||
GstElement *child, *element;
|
||||
gchar **categories, *categorie;
|
||||
|
||||
gboolean done = FALSE;
|
||||
GHashTable *ret = NULL;
|
||||
|
||||
element = ges_track_object_get_element (self);
|
||||
|
||||
ret = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||
|
||||
/* We go over child elements recursivly, and add writable properties to the
|
||||
* hashtable
|
||||
* FIXME: Add a blacklist of properties */
|
||||
it = gst_bin_iterate_recurse (GST_BIN (element));
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (it, &data)) {
|
||||
case GST_ITERATOR_OK:
|
||||
child = GST_ELEMENT_CAST (data);
|
||||
factory = gst_element_get_factory (child);
|
||||
klass = gst_element_factory_get_klass (factory);
|
||||
categories = g_strsplit (klass, "/", 0);
|
||||
|
||||
i = 0;
|
||||
for (categorie = categories[0]; categorie;) {
|
||||
if (g_strcmp0 (categorie, "Effect") == 0) {
|
||||
|
||||
class = G_OBJECT_GET_CLASS (child);
|
||||
parray = g_object_class_list_properties (class, &nb_specs);
|
||||
for (i = 0; i < nb_specs; i++) {
|
||||
if (parray[i]->flags & G_PARAM_WRITABLE) {
|
||||
name = g_param_spec_get_name (parray[i]);
|
||||
g_hash_table_insert (ret,
|
||||
g_strconcat (G_OBJECT_CLASS_NAME (class),
|
||||
"-", name, NULL), g_object_ref (child));
|
||||
}
|
||||
}
|
||||
GST_DEBUG ("%i configurable properties added to %p", child,
|
||||
nb_specs);
|
||||
gst_object_unref (child);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
categorie = categories[i];
|
||||
}
|
||||
g_strfreev (categories);
|
||||
break;
|
||||
|
||||
case GST_ITERATOR_RESYNC:
|
||||
GST_DEBUG ("iterator resync");
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
|
||||
case GST_ITERATOR_DONE:
|
||||
GST_DEBUG ("iterator done");
|
||||
done = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gst_iterator_free (it);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Virtual methods */
|
||||
static GHashTable *
|
||||
ges_track_parse_launch_effect_get_props_hashtable (GESTrackObject * self)
|
||||
{
|
||||
|
||||
if (GES_TRACK_PARSE_LAUNCH_EFFECT (self)->priv->bin_description)
|
||||
return
|
||||
ges_track_parse_launch_effect_get_props_hashtable_from_bin_desc (self);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GstElement *
|
||||
ges_track_parse_launch_effect_create_element (GESTrackObject * object)
|
||||
{
|
||||
GstElement *effect;
|
||||
|
||||
GError *error = NULL;
|
||||
GESTrackParseLaunchEffect *self = GES_TRACK_PARSE_LAUNCH_EFFECT (object);
|
||||
|
||||
effect =
|
||||
gst_parse_bin_from_description (self->priv->bin_description, TRUE,
|
||||
&error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GST_DEBUG ("Created %p", effect);
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_track_parse_launch_effect_new_from_bin_desc:
|
||||
* @bin_description: The gst-launch like bin description of the effect
|
||||
*
|
||||
* Creates a new #GESTrackParseLaunchEffect from the description of the bin.
|
||||
*
|
||||
* Returns: a newly created #GESTrackParseLaunchEffect, or %NULL if something went
|
||||
* wrong.
|
||||
*/
|
||||
GESTrackParseLaunchEffect *
|
||||
ges_track_parse_launch_effect_new_from_bin_desc (const gchar * bin_description)
|
||||
{
|
||||
return g_object_new (GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT, "bin-description",
|
||||
bin_description, NULL);
|
||||
}
|
82
ges/ges-track-parse-launch-effect.h
Normal file
82
ges/ges-track-parse-launch-effect.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
/* GStreamer Editing Services
|
||||
* Copyright (C) 2010 Thibault Saunier <thibault.saunier@collabora.co.uk>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _GES_TRACK_PARSE_LAUNCH_EFFECT
|
||||
#define _GES_TRACK_PARSE_LAUNCH_EFFECT
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <ges/ges-types.h>
|
||||
#include <ges/ges-track-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT ges_track_parse_launch_effect_get_type()
|
||||
|
||||
#define GES_TRACK_PARSE_LAUNCH_EFFECT(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT, GESTrackParseLaunchEffect))
|
||||
|
||||
#define GES_TRACK_PARSE_LAUNCH_EFFECT_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT, GESTrackParseLaunchEffectClass))
|
||||
|
||||
#define GES_IS_TRACK_PARSE_LAUNCH(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT))
|
||||
|
||||
#define GES_IS_TRACK_PARSE_LAUNCH_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT))
|
||||
|
||||
#define GES_TRACK_PARSE_LAUNCH_EFFECT_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_PARSE_LAUNCH_EFFECT, GESTrackParseLaunchEffectClass))
|
||||
|
||||
|
||||
typedef struct _GESTrackParseLaunchEffectPrivate GESTrackParseLaunchEffectPrivate;
|
||||
|
||||
/**
|
||||
* GESTrackParseLaunchEffect:
|
||||
*
|
||||
*/
|
||||
struct _GESTrackParseLaunchEffect
|
||||
{
|
||||
/*< private > */
|
||||
GESTrackEffect parent;
|
||||
GESTrackParseLaunchEffectPrivate *priv;
|
||||
|
||||
/* Padding for API extension */
|
||||
gpointer _ges_reserved[GES_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GESTrackParseLaunchEffectClass:
|
||||
* @parent_class: parent class
|
||||
*/
|
||||
|
||||
struct _GESTrackParseLaunchEffectClass
|
||||
{
|
||||
/*< private > */
|
||||
GESTrackEffectClass parent_class;
|
||||
/* Padding for API extension */
|
||||
gpointer _ges_reserved[GES_PADDING];
|
||||
|
||||
};
|
||||
|
||||
GType ges_track_parse_launch_effect_get_type (void);
|
||||
|
||||
GESTrackParseLaunchEffect
|
||||
*ges_track_parse_launch_effect_new_from_bin_desc (const gchar * bin_description);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* _GES_TRACK_PARSE_LAUNCH_EFFECT */
|
|
@ -89,6 +89,9 @@ typedef struct _GESTrackOperationClass GESTrackOperationClass;
|
|||
typedef struct _GESTrackEffect GESTrackEffect;
|
||||
typedef struct _GESTrackEffectClass GESTrackEffectClass;
|
||||
|
||||
typedef struct _GESTrackParseLaunchEffect GESTrackParseLaunchEffect;
|
||||
typedef struct _GESTrackParseLaunchEffectClass GESTrackParseLaunchEffectClass;
|
||||
|
||||
typedef struct _GESTrackFileSource GESTrackFileSource;
|
||||
typedef struct _GESTrackFileSourceClass GESTrackFileSourceClass;
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <ges/ges-track-video-transition.h>
|
||||
#include <ges/ges-track-audio-transition.h>
|
||||
#include <ges/ges-track-effect.h>
|
||||
#include <ges/ges-track-parse-launch-effect.h>
|
||||
|
||||
#include <ges/ges-formatter.h>
|
||||
#include <ges/ges-keyfile-formatter.h>
|
||||
|
|
|
@ -30,11 +30,11 @@ deep_prop_changed_cb (GESTrackObject * obj, GstElement * element,
|
|||
|
||||
GST_START_TEST (test_effect_basic)
|
||||
{
|
||||
GESTrackEffect *effect;
|
||||
GESTrackParseLaunchEffect *effect;
|
||||
|
||||
ges_init ();
|
||||
|
||||
effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
effect = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
fail_unless (effect != NULL);
|
||||
g_object_unref (effect);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ GST_START_TEST (test_add_effect_to_tl_object)
|
|||
GESTimeline *timeline;
|
||||
GESTimelineLayer *layer;
|
||||
GESTrack *track_audio, *track_video;
|
||||
GESTrackEffect *track_effect;
|
||||
GESTrackParseLaunchEffect *track_effect;
|
||||
GESTimelineTestSource *source;
|
||||
|
||||
ges_init ();
|
||||
|
@ -69,7 +69,7 @@ GST_START_TEST (test_add_effect_to_tl_object)
|
|||
|
||||
|
||||
GST_DEBUG ("Create effect");
|
||||
track_effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
|
||||
fail_unless (GES_IS_TRACK_EFFECT (track_effect));
|
||||
|
||||
|
@ -93,7 +93,7 @@ GST_START_TEST (test_get_effects_from_tl)
|
|||
GESTimeline *timeline;
|
||||
GESTimelineLayer *layer;
|
||||
GESTrack *track_video;
|
||||
GESTrackEffect *track_effect, *track_effect1, *track_effect2;
|
||||
GESTrackParseLaunchEffect *track_effect, *track_effect1, *track_effect2;
|
||||
GESTimelineTestSource *source;
|
||||
GList *effects, *tmp = NULL;
|
||||
gint effect_prio = -1;
|
||||
|
@ -117,9 +117,9 @@ GST_START_TEST (test_get_effects_from_tl)
|
|||
|
||||
|
||||
GST_DEBUG ("Create effect");
|
||||
track_effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect1 = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect2 = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect1 = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
track_effect2 = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
|
||||
fail_unless (GES_IS_TRACK_EFFECT (track_effect));
|
||||
fail_unless (GES_IS_TRACK_EFFECT (track_effect1));
|
||||
|
@ -170,7 +170,7 @@ GST_START_TEST (test_tl_effect)
|
|||
GESTimelineLayer *layer;
|
||||
GESTrack *track_audio, *track_video;
|
||||
GESTimelineEffect *tl_effect;
|
||||
GESTrackEffect *tck_effect, *tck_effect1;
|
||||
GESTrackParseLaunchEffect *tck_effect, *tck_effect1;
|
||||
GList *effects, *tmp;
|
||||
gint i, tl_object_height;
|
||||
gint effect_prio = -1;
|
||||
|
@ -199,7 +199,7 @@ GST_START_TEST (test_tl_effect)
|
|||
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
||||
(GESTimelineObject *) tl_effect, 0);
|
||||
|
||||
tck_effect = ges_track_effect_new_from_bin_desc ("identity");
|
||||
tck_effect = ges_track_parse_launch_effect_new_from_bin_desc ("identity");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect)));
|
||||
fail_unless (ges_track_add_object (track_video,
|
||||
|
@ -208,7 +208,7 @@ GST_START_TEST (test_tl_effect)
|
|||
g_object_get (tl_effect, "height", &tl_object_height, NULL);
|
||||
fail_unless (tl_object_height == 3);
|
||||
|
||||
tck_effect1 = ges_track_effect_new_from_bin_desc ("identity");
|
||||
tck_effect1 = ges_track_parse_launch_effect_new_from_bin_desc ("identity");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect1)));
|
||||
fail_unless (ges_track_add_object (track_audio,
|
||||
|
@ -246,7 +246,7 @@ GST_START_TEST (test_priorities_tl_object)
|
|||
GESTimelineLayer *layer;
|
||||
GESTrack *track_audio, *track_video;
|
||||
GESTimelineEffect *tl_effect;
|
||||
GESTrackEffect *tck_effect, *tck_effect1;
|
||||
GESTrackParseLaunchEffect *tck_effect, *tck_effect1;
|
||||
GList *effects, *tmp;
|
||||
gint i, tl_object_height;
|
||||
gint effect_prio = -1;
|
||||
|
@ -270,7 +270,7 @@ GST_START_TEST (test_priorities_tl_object)
|
|||
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
||||
(GESTimelineObject *) tl_effect, 0);
|
||||
|
||||
tck_effect = ges_track_effect_new_from_bin_desc ("identity");
|
||||
tck_effect = ges_track_parse_launch_effect_new_from_bin_desc ("identity");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect)));
|
||||
fail_unless (ges_track_add_object (track_video,
|
||||
|
@ -279,7 +279,7 @@ GST_START_TEST (test_priorities_tl_object)
|
|||
g_object_get (tl_effect, "height", &tl_object_height, NULL);
|
||||
fail_unless (tl_object_height == 3);
|
||||
|
||||
tck_effect1 = ges_track_effect_new_from_bin_desc ("identity");
|
||||
tck_effect1 = ges_track_parse_launch_effect_new_from_bin_desc ("identity");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect1)));
|
||||
fail_unless (ges_track_add_object (track_audio,
|
||||
|
@ -326,7 +326,7 @@ GST_START_TEST (test_track_effect_set_properties)
|
|||
GESTimelineLayer *layer;
|
||||
GESTrack *track_video;
|
||||
GESTimelineEffect *tl_effect;
|
||||
GESTrackEffect *tck_effect;
|
||||
GESTrackParseLaunchEffect *tck_effect;
|
||||
GValue value = { 0 };
|
||||
guint val;
|
||||
|
||||
|
@ -347,7 +347,7 @@ GST_START_TEST (test_track_effect_set_properties)
|
|||
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
||||
(GESTimelineObject *) tl_effect, 0);
|
||||
|
||||
tck_effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
tck_effect = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect)));
|
||||
fail_unless (ges_track_add_object (track_video,
|
||||
|
@ -392,7 +392,7 @@ GST_START_TEST (test_tl_obj_signals)
|
|||
GESTimelineLayer *layer;
|
||||
GESTrack *track_video;
|
||||
GESTimelineEffect *tl_effect;
|
||||
GESTrackEffect *tck_effect;
|
||||
GESTrackParseLaunchEffect *tck_effect;
|
||||
GValue value = { 0 };
|
||||
guint val;
|
||||
|
||||
|
@ -415,7 +415,7 @@ GST_START_TEST (test_tl_obj_signals)
|
|||
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
||||
(GESTimelineObject *) tl_effect, 0);
|
||||
|
||||
tck_effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
tck_effect = ges_track_parse_launch_effect_new_from_bin_desc ("agingtv");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect)));
|
||||
fail_unless (ges_track_add_object (track_video,
|
||||
|
|
Loading…
Reference in a new issue