* Copyright (C) 2001 Sun Microsystems
*/
+/*
+ * This file was (probably) generated from gsttimeoverlay.c,
+ * gsttimeoverlay.c,v 1.7 2003/11/08 02:48:59 dschleef Exp
+ */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*#define DEBUG_ENABLED */
#include <gsttimeoverlay.h>
-
+#include <string.h>
+#include <math.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
-#include <math.h>
-
-
-
-/* elementfactory information */
-static GstElementDetails timeoverlay_details = {
- "Video Filter Template",
- "Filter/Video",
- "Template for a video filter",
- "David Schleef <ds@schleef.org>",
-};
/* GstTimeoverlay signals and args */
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);
+static void gst_timeoverlay_base_init (gpointer g_class);
+static void gst_timeoverlay_class_init (gpointer g_class, gpointer class_data);
+static void gst_timeoverlay_init (GTypeInstance *instance, gpointer g_class);
static void gst_timeoverlay_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_timeoverlay_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_timeoverlay_planar411(GstVideofilter *videofilter, void *dest, void *src);
static void gst_timeoverlay_setup(GstVideofilter *videofilter);
-static GstTimeoverlayClass *this_class = NULL;
-static GstVideofilterClass *parent_class = NULL;
-static GstElementClass *element_class = NULL;
-
GType
gst_timeoverlay_get_type (void)
{
sizeof(GstTimeoverlayClass),
gst_timeoverlay_base_init,
NULL,
- (GClassInitFunc)gst_timeoverlay_class_init,
+ gst_timeoverlay_class_init,
NULL,
NULL,
sizeof(GstTimeoverlay),
0,
- (GInstanceInitFunc)gst_timeoverlay_init,
+ gst_timeoverlay_init,
};
- timeoverlay_type = g_type_register_static(GST_TYPE_VIDEOFILTER, "GstTimeoverlay", &timeoverlay_info, 0);
+ timeoverlay_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
+ "GstTimeoverlay", &timeoverlay_info, 0);
}
return timeoverlay_type;
}
{ "I420", 12, gst_timeoverlay_planar411, },
};
-static GstCaps *gst_timeoverlay_get_capslist(void)
-{
- GstVideofilterClass *klass;
-
- klass = g_type_class_ref(GST_TYPE_VIDEOFILTER);
-
- return gst_videofilter_class_get_capslist(klass);
-}
-
-static GstPadTemplate *
-gst_timeoverlay_src_template_factory(void)
-{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
- caps = gst_caps_intersect(caps, gst_timeoverlay_get_capslist ());
-
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
- }
- return templ;
-}
-
-static GstPadTemplate *
-gst_timeoverlay_sink_template_factory(void)
-{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
- caps = gst_caps_intersect(caps, gst_timeoverlay_get_capslist ());
-
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
- }
- return templ;
-}
-
+
static void
gst_timeoverlay_base_init (gpointer g_class)
{
+ static GstElementDetails timeoverlay_details = GST_ELEMENT_DETAILS (
+ "Time Overlay",
+ "Filter/Video",
+ "Overlays the time on a video stream",
+ "David Schleef <ds@schleef.org>"
+ );
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));
+ GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
+ int i;
+
gst_element_class_set_details (element_class, &timeoverlay_details);
+ for(i=0;i<G_N_ELEMENTS(gst_timeoverlay_formats);i++){
+ gst_videofilter_class_add_format(videofilter_class,
+ gst_timeoverlay_formats + i);
+ }
+
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
}
static void
-gst_timeoverlay_class_init (GstTimeoverlayClass *klass)
+gst_timeoverlay_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstVideofilterClass *gstvideofilter_class;
- int i;
+ GstVideofilterClass *videofilter_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
- gstvideofilter_class = (GstVideofilterClass *)klass;
+ gobject_class = G_OBJECT_CLASS (g_class);
+ videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
#if 0
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD,
+ g_object_class_install_property(gobject_class, ARG_METHOD,
g_param_spec_enum("method","method","method",
- GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_90R,
+ GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_1,
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);
- }
+ videofilter_class->setup = gst_timeoverlay_setup;
}
static void
-gst_timeoverlay_init (GstTimeoverlay *timeoverlay)
+gst_timeoverlay_init (GTypeInstance *instance, gpointer g_class)
{
+ GstTimeoverlay *timeoverlay = GST_TIMEOVERLAY (instance);
GstVideofilter *videofilter;
GST_DEBUG("gst_timeoverlay_init");
videofilter = GST_VIDEOFILTER(timeoverlay);
- videofilter->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_timeoverlay_sink_template_factory),
- "sink");
-
- videofilter->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_timeoverlay_src_template_factory),
- "src");
+ /* do stuff */
}
static void
if(!gst_library_load("gstvideofilter"))
return FALSE;
- if (!gst_element_register (plugin, "timeoverlay", GST_RANK_NONE, GST_TYPE_TIMEOVERLAY))
- return FALSE;
-
- return TRUE;
+ return gst_element_register (plugin, "timeoverlay", GST_RANK_NONE,
+ GST_TYPE_TIMEOVERLAY);
}
GST_PLUGIN_DEFINE (
"Time overlay",
plugin_init,
VERSION,
- "LGPL",
+ GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
- GST_ORIGIN)
+ GST_ORIGIN
+)
static void gst_timeoverlay_setup(GstVideofilter *videofilter)
{
void *dest, void *src)
{
GstTimeoverlay *timeoverlay;
- int height;
int width;
+ int height;
PangoRectangle logical_rect;
PangoLayout *layout;
int b_height, b_width;
width = gst_videofilter_get_input_width(videofilter);
height = gst_videofilter_get_input_height(videofilter);
+ width = gst_videofilter_get_input_width(videofilter);
+ height = gst_videofilter_get_input_height(videofilter);
+
layout = pango_layout_new (timeoverlay->context);
string = gst_timeoverlay_print_smpte_time(GST_BUFFER_TIMESTAMP(videofilter->in_buf));
pango_layout_set_text (layout, string, strlen(string));
for(i=0;i<b_height/2;i++){
memset(dest + width*height + i*(width/2), 128, b_width/2);
memset(dest + width*height + (width/2)*(height/2) + i*(width/2), 128,
- b_width/2);
+ b_width/2);
}
bitmap.rows = b_height;
bitmap.width = b_width;
pango_ft2_render_layout (&bitmap, layout, 0, 0);
}
+