add ...set_font_desc() method to VideoTitleSource
authorBrandon Lewis <brandon@collabora.co.uk>
Wed, 16 Jun 2010 14:58:13 +0000 (16:58 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 9 Jul 2010 11:21:10 +0000 (13:21 +0200)
docs/libs/ges-sections.txt
ges/ges-track-video-title-source.c
ges/ges-track-video-title-source.h

index faff453..009227b 100644 (file)
@@ -404,6 +404,7 @@ GESTrackVideoTitleSource
 GESTrackVideoTitleSourceClass
 ges_tl_title_src_get_type
 ges_track_video_title_source_set_text
+ges_track_video_title_source_set_font_desc
 <SUBSECTION Standard>
 GES_TRACK_VIDEO_TITLE_SOURCE
 GES_TRACK_VIDEO_TITLE_SOURCE_CLASS
@@ -414,10 +415,12 @@ GES_TYPE_TRACK_VIDEO_TITLE_SOURCE
 </SECTION>
 
 <SECTION>
+<FILE>ges-track-audio-title-source</FILE>
 GESTrackAudioTitleSource
 GESTrackAudioTitleSourceClass
 ges_track_audio_title_source_new
 ges_track_audio_title_src_get_type
+DEFAULT_FONT_DESC
 <SUBSECTION Standard>
 GES_IS_TRACK_AUDIO_TITLE_SOURCE
 GES_IS_TRACK_AUDIO_TITLE_SOURCE_CLASS
index 2045ccd..39f7530 100644 (file)
@@ -70,6 +70,7 @@ static void
 ges_track_video_title_src_init (GESTrackVideoTitleSource * self)
 {
   self->text = NULL;
+  self->font_desc = g_strdup (DEFAULT_FONT_DESC);
   self->text_el = NULL;
   self->background_el = NULL;
 }
@@ -82,6 +83,10 @@ ges_track_video_title_src_dispose (GObject * object)
     g_free (self->text);
   }
 
+  if (self->font_desc) {
+    g_free (self->font_desc);
+  }
+
   if (self->text_el) {
     g_object_unref (self->text_el);
     self->text_el = NULL;
@@ -130,10 +135,14 @@ ges_track_video_title_src_create_element (GESTrackTitleSource * object)
 
   topbin = gst_bin_new ("titlesrc-bin");
   background = gst_element_factory_make ("videotestsrc", "titlesrc-bg");
+
   text = gst_element_factory_make ("textoverlay", "titlsrc-text");
   if (self->text) {
     g_object_set (text, "text", self->text, NULL);
   }
+  if (self->font_desc) {
+    g_object_set (text, "font-desc", self->font_desc, NULL);
+  }
 
   g_object_set (background, "pattern", (gint) GES_TRACK_VIDEO_BG_SRC_BLACK,
       NULL);
@@ -173,6 +182,25 @@ ges_track_video_title_source_set_text (GESTrackVideoTitleSource * self,
     g_object_set (self->text_el, "text", text, NULL);
 }
 
+/**
+ * ges_track_video_title_source_set_font_desc:
+ * @self: the #GESTrackVideoTitleSource* to set text on
+ * @font_desc: the pango font description
+ * 
+ * Sets the text this track object will render.
+ *
+ */
+
+void
+ges_track_video_title_source_set_font_desc (GESTrackVideoTitleSource * self,
+    const gchar * font_desc)
+{
+  self->font_desc = g_strdup (font_desc);
+  GST_LOG ("setting font-desc to '%s'", font_desc);
+  if (self->text_el)
+    g_object_set (self->text_el, "font-desc", font_desc, NULL);
+}
+
 GESTrackVideoTitleSource *
 ges_track_video_title_source_new (void)
 {
index 0ca050a..6c53530 100644 (file)
@@ -44,6 +44,9 @@ G_BEGIN_DECLS
 #define GES_TRACK_VIDEO_TITLE_SOURCE_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_VIDEO_TITLE_SOURCE, GESTrackVideoTitleSourceClass))
 
+#define DEFAULT_FONT_DESC "serif 36"
+
+
 /** 
  * GESTrackVideoTitleSource:
  * @parent: parent
@@ -54,6 +57,7 @@ struct _GESTrackVideoTitleSource {
 
   /*< private >*/
   gchar         *text;
+  gchar         *font_desc;
   GstElement    *text_el;
   GstElement    *background_el;
 };
@@ -71,7 +75,10 @@ struct _GESTrackVideoTitleSourceClass {
 
 GType ges_track_video_title_src_get_type (void);
 
-void ges_track_video_title_source_set_text(GESTrackVideoTitleSource *, const gchar *);
+void ges_track_video_title_source_set_text(GESTrackVideoTitleSource *, const
+    gchar *);
+void ges_track_video_title_source_set_font_desc(GESTrackVideoTitleSource *,
+    const gchar *);
 GESTrackVideoTitleSource* ges_track_video_title_source_new (void);
 
 G_END_DECLS