Commit 6a257273 authored by Vincent Penquerc'h's avatar Vincent Penquerc'h

cairotextoverlay: add a 'silent' property to skip rendering

https://bugzilla.gnome.org/show_bug.cgi?id=662856
parent 2a139a28
......@@ -65,12 +65,14 @@ enum
ARG_YPAD,
ARG_DELTAX,
ARG_DELTAY,
ARG_SILENT,
ARG_FONT_DESC
};
#define DEFAULT_YPAD 25
#define DEFAULT_XPAD 25
#define DEFAULT_FONT "sans"
#define DEFAULT_SILENT FALSE
#define GST_CAIRO_TEXT_OVERLAY_DEFAULT_SCALE 20.0
......@@ -201,6 +203,11 @@ gst_text_overlay_class_init (GstCairoTextOverlayClass * klass)
"See documentation of "
"pango_font_description_from_string"
" for syntax.", "", G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
/* FIXME 0.11: rename to "visible" or "text-visible" or "render-text" */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
g_param_spec_boolean ("silent", "silent",
"Whether to render the text string",
DEFAULT_SILENT, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
}
static void
......@@ -267,6 +274,8 @@ gst_text_overlay_init (GstCairoTextOverlay * overlay,
overlay->font = g_strdup (DEFAULT_FONT);
gst_text_overlay_font_init (overlay);
overlay->silent = DEFAULT_SILENT;
overlay->fps_n = 0;
overlay->fps_d = 1;
......@@ -410,6 +419,9 @@ gst_text_overlay_set_property (GObject * object, guint prop_id,
gst_text_overlay_font_init (overlay);
break;
}
case ARG_SILENT:
overlay->silent = g_value_get_boolean (value);
break;
default:{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -431,6 +443,11 @@ gst_text_overlay_render_text (GstCairoTextOverlay * overlay,
gchar *string;
double x, y;
if (overlay->silent) {
GST_DEBUG_OBJECT (overlay, "Silent mode, not rendering");
return;
}
if (textlen < 0)
textlen = strlen (text);
......
......@@ -76,6 +76,7 @@ struct _GstCairoTextOverlay {
gint slant;
gint weight;
gdouble scale;
gboolean silent;
};
struct _GstCairoTextOverlayClass {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment