summaryrefslogtreecommitdiffstats
path: root/gst/videofilter/gstvideoflip.c
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-11-08 02:52:41 +0000
committerDavid Schleef <ds@schleef.org>2003-11-08 02:52:41 +0000
commitaee9dba783eb255ea9cf6bbecc2636ee33119092 (patch)
tree9a4286c36800b44fdb1575ebec974dd4fb8f6f91 /gst/videofilter/gstvideoflip.c
parentbd2c86e953767ebb957510ec6a4ea5859e568a46 (diff)
much cleanup hacking made possible by plugin changes
Original commit message from CVS: much cleanup hacking made possible by plugin changes
Diffstat (limited to 'gst/videofilter/gstvideoflip.c')
-rw-r--r--gst/videofilter/gstvideoflip.c232
1 files changed, 82 insertions, 150 deletions
diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c
index 375d3040..307f2f24 100644
--- a/gst/videofilter/gstvideoflip.c
+++ b/gst/videofilter/gstvideoflip.c
@@ -18,27 +18,19 @@
* Boston, MA 02111-1307, USA.
*/
+/*
+ * This file was (probably) generated from gstvideoflip.c,
+ * $Id$
+ */
-/*#define DEBUG_ENABLED */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <gstvideoflip.h>
-#include <stdlib.h>
-#include <math.h>
+/*#define DEBUG_ENABLED */
+#include <gstvideoflip.h>
#include <string.h>
-
-
-/* elementfactory information */
-static GstElementDetails videoflip_details = {
- "Video flipper",
- "Filter/Video",
- "Flips and rotates video",
- "David Schleef <ds@schleef.org>"
-};
-
/* GstVideoflip signals and args */
enum {
/* FILL ME */
@@ -51,9 +43,9 @@ enum {
/* FILL ME */
};
-static void gst_videoflip_class_init (GstVideoflipClass *klass);
-static void gst_videoflip_base_init (GstVideoflipClass *klass);
-static void gst_videoflip_init (GstVideoflip *videoflip);
+static void gst_videoflip_base_init (gpointer g_class);
+static void gst_videoflip_class_init (gpointer g_class, gpointer class_data);
+static void gst_videoflip_init (GTypeInstance *instance, gpointer g_class);
static void gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -61,10 +53,6 @@ static void gst_videoflip_get_property (GObject *object, guint prop_id, GValue
static void gst_videoflip_planar411(GstVideofilter *videofilter, void *dest, void *src);
static void gst_videoflip_setup(GstVideofilter *videofilter);
-static GstVideoflipClass *this_class = NULL;
-static GstVideofilterClass *parent_class = NULL;
-static GstElementClass *element_class = NULL;
-
#define GST_TYPE_VIDEOFLIP_METHOD (gst_videoflip_method_get_type())
static GType
@@ -72,19 +60,19 @@ gst_videoflip_method_get_type(void)
{
static GType videoflip_method_type = 0;
static GEnumValue videoflip_methods[] = {
- { GST_VIDEOFLIP_METHOD_IDENTITY, "0", "Identity (no rotation)" },
- { GST_VIDEOFLIP_METHOD_90R, "1", "Rotate clockwise 90 degrees" },
- { GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees" },
- { GST_VIDEOFLIP_METHOD_90L, "3", "Rotate counter-clockwise 90 degrees" },
- { GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally" },
- { GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically" },
- { GST_VIDEOFLIP_METHOD_TRANS, "6", "Flip across upper left/lower right diagonal" },
- { GST_VIDEOFLIP_METHOD_OTHER, "7", "Flip across upper right/lower left diagonal" },
+ { GST_VIDEOFLIP_METHOD_IDENTITY, "0", "Identity (no rotation)" },
+ { GST_VIDEOFLIP_METHOD_90R, "1", "Rotate clockwise 90 degrees" },
+ { GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees" },
+ { GST_VIDEOFLIP_METHOD_90L, "3", "Rotate counter-clockwise 90 degrees" },
+ { GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally" },
+ { GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically" },
+ { GST_VIDEOFLIP_METHOD_TRANS, "6", "Flip across upper left/lower right diagonal" },
+ { GST_VIDEOFLIP_METHOD_OTHER, "7", "Flip across upper right/lower left diagonal" },
{ 0, NULL, NULL },
};
if(!videoflip_method_type){
videoflip_method_type = g_enum_register_static("GstVideoflipMethod",
- videoflip_methods);
+ videoflip_methods);
}
return videoflip_method_type;
}
@@ -97,16 +85,17 @@ gst_videoflip_get_type (void)
if (!videoflip_type) {
static const GTypeInfo videoflip_info = {
sizeof(GstVideoflipClass),
- (GBaseInitFunc)gst_videoflip_base_init,
+ gst_videoflip_base_init,
NULL,
- (GClassInitFunc)gst_videoflip_class_init,
+ gst_videoflip_class_init,
NULL,
NULL,
sizeof(GstVideoflip),
0,
- (GInstanceInitFunc)gst_videoflip_init,
+ gst_videoflip_init,
};
- videoflip_type = g_type_register_static(GST_TYPE_VIDEOFILTER, "GstVideoflip", &videoflip_info, 0);
+ videoflip_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
+ "GstVideoflip", &videoflip_info, 0);
}
return videoflip_type;
}
@@ -118,133 +107,77 @@ static GstVideofilterFormat gst_videoflip_formats[] = {
{ "IYUV", 12, gst_videoflip_planar411, },
};
-static GstPadTemplate *gst_videoflip_sink_template_factory (void);
-static GstPadTemplate *gst_videoflip_src_template_factory (void);
-
static void
-gst_videoflip_base_init (GstVideoflipClass *klass)
+gst_videoflip_base_init (gpointer g_class)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory));
- gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory));
+ static GstElementDetails videoflip_details = GST_ELEMENT_DETAILS (
+ "Video Flipper",
+ "Filter/Video",
+ "Flips and rotates video",
+ "David Schleef <ds@schleef.org>"
+ );
+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
+ int i;
+
gst_element_class_set_details (element_class, &videoflip_details);
+
+ for(i=0;i<G_N_ELEMENTS(gst_videoflip_formats);i++){
+ gst_videofilter_class_add_format(videofilter_class,
+ gst_videoflip_formats + i);
+ }
+
+ gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
}
static void
-gst_videoflip_class_init (GstVideoflipClass *klass)
+gst_videoflip_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);
- 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_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
G_PARAM_READWRITE));
- 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_videoflip_set_property;
gobject_class->get_property = gst_videoflip_get_property;
- gstvideofilter_class->setup = gst_videoflip_setup;
-
- for(i=0;i<G_N_ELEMENTS(gst_videoflip_formats);i++){
- gst_videofilter_class_add_format(gstvideofilter_class,
- gst_videoflip_formats + i);
- }
-}
-
-static GstCaps *gst_videoflip_get_capslist(void)
-{
- GstVideofilterClass *klass;
-
- klass = g_type_class_ref(GST_TYPE_VIDEOFILTER);
-
- return gst_videofilter_class_get_capslist(klass);
-}
-
-static GstPadTemplate *
-gst_videoflip_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 (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
-
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
- }
- return templ;
-}
-
-static GstPadTemplate *
-gst_videoflip_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 (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
-
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
- }
- return templ;
+ videofilter_class->setup = gst_videoflip_setup;
}
static void
-gst_videoflip_init (GstVideoflip *videoflip)
+gst_videoflip_init (GTypeInstance *instance, gpointer g_class)
{
+ GstVideoflip *videoflip = GST_VIDEOFLIP (instance);
GstVideofilter *videofilter;
- GST_DEBUG ("gst_videoflip_init");
+ GST_DEBUG("gst_videoflip_init");
videofilter = GST_VIDEOFILTER(videoflip);
- videofilter->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory),
- "sink");
-
- videofilter->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory),
- "src");
-
- gst_videofilter_postinit(GST_VIDEOFILTER(videoflip));
+ /* do stuff */
}
static void
gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- GstVideoflip *videoflip;
+ GstVideoflip *src;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail(GST_IS_VIDEOFLIP(object));
- videoflip = GST_VIDEOFLIP(object);
+ src = GST_VIDEOFLIP(object);
- GST_DEBUG ("gst_videoflip_set_property");
+ GST_DEBUG("gst_videoflip_set_property");
switch (prop_id) {
case ARG_METHOD:
- videoflip->method = g_value_get_enum (value);
+ src->method = g_value_get_enum (value);
/* FIXME is this ok? (threading issues) */
- gst_videoflip_setup(GST_VIDEOFILTER(videoflip));
+ gst_videoflip_setup(GST_VIDEOFILTER(src));
break;
default:
break;
@@ -254,15 +187,15 @@ gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value,
static void
gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
- GstVideoflip *videoflip;
+ GstVideoflip *src;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail(GST_IS_VIDEOFLIP(object));
- videoflip = GST_VIDEOFLIP(object);
+ src = GST_VIDEOFLIP(object);
switch (prop_id) {
case ARG_METHOD:
- g_value_set_enum (value, videoflip->method);
+ g_value_set_enum (value, src->method);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -275,24 +208,23 @@ static gboolean plugin_init (GstPlugin *plugin)
if(!gst_library_load("gstvideofilter"))
return FALSE;
- return gst_element_register(plugin, "videoflip",
- GST_RANK_NONE, GST_TYPE_VIDEOFLIP);
+ return gst_element_register (plugin, "videoflip", GST_RANK_NONE,
+ GST_TYPE_VIDEOFLIP);
}
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"videoflip",
- "Flips video",
+ "Flips and rotates video",
plugin_init,
VERSION,
- "LGPL",
+ GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
-
static void gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest,
unsigned char *src, int sw, int sh, int dw, int dh);
@@ -332,9 +264,9 @@ static void gst_videoflip_setup (GstVideofilter *videofilter)
}
GST_DEBUG ("format=%p \"%s\" from %dx%d to %dx%d",
- videofilter->format, videofilter->format->fourcc,
- from_width, from_height,
- videofilter->to_width, videofilter->to_height);
+ videofilter->format, videofilter->format->fourcc,
+ from_width, from_height,
+ videofilter->to_width, videofilter->to_height);
if(videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY){
GST_DEBUG ("videoflip: using passthru");
@@ -344,9 +276,9 @@ static void gst_videoflip_setup (GstVideofilter *videofilter)
}
videofilter->from_buf_size = (videofilter->from_width * videofilter->from_height
- * videofilter->format->depth) / 8;
+ * videofilter->format->depth) / 8;
videofilter->to_buf_size = (videofilter->to_width * videofilter->to_height
- * videofilter->format->depth) / 8;
+ * videofilter->format->depth) / 8;
videofilter->inited = TRUE;
}
@@ -398,50 +330,50 @@ gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest,
case GST_VIDEOFLIP_METHOD_90R:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - x)*sw + y];
- }
+ dest[y*dw + x] = src[(sh - 1 - x)*sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_90L:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[x*sw + (sw - 1 - y)];
- }
+ dest[y*dw + x] = src[x*sw + (sw - 1 - y)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_180:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - y)*sw + (sw - 1 - x)];
- }
+ dest[y*dw + x] = src[(sh - 1 - y)*sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_HORIZ:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[y*sw + (sw - 1 - x)];
- }
+ dest[y*dw + x] = src[y*sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_VERT:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - y)*sw + x];
- }
+ dest[y*dw + x] = src[(sh - 1 - y)*sw + x];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_TRANS:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[x*sw + y];
- }
+ dest[y*dw + x] = src[x*sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_OTHER:
for(y=0;y<dh;y++){
for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - x)*sw + (sw - 1 - y)];
- }
+ dest[y*dw + x] = src[(sh - 1 - x)*sw + (sw - 1 - y)];
+ }
}
break;
default: