ext/cairo/gsttextoverlay.c: Actually render the text from the text pad.

Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_render_text),
(gst_text_overlay_collected):
Actually render the text from the text pad.
This commit is contained in:
Tim-Philipp Müller 2005-11-29 15:42:01 +00:00
parent d84becd86b
commit 624d4cbda1
2 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2005-11-29 Tim-Philipp Müller <tim at centricular dot net>
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_render_text),
(gst_text_overlay_collected):
Actually render the text from the text pad.
2005-11-29 Edward Hervey <edward@fluendo.com>
* gst/debug/gstnavseek.c: (gst_navseek_event):

View file

@ -369,8 +369,8 @@ gst_text_overlay_set_property (GObject * object, guint prop_id,
}
static void
gst_text_overlay_render_text (GstCairoTextOverlay * overlay, gchar * text,
gint textlen)
gst_text_overlay_render_text (GstCairoTextOverlay * overlay,
const gchar * text, gint textlen)
{
cairo_text_extents_t extents;
cairo_surface_t *surface;
@ -759,6 +759,8 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
GstClockTime now, txt_end, frame_end;
GstBuffer *video_frame = NULL;
GstBuffer *text_buf = NULL;
gchar *text;
gint text_len;
overlay = GST_CAIRO_TEXT_OVERLAY (data);
@ -861,10 +863,23 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
}
/* text duration overlaps video frame duration */
GST_DEBUG ("Rendering '%*s'",
GST_BUFFER_SIZE (text_buf), GST_BUFFER_DATA (text_buf));
text = g_strndup ((gchar *) GST_BUFFER_DATA (text_buf),
GST_BUFFER_SIZE (text_buf));
g_strdelimit (text, "\n\r\t", ' ');
text_len = strlen (text);
if (text_len > 0) {
GST_DEBUG ("Rendering text '%*s'", text_len, text);;
gst_text_overlay_render_text (overlay, text, text_len);
} else {
GST_DEBUG ("No text to render (empty buffer)");
gst_text_overlay_render_text (overlay, " ", 1);
}
g_free (text);
gst_text_overlay_pop_video (overlay);
ret = gst_pad_push (overlay->srcpad, video_frame);
ret = gst_text_overlay_push_frame (overlay, video_frame);
video_frame = NULL;
goto done;