title-source: Properly expose children properties

+ Make sure that the TitleClip properties are not serialized anymore as
  they are serialized through children properties now.

+ Enhance debugging for not serialized properties in GESXmlFormatter.
This commit is contained in:
Thibault Saunier 2014-09-27 09:59:12 +02:00
parent 19ee23cdcc
commit a022b4b394
4 changed files with 67 additions and 20 deletions

View file

@ -339,6 +339,11 @@ typedef struct GESMultiFileURI
G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
/************************
* Our property masks *
************************/
#define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
/********************
* Gnonlin helpers *
********************/

View file

@ -179,7 +179,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
*/
g_object_class_install_property (object_class, PROP_TEXT,
g_param_spec_string ("text", "Text", "The text to display",
DEFAULT_TEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
DEFAULT_TEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:font-desc:
@ -191,7 +192,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
"Pango font description of font to be used for rendering. "
"See documentation of pango_font_description_from_string "
"for syntax.", DEFAULT_FONT_DESC,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:valignment:
@ -202,7 +204,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_param_spec_enum ("valignment", "vertical alignment",
"Vertical alignment of the text", GES_TEXT_VALIGN_TYPE,
DEFAULT_VALIGNMENT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:halignment:
*
@ -212,7 +215,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_param_spec_enum ("halignment", "horizontal alignment",
"Horizontal alignment of the text",
GES_TEXT_HALIGN_TYPE, DEFAULT_HALIGNMENT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
GES_PARAM_NO_SERIALIZATION));
timobj_class->create_track_element = ges_title_clip_create_track_element;
@ -227,7 +231,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_object_class_install_property (object_class, PROP_COLOR,
g_param_spec_uint ("color", "Color", "The color of the text",
0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:background:
@ -238,7 +243,7 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_object_class_install_property (object_class, PROP_BACKGROUND,
g_param_spec_uint ("background", "Background",
"The background of the text", 0, G_MAXUINT32, G_MAXUINT32,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:xpos:
@ -248,7 +253,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_object_class_install_property (object_class, PROP_XPOS,
g_param_spec_double ("xpos", "Xpos", "The horizontal position",
0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT
| GES_PARAM_NO_SERIALIZATION));
/**
* GESTitleClip:ypos:
@ -258,7 +264,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
g_object_class_install_property (object_class, PROP_YPOS,
g_param_spec_double ("ypos", "Ypos", "The vertical position",
0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
0, 1, 0.5, G_PARAM_READWRITE | G_PARAM_CONSTRUCT
| GES_PARAM_NO_SERIALIZATION));
}
static void

View file

@ -141,11 +141,16 @@ ges_title_source_set_property (GObject * object,
static GstElement *
ges_title_source_create_source (GESTrackElement * object)
{
GESTitleSource *self = GES_TITLE_SOURCE (object);
GESTitleSourcePrivate *priv = self->priv;
GstElement *topbin, *background, *text;
GstPad *src, *pad;
GESTitleSource *self = GES_TITLE_SOURCE (object);
GESTitleSourcePrivate *priv = self->priv;
const gchar *bg_props[] = { "pattern", "foreground-color", NULL };
const gchar *text_props[] = { "text", "font-desc", "valignment", "halignment",
"color", "xpos", "ypos", NULL
};
topbin = gst_bin_new ("titlesrc-bin");
background = gst_element_factory_make ("videotestsrc", "titlesrc-bg");
@ -158,14 +163,15 @@ ges_title_source_create_source (GESTrackElement * object)
}
g_object_set (text, "valignment", (gint) priv->valign, "halignment",
(gint) priv->halign, NULL);
g_object_set (text, "color", (guint) self->priv->color, NULL);
g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL);
g_object_set (text, "ypos", (gdouble) self->priv->ypos, NULL);
g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_SOLID,
NULL);
g_object_set (background, "foreground-color", (guint) self->priv->background,
NULL);
g_object_set (text, "color", (guint) self->priv->color, NULL);
g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL);
g_object_set (text, "ypos", (gdouble) self->priv->ypos, NULL);
gst_bin_add_many (GST_BIN (topbin), background, text, NULL);
@ -183,6 +189,10 @@ ges_title_source_create_source (GESTrackElement * object)
priv->text_el = text;
priv->background_el = background;
ges_track_element_add_children_props (object, text, NULL, NULL, text_props);
ges_track_element_add_children_props (object, background, NULL, NULL,
bg_props);
return topbin;
}

View file

@ -749,14 +749,39 @@ append_escaped (GString * str, gchar * tmpstr)
static inline gboolean
_can_serialize_spec (GParamSpec * spec)
{
if (spec->flags & G_PARAM_WRITABLE && !(spec->flags & G_PARAM_CONSTRUCT_ONLY)
&& !g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (spec), G_TYPE_OBJECT)
&& (!(g_type_is_a (spec->owner_type, GST_TYPE_OBJECT) &&
!g_strcmp0 (spec->name, "name")))
&& G_PARAM_SPEC_VALUE_TYPE (spec) != G_TYPE_GTYPE)
return TRUE;
if (!(spec->flags & G_PARAM_WRITABLE)) {
GST_DEBUG ("%s from %s is not writable",
spec->name, g_type_name (spec->owner_type));
return FALSE;
return FALSE;
} else if (spec->flags & G_PARAM_CONSTRUCT_ONLY) {
GST_DEBUG ("%s from %s is construct only",
spec->name, g_type_name (spec->owner_type));
return FALSE;
} else if (spec->flags & GES_PARAM_NO_SERIALIZATION &&
g_type_is_a (spec->owner_type, GES_TYPE_TIMELINE_ELEMENT)) {
GST_DEBUG ("%s from %s is set as GES_PARAM_NO_SERIALIZATION",
spec->name, g_type_name (spec->owner_type));
return FALSE;
} else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (spec), G_TYPE_OBJECT)) {
GST_DEBUG ("%s from %s contains GObject, can't serialize that.",
spec->name, g_type_name (spec->owner_type));
return FALSE;
} else if ((g_type_is_a (spec->owner_type, GST_TYPE_OBJECT) &&
!g_strcmp0 (spec->name, "name"))) {
GST_DEBUG ("We do not want to serialize the name of GstObjects.");
return FALSE;
} else if (G_PARAM_SPEC_VALUE_TYPE (spec) == G_TYPE_GTYPE) {
GST_DEBUG ("%s from %s contains a GType, can't serialize.",
spec->name, g_type_name (spec->owner_type));
return FALSE;
}
return TRUE;
}
static inline void