From 9985fa24f58d47a841fa08c2df152ec7e523db0e Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Sun, 2 Nov 2003 01:21:38 +0000 Subject: [PATCH] Text overlay Original commit message from CVS: Text overlay --- ext/pango/gsttextoverlay.c | 61 ++++++++++----------- ext/pango/gsttimeoverlay.c | 109 +++++++++++++++++++------------------ 2 files changed, 87 insertions(+), 83 deletions(-) diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 726d3799b2..7aaacd4243 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -6,22 +6,17 @@ #endif #include #include "gsttextoverlay.h" -//#include "gsttexttestsrc.h" -//#include "gstsubparse.h" -//#include "SDL_blit.h" +/*#include "gsttexttestsrc.h"*/ +/*#include "gstsubparse.h"*/ +/*#include "SDL_blit.h"*/ static GstElementDetails textoverlay_details = { "Text Overlay", "Filter/Video", - "LGPL", "Adds text strings on top of a video buffer", - VERSION, - "Gustavo J. A. M. Carneiro ", - "(C) 2003", + "Gustavo J. A. M. Carneiro " }; - - enum { ARG_0, 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_init(GstTextOverlay *overlay); static void gst_textoverlay_set_property(GObject *object, @@ -100,7 +96,7 @@ gst_textoverlay_get_type(void) if (!textoverlay_type) { static const GTypeInfo textoverlay_info = { sizeof(GstTextOverlayClass), - NULL, + gst_textoverlay_base_init, NULL, (GClassInitFunc)gst_textoverlay_class_init, NULL, @@ -115,6 +111,17 @@ gst_textoverlay_get_type(void) 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 gst_textoverlay_class_init(GstTextOverlayClass *klass) @@ -625,33 +632,25 @@ gst_textoverlay_get_property(GObject *object, guint prop_id, GValue *value, GPar } 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, - &textoverlay_details); - 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); + /*texttestsrc_plugin_init(module, plugin);*/ + /*subparse_plugin_init(module, plugin);*/ return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "textoverlay", - plugin_init -}; + "Text overlay", + plugin_init, + VERSION, + "GPL", + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN) diff --git a/ext/pango/gsttimeoverlay.c b/ext/pango/gsttimeoverlay.c index a9330e5187..dba7561242 100644 --- a/ext/pango/gsttimeoverlay.c +++ b/ext/pango/gsttimeoverlay.c @@ -42,11 +42,8 @@ static GstElementDetails timeoverlay_details = { "Video Filter Template", "Filter/Video", - "LGPL", "Template for a video filter", - VERSION, "David Schleef ", - "(C) 2003", }; /* GstTimeoverlay signals and args */ @@ -60,6 +57,7 @@ enum { /* FILL ME */ }; +static void gst_timeoverlay_base_init (gpointer g_class); static void gst_timeoverlay_class_init (GstTimeoverlayClass *klass); static void gst_timeoverlay_init (GstTimeoverlay *timeoverlay); @@ -80,7 +78,8 @@ gst_timeoverlay_get_type (void) if (!timeoverlay_type) { static const GTypeInfo timeoverlay_info = { - sizeof(GstTimeoverlayClass), NULL, + sizeof(GstTimeoverlayClass), + gst_timeoverlay_base_init, NULL, (GClassInitFunc)gst_timeoverlay_class_init, NULL, @@ -98,39 +97,6 @@ static GstVideofilterFormat gst_timeoverlay_formats[] = { { "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;iset_property = gst_timeoverlay_set_property; + gobject_class->get_property = gst_timeoverlay_get_property; + + gstvideofilter_class->setup = gst_timeoverlay_setup; + + for(i=0;i