mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
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:
parent
d84becd86b
commit
624d4cbda1
2 changed files with 26 additions and 5 deletions
|
@ -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>
|
2005-11-29 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/debug/gstnavseek.c: (gst_navseek_event):
|
* gst/debug/gstnavseek.c: (gst_navseek_event):
|
||||||
|
|
|
@ -369,8 +369,8 @@ gst_text_overlay_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_text_overlay_render_text (GstCairoTextOverlay * overlay, gchar * text,
|
gst_text_overlay_render_text (GstCairoTextOverlay * overlay,
|
||||||
gint textlen)
|
const gchar * text, gint textlen)
|
||||||
{
|
{
|
||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
|
@ -759,6 +759,8 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
|
||||||
GstClockTime now, txt_end, frame_end;
|
GstClockTime now, txt_end, frame_end;
|
||||||
GstBuffer *video_frame = NULL;
|
GstBuffer *video_frame = NULL;
|
||||||
GstBuffer *text_buf = NULL;
|
GstBuffer *text_buf = NULL;
|
||||||
|
gchar *text;
|
||||||
|
gint text_len;
|
||||||
|
|
||||||
overlay = GST_CAIRO_TEXT_OVERLAY (data);
|
overlay = GST_CAIRO_TEXT_OVERLAY (data);
|
||||||
|
|
||||||
|
@ -861,10 +863,23 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* text duration overlaps video frame duration */
|
/* text duration overlaps video frame duration */
|
||||||
GST_DEBUG ("Rendering '%*s'",
|
text = g_strndup ((gchar *) GST_BUFFER_DATA (text_buf),
|
||||||
GST_BUFFER_SIZE (text_buf), 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);
|
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;
|
video_frame = NULL;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue