title-source: add background color option

This commit is contained in:
Matas Brazdeikis 2012-08-16 11:20:44 +01:00 committed by Thibault Saunier
parent 0b3c1333d8
commit aaec341f79
7 changed files with 127 additions and 3 deletions

View file

@ -620,6 +620,7 @@ ges_timeline_title_source_set_halignment
ges_timeline_title_source_set_valignment ges_timeline_title_source_set_valignment
ges_timeline_title_source_set_mute ges_timeline_title_source_set_mute
ges_timeline_title_source_set_color ges_timeline_title_source_set_color
ges_timeline_title_source_set_background
ges_timeline_title_source_set_xpos ges_timeline_title_source_set_xpos
ges_timeline_title_source_set_ypos ges_timeline_title_source_set_ypos
ges_timeline_title_source_get_text ges_timeline_title_source_get_text
@ -628,6 +629,7 @@ ges_timeline_title_source_get_valignment
ges_timeline_title_source_get_halignment ges_timeline_title_source_get_halignment
ges_timeline_title_source_is_muted ges_timeline_title_source_is_muted
ges_timeline_title_source_get_color ges_timeline_title_source_get_color
ges_timeline_title_source_get_background
ges_timeline_title_source_get_xpos ges_timeline_title_source_get_xpos
ges_timeline_title_source_get_ypos ges_timeline_title_source_get_ypos
<SUBSECTION Standard> <SUBSECTION Standard>
@ -722,6 +724,7 @@ ges_track_title_source_set_font_desc
ges_track_title_source_set_halignment ges_track_title_source_set_halignment
ges_track_title_source_set_valignment ges_track_title_source_set_valignment
ges_track_title_source_set_color ges_track_title_source_set_color
ges_track_title_source_set_background
ges_track_title_source_set_xpos ges_track_title_source_set_xpos
ges_track_title_source_set_ypos ges_track_title_source_set_ypos
ges_track_title_source_get_text ges_track_title_source_get_text
@ -729,6 +732,7 @@ ges_track_title_source_get_font_desc
ges_track_title_source_get_halignment ges_track_title_source_get_halignment
ges_track_title_source_get_valignment ges_track_title_source_get_valignment
ges_track_title_source_get_color ges_track_title_source_get_color
ges_track_title_source_get_background
ges_track_title_source_get_xpos ges_track_title_source_get_xpos
ges_track_title_source_get_ypos ges_track_title_source_get_ypos
<SUBSECTION Standard> <SUBSECTION Standard>

View file

@ -591,6 +591,15 @@ static GEnumValue vpattern_enum_values[] = {
, ,
{GES_VIDEO_TEST_PATTERN_SMPTE75, "SMPTE 75% color bars", "smpte75"} {GES_VIDEO_TEST_PATTERN_SMPTE75, "SMPTE 75% color bars", "smpte75"}
, ,
{GES_VIDEO_TEST_ZONE_PLATE, "Zone plate", "zone-plate"}
,
{GES_VIDEO_TEST_GAMUT, "Gamut checkers", "gamut"}
,
{GES_VIDEO_TEST_CHROMA_ZONE_PLATE, "Chroma zone plate",
"chroma-zone-plate"}
,
{GES_VIDEO_TEST_PATTERN_SOLID, "Solid color", "solid-color"}
,
{0, NULL, NULL} {0, NULL, NULL}
}; };

View file

