mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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.
This commit is contained in:
parent
f2e9c13e3f
commit
bbddac17ae
2 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2005-12-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* 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 <tim at centricular dot net>
|
2005-12-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/playback/gstplaybasebin.c:
|
* gst/playback/gstplaybasebin.c:
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
* <programlisting>
|
* <programlisting>
|
||||||
* gst-launch -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink
|
* gst-launch -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink
|
||||||
* </programlisting>
|
* </programlisting>
|
||||||
* 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:
|
* in a text editor:
|
||||||
* <programlisting>
|
* <programlisting>
|
||||||
* 1
|
* 1
|
||||||
|
@ -870,7 +870,6 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
|
||||||
GstBuffer *video_frame = NULL;
|
GstBuffer *video_frame = NULL;
|
||||||
GstBuffer *text_buf = NULL;
|
GstBuffer *text_buf = NULL;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gint text_len;
|
|
||||||
|
|
||||||
overlay = GST_TEXT_OVERLAY (data);
|
overlay = GST_TEXT_OVERLAY (data);
|
||||||
klass = GST_TEXT_OVERLAY_GET_CLASS (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 duration overlaps video frame duration */
|
||||||
text = g_strndup ((gchar *) GST_BUFFER_DATA (text_buf),
|
text = g_strndup ((gchar *) GST_BUFFER_DATA (text_buf),
|
||||||
GST_BUFFER_SIZE (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_DEBUG ("Rendering text '%*s'", text_len, text);;
|
||||||
gst_text_overlay_render_text (overlay, text, text_len);
|
gst_text_overlay_render_text (overlay, text, text_len);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue