mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
GESTrackEffect: move get_props_hastable implementation from GESTackParseLaunchEffect
This commit is contained in:
parent
a69106ce53
commit
34f6d41d15
2 changed files with 88 additions and 97 deletions
|
@ -31,6 +31,8 @@
|
||||||
G_DEFINE_ABSTRACT_TYPE (GESTrackEffect, ges_track_effect,
|
G_DEFINE_ABSTRACT_TYPE (GESTrackEffect, ges_track_effect,
|
||||||
GES_TYPE_TRACK_OPERATION);
|
GES_TYPE_TRACK_OPERATION);
|
||||||
|
|
||||||
|
static GHashTable *ges_track_effect_get_props_hashtable (GESTrackObject * self);
|
||||||
|
|
||||||
struct _GESTrackEffectPrivate
|
struct _GESTrackEffectPrivate
|
||||||
{
|
{
|
||||||
void *nothing;
|
void *nothing;
|
||||||
|
@ -39,7 +41,11 @@ struct _GESTrackEffectPrivate
|
||||||
static void
|
static void
|
||||||
ges_track_effect_class_init (GESTrackEffectClass * klass)
|
ges_track_effect_class_init (GESTrackEffectClass * klass)
|
||||||
{
|
{
|
||||||
|
GESTrackObjectClass *obj_bg_class = GES_TRACK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESTrackEffectPrivate));
|
g_type_class_add_private (klass, sizeof (GESTrackEffectPrivate));
|
||||||
|
|
||||||
|
obj_bg_class->get_props_hastable = ges_track_effect_get_props_hashtable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -49,3 +55,85 @@ ges_track_effect_init (GESTrackEffect * self)
|
||||||
G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TRACK_EFFECT,
|
G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TRACK_EFFECT,
|
||||||
GESTrackEffectPrivate);
|
GESTrackEffectPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Virtual methods */
|
||||||
|
static GHashTable *
|
||||||
|
ges_track_effect_get_props_hashtable (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);
|
||||||
|
if (!element) {
|
||||||
|
GST_DEBUG
|
||||||
|
("Can't build the property hashtable until the gnlobject is created");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -36,11 +36,6 @@ static void ges_track_parse_launch_effect_dispose (GObject * object);
|
||||||
static void ges_track_parse_launch_effect_finalize (GObject * object);
|
static void ges_track_parse_launch_effect_finalize (GObject * object);
|
||||||
static GstElement *ges_track_parse_launch_effect_create_element (GESTrackObject
|
static GstElement *ges_track_parse_launch_effect_create_element (GESTrackObject
|
||||||
* self);
|
* 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
|
struct _GESTrackParseLaunchEffectPrivate
|
||||||
{
|
{
|
||||||
|
@ -96,8 +91,6 @@ ges_track_parse_launch_effect_class_init (GESTrackParseLaunchEffectClass *
|
||||||
object_class->finalize = ges_track_parse_launch_effect_finalize;
|
object_class->finalize = ges_track_parse_launch_effect_finalize;
|
||||||
|
|
||||||
obj_bg_class->create_element = ges_track_parse_launch_effect_create_element;
|
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:
|
* GESTrackParseLaunchEffect:bin_description:
|
||||||
|
@ -139,96 +132,6 @@ ges_track_parse_launch_effect_finalize (GObject * object)
|
||||||
(object);
|
(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 *
|
static GstElement *
|
||||||
ges_track_parse_launch_effect_create_element (GESTrackObject * object)
|
ges_track_parse_launch_effect_create_element (GESTrackObject * object)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue