mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
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:
parent
19ee23cdcc
commit
a022b4b394
4 changed files with 67 additions and 20 deletions
|
@ -339,6 +339,11 @@ typedef struct GESMultiFileURI
|
||||||
|
|
||||||
G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
|
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 *
|
* Gnonlin helpers *
|
||||||
********************/
|
********************/
|
||||||
|
|
|
@ -179,7 +179,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_TEXT,
|
g_object_class_install_property (object_class, PROP_TEXT,
|
||||||
g_param_spec_string ("text", "Text", "The text to display",
|
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:
|
* GESTitleClip:font-desc:
|
||||||
|
@ -191,7 +192,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
"Pango font description of font to be used for rendering. "
|
"Pango font description of font to be used for rendering. "
|
||||||
"See documentation of pango_font_description_from_string "
|
"See documentation of pango_font_description_from_string "
|
||||||
"for syntax.", DEFAULT_FONT_DESC,
|
"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:
|
* GESTitleClip:valignment:
|
||||||
|
@ -202,7 +204,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
g_param_spec_enum ("valignment", "vertical alignment",
|
g_param_spec_enum ("valignment", "vertical alignment",
|
||||||
"Vertical alignment of the text", GES_TEXT_VALIGN_TYPE,
|
"Vertical alignment of the text", GES_TEXT_VALIGN_TYPE,
|
||||||
DEFAULT_VALIGNMENT,
|
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:
|
* GESTitleClip:halignment:
|
||||||
*
|
*
|
||||||
|
@ -212,7 +215,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
g_param_spec_enum ("halignment", "horizontal alignment",
|
g_param_spec_enum ("halignment", "horizontal alignment",
|
||||||
"Horizontal alignment of the text",
|
"Horizontal alignment of the text",
|
||||||
GES_TEXT_HALIGN_TYPE, DEFAULT_HALIGNMENT,
|
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;
|
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_object_class_install_property (object_class, PROP_COLOR,
|
||||||
g_param_spec_uint ("color", "Color", "The color of the text",
|
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:
|
* GESTitleClip:background:
|
||||||
|
@ -238,7 +243,7 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
g_object_class_install_property (object_class, PROP_BACKGROUND,
|
g_object_class_install_property (object_class, PROP_BACKGROUND,
|
||||||
g_param_spec_uint ("background", "Background",
|
g_param_spec_uint ("background", "Background",
|
||||||
"The background of the text", 0, G_MAXUINT32, G_MAXUINT32,
|
"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:
|
* GESTitleClip:xpos:
|
||||||
|
@ -248,7 +253,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_XPOS,
|
g_object_class_install_property (object_class, PROP_XPOS,
|
||||||
g_param_spec_double ("xpos", "Xpos", "The horizontal position",
|
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:
|
* GESTitleClip:ypos:
|
||||||
|
@ -258,7 +264,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_YPOS,
|
g_object_class_install_property (object_class, PROP_YPOS,
|
||||||
g_param_spec_double ("ypos", "Ypos", "The vertical position",
|
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
|
static void
|
||||||
|
|
|
@ -141,11 +141,16 @@ ges_title_source_set_property (GObject * object,
|
||||||
static GstElement *
|
static GstElement *
|
||||||
ges_title_source_create_source (GESTrackElement * object)
|
ges_title_source_create_source (GESTrackElement * object)
|
||||||
{
|
{
|
||||||
GESTitleSource *self = GES_TITLE_SOURCE (object);
|
|
||||||
GESTitleSourcePrivate *priv = self->priv;
|
|
||||||
GstElement *topbin, *background, *text;
|
GstElement *topbin, *background, *text;
|
||||||
GstPad *src, *pad;
|
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");
|
topbin = gst_bin_new ("titlesrc-bin");
|
||||||
background = gst_element_factory_make ("videotestsrc", "titlesrc-bg");
|
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",
|
g_object_set (text, "valignment", (gint) priv->valign, "halignment",
|
||||||
(gint) priv->halign, NULL);
|
(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,
|
g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_SOLID,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_set (background, "foreground-color", (guint) self->priv->background,
|
g_object_set (background, "foreground-color", (guint) self->priv->background,
|
||||||
NULL);
|
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);
|
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->text_el = text;
|
||||||
priv->background_el = background;
|
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;
|
return topbin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -749,14 +749,39 @@ append_escaped (GString * str, gchar * tmpstr)
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
_can_serialize_spec (GParamSpec * spec)
|
_can_serialize_spec (GParamSpec * spec)
|
||||||
{
|
{
|
||||||
if (spec->flags & G_PARAM_WRITABLE && !(spec->flags & G_PARAM_CONSTRUCT_ONLY)
|
if (!(spec->flags & G_PARAM_WRITABLE)) {
|
||||||
&& !g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (spec), G_TYPE_OBJECT)
|
GST_DEBUG ("%s from %s is not writable",
|
||||||
&& (!(g_type_is_a (spec->owner_type, GST_TYPE_OBJECT) &&
|
spec->name, g_type_name (spec->owner_type));
|
||||||
!g_strcmp0 (spec->name, "name")))
|
|
||||||
&& G_PARAM_SPEC_VALUE_TYPE (spec) != G_TYPE_GTYPE)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
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
|
static inline void
|
||||||
|
|
Loading…
Reference in a new issue