|
Packit |
971217 |
/* GStreamer
|
|
Packit |
971217 |
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
Packit |
971217 |
* Copyright (C) <2003> David Schleef <ds@schleef.org>
|
|
Packit |
971217 |
* Copyright (C) <2006> Julien Moutte <julien@moutte.net>
|
|
Packit |
971217 |
* Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
|
|
Packit |
971217 |
* Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
|
|
Packit |
971217 |
* Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
|
|
Packit |
971217 |
* Copyright (C) <2011> Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
971217 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
971217 |
* License as published by the Free Software Foundation; either
|
|
Packit |
971217 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
971217 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
971217 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
971217 |
* Library General Public License for more details.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
971217 |
* License along with this library; if not, write to the
|
|
Packit |
971217 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit |
971217 |
* Boston, MA 02110-1301, USA.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* SECTION:element-textoverlay
|
|
Packit |
971217 |
* @title: textoverlay
|
|
Packit |
971217 |
* @see_also: #GstTextRender, #GstTextOverlay, #GstTimeOverlay, #GstSubParse
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This plugin renders text on top of a video stream. This can be either
|
|
Packit |
971217 |
* static text or text from buffers received on the text sink pad, e.g.
|
|
Packit |
971217 |
* as produced by the subparse element. If the text sink pad is not linked,
|
|
Packit |
971217 |
* the text set via the "text" property will be rendered. If the text sink
|
|
Packit |
971217 |
* pad is linked, text will be rendered as it is received on that pad,
|
|
Packit |
971217 |
* honouring and matching the buffer timestamps of both input streams.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* The text can contain newline characters and text wrapping is enabled by
|
|
Packit |
971217 |
* default.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* ## Example launch lines
|
|
Packit |
971217 |
* |[
|
|
Packit |
971217 |
* gst-launch-1.0 -v videotestsrc ! textoverlay text="Room A" valignment=top halignment=left font-desc="Sans, 72" ! autovideosink
|
|
Packit |
971217 |
* ]|
|
|
Packit |
971217 |
* Here is a simple pipeline that displays a static text in the top left
|
|
Packit |
971217 |
* corner of the video picture
|
|
Packit |
971217 |
* |[
|
|
Packit |
971217 |
* gst-launch-1.0 -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! autovideosink
|
|
Packit |
971217 |
* ]|
|
|
Packit |
971217 |
* Here is another pipeline that displays subtitles from an .srt subtitle
|
|
Packit |
971217 |
* file, centered at the bottom of the picture and with a rectangular shading
|
|
Packit |
971217 |
* around the text in the background:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* If you do not have such a subtitle file, create one looking like this
|
|
Packit |
971217 |
* in a text editor:
|
|
Packit |
971217 |
* |[
|
|
Packit |
971217 |
* 1
|
|
Packit |
971217 |
* 00:00:03,000 --> 00:00:05,000
|
|
Packit |
971217 |
* Hello? (3-5s)
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* 2
|
|
Packit |
971217 |
* 00:00:08,000 --> 00:00:13,000
|
|
Packit |
971217 |
* Yes, this is a subtitle. Don't
|
|
Packit |
971217 |
* you like it? (8-13s)
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* 3
|
|
Packit |
971217 |
* 00:00:18,826 --> 00:01:02,886
|
|
Packit |
971217 |
* Uh? What are you talking about?
|
|
Packit |
971217 |
* I don't understand (18-62s)
|
|
Packit |
971217 |
* ]|
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
971217 |
#include "config.h"
|
|
Packit |
971217 |
#endif
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#include <gsttextoverlay.h>
|
|
Packit |
971217 |
|
|
Packit |
971217 |
static GstStaticPadTemplate text_sink_template_factory =
|
|
Packit |
971217 |
GST_STATIC_PAD_TEMPLATE ("text_sink",
|
|
Packit |
971217 |
GST_PAD_SINK,
|
|
Packit |
971217 |
GST_PAD_ALWAYS,
|
|
Packit |
971217 |
GST_STATIC_CAPS ("text/x-raw, format = { pango-markup, utf8 }")
|
|
Packit |
971217 |
);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
G_DEFINE_TYPE (GstTextOverlay, gst_text_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
static void
|
|
Packit |
971217 |
gst_text_overlay_class_init (GstTextOverlayClass * klass)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
GstElementClass *element_class = (GstElementClass *) klass;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_element_class_add_static_pad_template (element_class,
|
|
Packit |
971217 |
&text_sink_template_factory);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_element_class_set_static_metadata (element_class, "Text overlay",
|
|
Packit |
971217 |
"Filter/Editor/Video",
|
|
Packit |
971217 |
"Adds text strings on top of a video buffer",
|
|
Packit |
971217 |
"David Schleef <ds@schleef.org>, " "Zeeshan Ali <zeeshan.ali@nokia.com>");
|
|
Packit |
971217 |
}
|
|
Packit |
971217 |
|
|
Packit |
971217 |
static void
|
|
Packit |
971217 |
gst_text_overlay_init (GstTextOverlay * overlay)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
}
|