Text overlay
Original commit message from CVS: Text overlay
This commit is contained in:
parent
ad1a55bd75
commit
9985fa24f5
@ -6,22 +6,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "gsttextoverlay.h"
|
#include "gsttextoverlay.h"
|
||||||
//#include "gsttexttestsrc.h"
|
/*#include "gsttexttestsrc.h"*/
|
||||||
//#include "gstsubparse.h"
|
/*#include "gstsubparse.h"*/
|
||||||
//#include "SDL_blit.h"
|
/*#include "SDL_blit.h"*/
|
||||||
|
|
||||||
static GstElementDetails textoverlay_details = {
|
static GstElementDetails textoverlay_details = {
|
||||||
"Text Overlay",
|
"Text Overlay",
|
||||||
"Filter/Video",
|
"Filter/Video",
|
||||||
"LGPL",
|
|
||||||
"Adds text strings on top of a video buffer",
|
"Adds text strings on top of a video buffer",
|
||||||
VERSION,
|
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>"
|
||||||
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>",
|
|
||||||
"(C) 2003",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_TEXT,
|
ARG_TEXT,
|
||||||
@ -74,6 +69,7 @@ GST_PAD_TEMPLATE_FACTORY(text_sink_template_factory,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
static void gst_textoverlay_base_init (gpointer g_class);
|
||||||
static void gst_textoverlay_class_init(GstTextOverlayClass *klass);
|
static void gst_textoverlay_class_init(GstTextOverlayClass *klass);
|
||||||
static void gst_textoverlay_init(GstTextOverlay *overlay);
|
static void gst_textoverlay_init(GstTextOverlay *overlay);
|
||||||
static void gst_textoverlay_set_property(GObject *object,
|
static void gst_textoverlay_set_property(GObject *object,
|
||||||
@ -100,7 +96,7 @@ gst_textoverlay_get_type(void)
|
|||||||
if (!textoverlay_type) {
|
if (!textoverlay_type) {
|
||||||
static const GTypeInfo textoverlay_info = {
|
static const GTypeInfo textoverlay_info = {
|
||||||
sizeof(GstTextOverlayClass),
|
sizeof(GstTextOverlayClass),
|
||||||
NULL,
|
gst_textoverlay_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc)gst_textoverlay_class_init,
|
(GClassInitFunc)gst_textoverlay_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
@ -115,6 +111,17 @@ gst_textoverlay_get_type(void)
|
|||||||
return textoverlay_type;
|
return textoverlay_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_textoverlay_base_init (gpointer g_class)
|
||||||
|
{
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (textoverlay_src_template_factory));
|
||||||
|
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (video_sink_template_factory));
|
||||||
|
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (text_sink_template_factory));
|
||||||
|
|
||||||
|
gst_element_class_set_details (element_class, &textoverlay_details);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_textoverlay_class_init(GstTextOverlayClass *klass)
|
gst_textoverlay_class_init(GstTextOverlayClass *klass)
|
||||||
@ -625,33 +632,25 @@ gst_textoverlay_get_property(GObject *object, guint prop_id, GValue *value, GPar
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init(GModule *module, GstPlugin *plugin)
|
plugin_init(GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
GstElementFactory *factory;
|
if (!gst_element_register (plugin, "textoverlay", GST_RANK_PRIMARY, GST_TYPE_TEXTOVERLAY))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
factory = gst_element_factory_new("textoverlay", GST_TYPE_TEXTOVERLAY,
|
/*texttestsrc_plugin_init(module, plugin);*/
|
||||||
&textoverlay_details);
|
/*subparse_plugin_init(module, plugin);*/
|
||||||
g_return_val_if_fail(factory != NULL, FALSE);
|
|
||||||
gst_element_factory_set_rank(factory, GST_ELEMENT_RANK_PRIMARY);
|
|
||||||
|
|
||||||
gst_element_factory_add_pad_template(factory,
|
|
||||||
GST_PAD_TEMPLATE_GET(textoverlay_src_template_factory));
|
|
||||||
gst_element_factory_add_pad_template(factory,
|
|
||||||
GST_PAD_TEMPLATE_GET(video_sink_template_factory));
|
|
||||||
gst_element_factory_add_pad_template(factory,
|
|
||||||
GST_PAD_TEMPLATE_GET(text_sink_template_factory));
|
|
||||||
|
|
||||||
gst_plugin_add_feature(plugin, GST_PLUGIN_FEATURE(factory));
|
|
||||||
|
|
||||||
//texttestsrc_plugin_init(module, plugin);
|
|
||||||
//subparse_plugin_init(module, plugin);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPluginDesc plugin_desc = {
|
GST_PLUGIN_DEFINE (
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"textoverlay",
|
"textoverlay",
|
||||||
plugin_init
|
"Text overlay",
|
||||||
};
|
plugin_init,
|
||||||
|
VERSION,
|
||||||
|
"GPL",
|
||||||
|
GST_COPYRIGHT,
|
||||||
|
GST_PACKAGE,
|
||||||
|
GST_ORIGIN)
|
||||||
|
|
||||||
|
@ -42,11 +42,8 @@
|
|||||||
static GstElementDetails timeoverlay_details = {
|
static GstElementDetails timeoverlay_details = {
|
||||||
"Video Filter Template",
|
"Video Filter Template",
|
||||||
"Filter/Video",
|
"Filter/Video",
|
||||||
"LGPL",
|
|
||||||
"Template for a video filter",
|
"Template for a video filter",
|
||||||
VERSION,
|
|
||||||
"David Schleef <ds@schleef.org>",
|
"David Schleef <ds@schleef.org>",
|
||||||
"(C) 2003",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GstTimeoverlay signals and args */
|
/* GstTimeoverlay signals and args */
|
||||||
@ -60,6 +57,7 @@ enum {
|
|||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void gst_timeoverlay_base_init (gpointer g_class);
|
||||||
static void gst_timeoverlay_class_init (GstTimeoverlayClass *klass);
|
static void gst_timeoverlay_class_init (GstTimeoverlayClass *klass);
|
||||||
static void gst_timeoverlay_init (GstTimeoverlay *timeoverlay);
|
static void gst_timeoverlay_init (GstTimeoverlay *timeoverlay);
|
||||||
|
|
||||||
@ -80,7 +78,8 @@ gst_timeoverlay_get_type (void)
|
|||||||
|
|
||||||
if (!timeoverlay_type) {
|
if (!timeoverlay_type) {
|
||||||
static const GTypeInfo timeoverlay_info = {
|
static const GTypeInfo timeoverlay_info = {
|
||||||
sizeof(GstTimeoverlayClass), NULL,
|
sizeof(GstTimeoverlayClass),
|
||||||
|
gst_timeoverlay_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc)gst_timeoverlay_class_init,
|
(GClassInitFunc)gst_timeoverlay_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
@ -98,39 +97,6 @@ static GstVideofilterFormat gst_timeoverlay_formats[] = {
|
|||||||
{ "I420", 12, gst_timeoverlay_planar411, },
|
{ "I420", 12, gst_timeoverlay_planar411, },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
gst_timeoverlay_class_init (GstTimeoverlayClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
GstVideofilterClass *gstvideofilter_class;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
gobject_class = (GObjectClass*)klass;
|
|
||||||
gstelement_class = (GstElementClass*)klass;
|
|
||||||
gstvideofilter_class = (GstVideofilterClass *)klass;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD,
|
|
||||||
g_param_spec_enum("method","method","method",
|
|
||||||
GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_90R,
|
|
||||||
G_PARAM_READWRITE));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
this_class = klass;
|
|
||||||
parent_class = g_type_class_ref(GST_TYPE_VIDEOFILTER);
|
|
||||||
element_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
gobject_class->set_property = gst_timeoverlay_set_property;
|
|
||||||
gobject_class->get_property = gst_timeoverlay_get_property;
|
|
||||||
|
|
||||||
gstvideofilter_class->setup = gst_timeoverlay_setup;
|
|
||||||
|
|
||||||
for(i=0;i<G_N_ELEMENTS(gst_timeoverlay_formats);i++){
|
|
||||||
gst_videofilter_class_add_format(gstvideofilter_class, gst_timeoverlay_formats + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstCaps *gst_timeoverlay_get_capslist(void)
|
static GstCaps *gst_timeoverlay_get_capslist(void)
|
||||||
{
|
{
|
||||||
GstVideofilterClass *klass;
|
GstVideofilterClass *klass;
|
||||||
@ -176,6 +142,49 @@ gst_timeoverlay_sink_template_factory(void)
|
|||||||
return templ;
|
return templ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_timeoverlay_base_init (gpointer g_class)
|
||||||
|
{
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_timeoverlay_sink_template_factory));
|
||||||
|
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_timeoverlay_src_template_factory));
|
||||||
|
gst_element_class_set_details (element_class, &timeoverlay_details);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_timeoverlay_class_init (GstTimeoverlayClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class;
|
||||||
|
GstElementClass *gstelement_class;
|
||||||
|
GstVideofilterClass *gstvideofilter_class;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gobject_class = (GObjectClass*)klass;
|
||||||
|
gstelement_class = (GstElementClass*)klass;
|
||||||
|
gstvideofilter_class = (GstVideofilterClass *)klass;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD,
|
||||||
|
g_param_spec_enum("method","method","method",
|
||||||
|
GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_90R,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
this_class = klass;
|
||||||
|
parent_class = g_type_class_ref(GST_TYPE_VIDEOFILTER);
|
||||||
|
element_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
|
gobject_class->set_property = gst_timeoverlay_set_property;
|
||||||
|
gobject_class->get_property = gst_timeoverlay_get_property;
|
||||||
|
|
||||||
|
gstvideofilter_class->setup = gst_timeoverlay_setup;
|
||||||
|
|
||||||
|
for(i=0;i<G_N_ELEMENTS(gst_timeoverlay_formats);i++){
|
||||||
|
gst_videofilter_class_add_format(gstvideofilter_class, gst_timeoverlay_formats + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_timeoverlay_init (GstTimeoverlay *timeoverlay)
|
gst_timeoverlay_init (GstTimeoverlay *timeoverlay)
|
||||||
{
|
{
|
||||||
@ -238,32 +247,28 @@ gst_timeoverlay_get_property (GObject *object, guint prop_id, GValue *value, GPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean plugin_init (GModule *module, GstPlugin *plugin)
|
static gboolean plugin_init (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
GstElementFactory *factory;
|
|
||||||
|
|
||||||
if(!gst_library_load("gstvideofilter"))
|
if(!gst_library_load("gstvideofilter"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* create an elementfactory for the timeoverlay element */
|
if (!gst_element_register (plugin, "timeoverlay", GST_RANK_NONE, GST_TYPE_TIMEOVERLAY))
|
||||||
factory = gst_element_factory_new("timeoverlay",GST_TYPE_TIMEOVERLAY,
|
return FALSE;
|
||||||
&timeoverlay_details);
|
|
||||||
g_return_val_if_fail(factory != NULL, FALSE);
|
|
||||||
|
|
||||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_timeoverlay_sink_template_factory));
|
|
||||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_timeoverlay_src_template_factory));
|
|
||||||
|
|
||||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPluginDesc plugin_desc = {
|
GST_PLUGIN_DEFINE (
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"timeoverlay",
|
"timeoverlay",
|
||||||
plugin_init
|
"Time overlay",
|
||||||
};
|
plugin_init,
|
||||||
|
VERSION,
|
||||||
|
"LGPL",
|
||||||
|
GST_COPYRIGHT,
|
||||||
|
GST_PACKAGE,
|
||||||
|
GST_ORIGIN)
|
||||||
|
|
||||||
static void gst_timeoverlay_setup(GstVideofilter *videofilter)
|
static void gst_timeoverlay_setup(GstVideofilter *videofilter)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user