#define DEFAULT_PROP_TEXT ""
#define DEFAULT_PROP_SHADING FALSE
-#define DEFAULT_PROP_VALIGN GST_TEXT_OVERLAY_VALIGN_BASELINE
-#define DEFAULT_PROP_HALIGN GST_TEXT_OVERLAY_HALIGN_CENTER
+#define DEFAULT_PROP_VALIGNMENT GST_TEXT_OVERLAY_VALIGN_BASELINE
+#define DEFAULT_PROP_HALIGNMENT GST_TEXT_OVERLAY_HALIGN_CENTER
+#define DEFAULT_PROP_VALIGN "baseline"
+#define DEFAULT_PROP_HALIGN "center"
#define DEFAULT_PROP_XPAD 25
#define DEFAULT_PROP_YPAD 25
#define DEFAULT_PROP_DELTAX 0
PROP_0,
PROP_TEXT,
PROP_SHADING,
- PROP_VALIGN,
- PROP_HALIGN,
+ PROP_VALIGN, /* deprecated */
+ PROP_HALIGN, /* deprecated */
+ PROP_HALIGNMENT,
+ PROP_VALIGNMENT,
PROP_XPAD,
PROP_YPAD,
PROP_DELTAX,
g_param_spec_boolean ("shaded-background", "shaded background",
"Whether to shade the background under the text area",
DEFAULT_PROP_SHADING, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
- g_param_spec_enum ("valign", "vertical alignment",
- "Vertical alignment of the text. ",
- GST_TYPE_TEXT_OVERLAY_VALIGN, DEFAULT_PROP_VALIGN,
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
+ g_param_spec_enum ("valignment", "vertical alignment",
+ "Vertical alignment of the text",
+ GST_TYPE_TEXT_OVERLAY_VALIGN, DEFAULT_PROP_VALIGNMENT,
G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
+ g_param_spec_enum ("halignment", "horizontal alignment",
+ "Horizontal alignment of the text", GST_TYPE_TEXT_OVERLAY_HALIGN,
+ DEFAULT_PROP_HALIGNMENT, G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
+ g_param_spec_string ("valign", "vertical alignment",
+ "Vertical alignment of the text (deprecated; use valignment)",
+ DEFAULT_PROP_VALIGN, G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGN,
- g_param_spec_enum ("halign", "horizontal alignment",
- "Horizontal alignment of the text. ", GST_TYPE_TEXT_OVERLAY_HALIGN,
- DEFAULT_PROP_HALIGN, G_PARAM_READWRITE));
+ g_param_spec_string ("halign", "horizontal alignment",
+ "Horizontal alignment of the text (deprecated; use halignment)",
+ DEFAULT_PROP_HALIGN, G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
g_param_spec_int ("xpad", "horizontal paddding",
"Horizontal paddding when using left/right alignment", 0, G_MAXINT,
pango_layout_new (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_context);
memset (&overlay->bitmap, 0, sizeof (overlay->bitmap));
- overlay->halign = DEFAULT_PROP_HALIGN;
- overlay->valign = DEFAULT_PROP_VALIGN;
+ overlay->halign = DEFAULT_PROP_HALIGNMENT;
+ overlay->valign = DEFAULT_PROP_VALIGNMENT;
overlay->xpad = DEFAULT_PROP_XPAD;
overlay->ypad = DEFAULT_PROP_YPAD;
overlay->deltax = DEFAULT_PROP_DELTAX;
case PROP_DELTAY:
overlay->deltay = g_value_get_int (value);
break;
- case PROP_VALIGN:
+ case PROP_HALIGN:{
+ const gchar *s = g_value_get_string (value);
+
+ if (s && g_ascii_strcasecmp (s, "left") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_HALIGN_LEFT;
+ else if (s && g_ascii_strcasecmp (s, "center") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_HALIGN_CENTER;
+ else if (s && g_ascii_strcasecmp (s, "right") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
+ else
+ g_warning ("Invalid value '%s' for textoverlay property 'halign'",
+ GST_STR_NULL (s));
+ break;
+ }
+ case PROP_VALIGN:{
+ const gchar *s = g_value_get_string (value);
+
+ if (s && g_ascii_strcasecmp (s, "baseline") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
+ else if (s && g_ascii_strcasecmp (s, "bottom") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
+ else if (s && g_ascii_strcasecmp (s, "top") == 0)
+ overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
+ else
+ g_warning ("Invalid value '%s' for textoverlay property 'valign'",
+ GST_STR_NULL (s));
+ break;
+ }
+ case PROP_VALIGNMENT:
overlay->valign = g_value_get_enum (value);
break;
- case PROP_HALIGN:
+ case PROP_HALIGNMENT:
overlay->halign = g_value_get_enum (value);
break;
case PROP_WRAP_MODE:
case PROP_DELTAY:
g_value_set_int (value, overlay->deltay);
break;
- case PROP_VALIGN:
+ case PROP_VALIGNMENT:
g_value_set_enum (value, overlay->valign);
break;
- case PROP_HALIGN:
+ case PROP_HALIGNMENT:
g_value_set_enum (value, overlay->halign);
break;
case PROP_WRAP_MODE: