=================================================================== RCS file: /cvs/gstreamer/gst-plugins/gst/playback/gstplaybin.c,v retrieving revision 1.36.2.1 retrieving revision 1.36.2.2 diff -u -r1.36.2.1 -r1.36.2.2 --- gstplaybin.c 2005/03/10 14:44:00 1.36.2.1 +++ gstplaybin.c 2005/04/01 15:44:20 1.36.2.2 @@ -49,6 +49,7 @@ GstElement *video_sink; GstElement *visualisation; GstElement *volume_element; + GstElement *textoverlay_element; gfloat volume; /* these are the currently active sinks */ @@ -65,6 +66,9 @@ /* boolean to see if we're currently switching groups */ gboolean group_switch; + + /* font description */ + gchar *font_desc; }; struct _GstPlayBinClass @@ -80,7 +84,8 @@ ARG_VIDEO_SINK, ARG_VIS_PLUGIN, ARG_VOLUME, - ARG_FRAME + ARG_FRAME, + ARG_FONT_DESC }; /* signals */ @@ -182,13 +187,18 @@ g_param_spec_object ("vis-plugin", "Vis plugin", "the visualization element to use (NULL = none)", GST_TYPE_ELEMENT, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (gobject_klass), ARG_VOLUME, + g_object_class_install_property (gobject_klass, ARG_VOLUME, g_param_spec_double ("volume", "volume", "volume", 0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (gobject_klass), ARG_FRAME, + g_object_class_install_property (gobject_klass, ARG_FRAME, g_param_spec_boxed ("frame", "Frame", "The last frame (NULL = no video available)", GST_TYPE_BUFFER, G_PARAM_READABLE)); + g_object_class_install_property (gobject_klass, ARG_FONT_DESC, + g_param_spec_string ("subtitle-font-desc", + "Subtitle font description", + "Pango font description of font " + "to be used for subtitle rendering", NULL, G_PARAM_WRITABLE)); gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_bin_dispose); @@ -216,10 +226,12 @@ play_bin->audio_sink = NULL; play_bin->visualisation = NULL; play_bin->volume_element = NULL; + play_bin->textoverlay_element = NULL; play_bin->volume = 1.0; play_bin->seekables = NULL; play_bin->sinks = NULL; play_bin->frame = NULL; + play_bin->font_desc = NULL; play_bin->cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) gst_object_unref); play_bin->group_switch = FALSE; @@ -253,7 +265,8 @@ gst_object_unref (GST_OBJECT (play_bin->visualisation)); play_bin->visualisation = NULL; } - + g_free (play_bin->font_desc); + play_bin->font_desc = NULL; if (G_OBJECT_CLASS (parent_class)->dispose) { G_OBJECT_CLASS (parent_class)->dispose (object); @@ -314,6 +327,14 @@ play_bin->volume, NULL); } break; + case ARG_FONT_DESC: + g_free (play_bin->font_desc); + play_bin->font_desc = g_strdup (g_value_get_string (value)); + if (play_bin->textoverlay_element) { + g_object_set (G_OBJECT (play_bin->textoverlay_element), + "font-desc", g_value_get_string (value), NULL); + } + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -455,6 +476,11 @@ overlay = gst_element_factory_make ("textoverlay", "overlay"); g_object_set (G_OBJECT (overlay), "halign", "center", "valign", "bottom", NULL); + play_bin->textoverlay_element = overlay; + if (play_bin->font_desc) { + g_object_set (G_OBJECT (play_bin->textoverlay_element), + "font-desc", play_bin->font_desc, NULL); + } vbin = gen_video_element (play_bin); if (!overlay) { g_warning ("No overlay (pango) element, subtitles disabled"); @@ -674,6 +700,9 @@ gst_buffer_unref (play_bin->frame); play_bin->frame = NULL; } + + play_bin->textoverlay_element = NULL; + play_bin->volume_element = NULL; } /* loop over the streams and set up the pipeline to play this