@ -271,6 +271,7 @@ GType ges_text_halign_get_type (void);
* @GES_VIDEO_TEST_PATTERN_CHECKERS4: Checkers pattern (4px) * @GES_VIDEO_TEST_PATTERN_CHECKERS4: Checkers pattern (4px)
* @GES_VIDEO_TEST_PATTERN_CHECKERS8: Checkers pattern (8px) * @GES_VIDEO_TEST_PATTERN_CHECKERS8: Checkers pattern (8px)
* @GES_VIDEO_TEST_PATTERN_CIRCULAR: Circular pattern * @GES_VIDEO_TEST_PATTERN_CIRCULAR: Circular pattern
* @GES_VIDEO_TEST_PATTERN_SOLID: Solid color
* @GES_VIDEO_TEST_PATTERN_BLINK: Alternate between black and white * @GES_VIDEO_TEST_PATTERN_BLINK: Alternate between black and white
* @GES_VIDEO_TEST_PATTERN_SMPTE75: SMPTE test pattern (75% color bars) * @GES_VIDEO_TEST_PATTERN_SMPTE75: SMPTE test pattern (75% color bars)
* *
@ -292,6 +293,10 @@ typedef enum {
GES_VIDEO_TEST_PATTERN_CIRCULAR, GES_VIDEO_TEST_PATTERN_CIRCULAR,
GES_VIDEO_TEST_PATTERN_BLINK, GES_VIDEO_TEST_PATTERN_BLINK,
GES_VIDEO_TEST_PATTERN_SMPTE75, GES_VIDEO_TEST_PATTERN_SMPTE75,
GES_VIDEO_TEST_ZONE_PLATE,
GES_VIDEO_TEST_GAMUT,
GES_VIDEO_TEST_CHROMA_ZONE_PLATE,
GES_VIDEO_TEST_PATTERN_SOLID,
} GESVideoTestPattern; } GESVideoTestPattern;

View file

