mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
add ...set_font_desc() method to VideoTitleSource
This commit is contained in:
parent
ac31f1ab4d
commit
bae04feef4
3 changed files with 39 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue