From: Tim-Philipp Müller Date: Thu, 15 Dec 2005 10:15:10 +0000 (+0000) Subject: ext/pango/gsttextoverlay.c: Don't operate on empty text buffers. Strip newlines and... X-Git-Tag: 1.19.3~511^2~12362 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbddac17ae27a93c8a20b2919371593759524d0a;p=platform%2Fupstream%2Fgstreamer.git ext/pango/gsttextoverlay.c: Don't operate on empty text buffers. Strip newlines and tabs only from the end of the tex... Original commit message from CVS: * ext/pango/gsttextoverlay.c: (gst_text_overlay_collected): Don't operate on empty text buffers. Strip newlines and tabs only from the end of the text, but leave them intact in the middle. Fix typo in gtk-doc description. --- diff --git a/ChangeLog b/ChangeLog index 4194584..4be0111 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2005-12-15 Tim-Philipp Müller + * ext/pango/gsttextoverlay.c: (gst_text_overlay_collected): + Don't operate on empty text buffers. Strip newlines and + tabs only from the end of the text, but leave them intact + in the middle. Fix typo in gtk-doc description. + +2005-12-15 Tim-Philipp Müller + * gst/playback/gstplaybasebin.c: * gst/playback/gstplaybin.c: (handoff): Make sure the video frame buffer we return to apps via the diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index ec3fe47..150c128 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -49,7 +49,7 @@ * * gst-launch -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink * - * If you do not have such a subtitle file, create on looking like this + * If you do not have such a subtitle file, create one looking like this * in a text editor: * * 1 @@ -870,7 +870,6 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data) GstBuffer *video_frame = NULL; GstBuffer *text_buf = NULL; gchar *text; - gint text_len; overlay = GST_TEXT_OVERLAY (data); klass = GST_TEXT_OVERLAY_GET_CLASS (data); @@ -983,10 +982,14 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data) /* text duration overlaps video frame duration */ 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) { + if (text != NULL && *text != '\0') { + gint text_len = strlen (text); + + while (text_len > 0 && (text[text_len - 1] == '\n' || + text[text_len - 1] == '\r')) { + --text_len; + } GST_DEBUG ("Rendering text '%*s'", text_len, text);; gst_text_overlay_render_text (overlay, text, text_len); } else {