@ -50,6 +50,7 @@ struct _GESTimelineTitleSourcePrivate
GESTextVAlign valign; GESTextVAlign valign;
GSList *track_titles; GSList *track_titles;
guint32 color; guint32 color;
guint32 background;
gdouble xpos; gdouble xpos;
gdouble ypos; gdouble ypos;
}; };
@ -63,6 +64,7 @@ enum
PROP_HALIGNMENT, PROP_HALIGNMENT,
PROP_VALIGNMENT, PROP_VALIGNMENT,
PROP_COLOR, PROP_COLOR,
PROP_BACKGROUND,
PROP_XPOS, PROP_XPOS,
PROP_YPOS, PROP_YPOS,
}; };
@ -104,6 +106,9 @@ ges_timeline_title_source_get_property (GObject * object, guint property_id,
case PROP_COLOR: case PROP_COLOR:
g_value_set_uint (value, priv->color); g_value_set_uint (value, priv->color);
break; break;
case PROP_BACKGROUND:
g_value_set_uint (value, priv->background);
break;
case PROP_XPOS: case PROP_XPOS:
g_value_set_double (value, priv->xpos); g_value_set_double (value, priv->xpos);
break; break;
@ -140,6 +145,9 @@ ges_timeline_title_source_set_property (GObject * object, guint property_id,
case PROP_COLOR: case PROP_COLOR:
ges_timeline_title_source_set_color (tfs, g_value_get_uint (value)); ges_timeline_title_source_set_color (tfs, g_value_get_uint (value));
break; break;
case PROP_BACKGROUND:
ges_timeline_title_source_set_background (tfs, g_value_get_uint (value));
break;
case PROP_XPOS: case PROP_XPOS:
ges_timeline_title_source_set_xpos (tfs, g_value_get_double (value)); ges_timeline_title_source_set_xpos (tfs, g_value_get_double (value));
break; break;
@ -245,7 +253,18 @@ ges_timeline_title_source_class_init (GESTimelineTitleSourceClass * klass)
0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); 0, G_MAXUINT32, G_MAXUINT32, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/** /**
* GESTimelineTitleSource:xpos: * GESTimelineTitleSource:background:
*
* The background of the text
*/
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));
/**
* GESTimelineTitleSource:xpos
* *
* The horizontal position of the text * The horizontal position of the text
*/ */
@ -279,6 +298,7 @@ ges_timeline_title_source_init (GESTimelineTitleSource * self)
self->priv->halign = DEFAULT_HALIGNMENT; self->priv->halign = DEFAULT_HALIGNMENT;
self->priv->valign = DEFAULT_VALIGNMENT; self->priv->valign = DEFAULT_VALIGNMENT;
self->priv->color = G_MAXUINT32; self->priv->color = G_MAXUINT32;
self->priv->background = G_MAXUINT32;
self->priv->xpos = 0.5; self->priv->xpos = 0.5;
self->priv->ypos = 0.5; self->priv->ypos = 0.5;
} }
@ -444,6 +464,30 @@ ges_timeline_title_source_set_color (GESTimelineTitleSource * self,
} }
} }
/**
* ges_timeline_title_source_set_background:
* @self: the #GESTimelineTitleSource* to set
* @background: The color @self is being set to
*
* Sets the background of the text.
*/
void
ges_timeline_title_source_set_background (GESTimelineTitleSource * self,
guint32 background)
{
GSList *tmp;
GST_DEBUG ("self:%p, background:%d", self, background);
self->priv->background = background;
for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) {
ges_track_title_source_set_background (GES_TRACK_TITLE_SOURCE (tmp->data),
self->priv->background);
}
}
/** /**
* ges_timeline_title_source_set_xpos: * ges_timeline_title_source_set_xpos:
* @self: the #GESTimelineTitleSource* to set * @self: the #GESTimelineTitleSource* to set
@ -585,6 +629,20 @@ ges_timeline_title_source_get_color (GESTimelineTitleSource * self)
return self->priv->color; return self->priv->color;
} }
/**
* ges_timeline_title_source_get_background:
* @self: a #GESTimelineTitleSource
*
* Get the background used by @self.
*
* Returns: The color used by @self.
*/
const guint32
ges_timeline_title_source_get_background (GESTimelineTitleSource * self)
{
return self->priv->background;
}
/** /**
* ges_timeline_title_source_get_xpos: * ges_timeline_title_source_get_xpos:
* @self: a #GESTimelineTitleSource * @self: a #GESTimelineTitleSource
@ -665,6 +723,8 @@ ges_timeline_title_source_create_track_object (GESTimelineObject * obj,
ges_track_title_source_set_valignment ((GESTrackTitleSource *) res, ges_track_title_source_set_valignment ((GESTrackTitleSource *) res,
priv->valign); priv->valign);
ges_track_title_source_set_color ((GESTrackTitleSource *) res, priv->color); ges_track_title_source_set_color ((GESTrackTitleSource *) res, priv->color);
ges_track_title_source_set_background ((GESTrackTitleSource *) res,
priv->background);
ges_track_title_source_set_xpos ((GESTrackTitleSource *) res, priv->xpos); ges_track_title_source_set_xpos ((GESTrackTitleSource *) res, priv->xpos);
ges_track_title_source_set_ypos ((GESTrackTitleSource *) res, priv->ypos); ges_track_title_source_set_ypos ((GESTrackTitleSource *) res, priv->ypos);
} }

View file

@ -97,6 +97,10 @@ void
ges_timeline_title_source_set_color (GESTimelineTitleSource * self, ges_timeline_title_source_set_color (GESTimelineTitleSource * self,
guint32 color); guint32 color);
void
ges_timeline_title_source_set_background (GESTimelineTitleSource * self,
guint32 background);
void void
ges_timeline_title_source_set_xpos (GESTimelineTitleSource * self, ges_timeline_title_source_set_xpos (GESTimelineTitleSource * self,
gdouble position); gdouble position);
@ -105,7 +109,7 @@ void
ges_timeline_title_source_set_ypos (GESTimelineTitleSource * self, ges_timeline_title_source_set_ypos (GESTimelineTitleSource * self,
gdouble position); gdouble position);
const gchar* const gchar*
ges_timeline_title_source_get_font_desc (GESTimelineTitleSource * self); ges_timeline_title_source_get_font_desc (GESTimelineTitleSource * self);
GESTextVAlign GESTextVAlign
@ -117,6 +121,9 @@ ges_timeline_title_source_get_halignment (GESTimelineTitleSource * self);
const guint32 const guint32
ges_timeline_title_source_get_color (GESTimelineTitleSource * self); ges_timeline_title_source_get_color (GESTimelineTitleSource * self);
const guint32
ges_timeline_title_source_get_background (GESTimelineTitleSource * self);
const gdouble const gdouble
ges_timeline_title_source_get_xpos (GESTimelineTitleSource * self); ges_timeline_title_source_get_xpos (GESTimelineTitleSource * self);

View file

@ -39,6 +39,7 @@ struct _GESTrackTitleSourcePrivate
GESTextHAlign halign; GESTextHAlign halign;
GESTextVAlign valign; GESTextVAlign valign;
guint32 color; guint32 color;
guint32 background;
gdouble xpos; gdouble xpos;
gdouble ypos; gdouble ypos;
GstElement *text_el; GstElement *text_el;
@ -88,6 +89,7 @@ ges_track_title_source_init (GESTrackTitleSource * self)
self->priv->halign = DEFAULT_HALIGNMENT; self->priv->halign = DEFAULT_HALIGNMENT;
self->priv->valign = DEFAULT_VALIGNMENT; self->priv->valign = DEFAULT_VALIGNMENT;
self->priv->color = G_MAXUINT32; self->priv->color = G_MAXUINT32;
self->priv->background = G_MAXUINT32;
self->priv->xpos = 0.5; self->priv->xpos = 0.5;
self->priv->ypos = 0.5; self->priv->ypos = 0.5;
self->priv->background_el = NULL; self->priv->background_el = NULL;
@ -159,7 +161,9 @@ ges_track_title_source_create_element (GESTrackObject * 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 (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_BLACK, g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_SOLID,
NULL);
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, "color", (guint) self->priv->color, NULL);
g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL); g_object_set (text, "xpos", (gdouble) self->priv->xpos, NULL);
@ -282,6 +286,24 @@ ges_track_title_source_set_color (GESTrackTitleSource * self, guint32 color)
g_object_set (self->priv->text_el, "color", color, NULL); g_object_set (self->priv->text_el, "color", color, NULL);
} }
/**
* ges_track_title_source_set_background:
* @self: the #GESTrackTitleSource* to set
* @color: the color @self is being set to
*
* Sets the color of the background
*/
void
ges_track_title_source_set_background (GESTrackTitleSource * self,
guint32 color)
{
GST_DEBUG ("self:%p, background color:%d", self, color);
self->priv->background = color;
if (self->priv->background_el)
g_object_set (self->priv->background_el, "foreground-color", color, NULL);
}
/** /**
* ges_track_title_source_set_xpos: * ges_track_title_source_set_xpos:
* @self: the #GESTrackTitleSource* to set * @self: the #GESTrackTitleSource* to set
@ -393,6 +415,20 @@ ges_track_title_source_get_color (GESTrackTitleSource * source)
return source->priv->color; return source->priv->color;
} }
/**
* ges_track_title_source_get_background:
* @source: a #GESTrackTitleSource
*
* Get the background used by @source.
*
* Returns: The background used by @source.
*/
const guint32
ges_track_title_source_get_background (GESTrackTitleSource * source)
{
return source->priv->background;
}
/** /**
* ges_track_title_source_get_xpos: * ges_track_title_source_get_xpos:
* @source: a #GESTrackTitleSource * @source: a #GESTrackTitleSource

View file

@ -90,6 +90,8 @@ void ges_track_title_source_set_valignment (GESTrackTitleSource *self,
void ges_track_title_source_set_color (GESTrackTitleSource *self, void ges_track_title_source_set_color (GESTrackTitleSource *self,
guint32 color); guint32 color);
void ges_track_title_source_set_background (GESTrackTitleSource *self,
guint32 color);
void ges_track_title_source_set_xpos (GESTrackTitleSource *self, void ges_track_title_source_set_xpos (GESTrackTitleSource *self,
gdouble position); gdouble position);
void ges_track_title_source_set_ypos (GESTrackTitleSource *self, void ges_track_title_source_set_ypos (GESTrackTitleSource *self,
@ -100,6 +102,7 @@ const gchar *ges_track_title_source_get_font_desc (GESTrackTitleSource *source);
GESTextHAlign ges_track_title_source_get_halignment (GESTrackTitleSource *source); GESTextHAlign ges_track_title_source_get_halignment (GESTrackTitleSource *source);
GESTextVAlign ges_track_title_source_get_valignment (GESTrackTitleSource *source); GESTextVAlign ges_track_title_source_get_valignment (GESTrackTitleSource *source);
const guint32 ges_track_title_source_get_color (GESTrackTitleSource *source); const guint32 ges_track_title_source_get_color (GESTrackTitleSource *source);
const guint32 ges_track_title_source_get_background (GESTrackTitleSource *source);
const gdouble ges_track_title_source_get_xpos (GESTrackTitleSource *source); const gdouble ges_track_title_source_get_xpos (GESTrackTitleSource *source);
const gdouble ges_track_title_source_get_ypos (GESTrackTitleSource *source); const gdouble ges_track_title_source_get_ypos (GESTrackTitleSource *source);