pango: Create a new pango context for every subclass

timeoverlay/clockoverlay are setting some global options
on the context that shouldn't be used for the generic textoverlay.
This commit is contained in:
Sebastian Dröge 2011-04-16 16:18:40 +02:00
parent e120c835c1
commit 9ee7398fae

View file

@ -352,6 +352,8 @@ static void
gst_text_overlay_base_init (gpointer g_class) gst_text_overlay_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstTextOverlayClass *klass = GST_TEXT_OVERLAY_CLASS (g_class);
PangoFontMap *fontmap;
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template_factory)); gst_static_pad_template_get (&src_template_factory));
@ -369,6 +371,10 @@ gst_text_overlay_base_init (gpointer g_class)
"Filter/Editor/Video", "Filter/Editor/Video",
"Adds text strings on top of a video buffer", "Adds text strings on top of a video buffer",
"David Schleef <ds@schleef.org>, " "Zeeshan Ali <zeeshan.ali@nokia.com>"); "David Schleef <ds@schleef.org>, " "Zeeshan Ali <zeeshan.ali@nokia.com>");
fontmap = pango_cairo_font_map_get_default ();
klass->pango_context =
pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
} }
static gchar * static gchar *
@ -382,7 +388,6 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
PangoFontMap *fontmap;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
@ -397,9 +402,6 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass)
klass->pango_lock = g_mutex_new (); klass->pango_lock = g_mutex_new ();
klass->get_text = gst_text_overlay_get_text; klass->get_text = gst_text_overlay_get_text;
fontmap = pango_cairo_font_map_get_default ();
klass->pango_context =
pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT,
g_param_spec_string ("text", "text", g_param_spec_string ("text", "text",