diff options
Diffstat (limited to 'gst/videoflip/gstvideoflip.c')
-rw-r--r-- | gst/videoflip/gstvideoflip.c | 125 |
1 files changed, 64 insertions, 61 deletions
diff --git a/gst/videoflip/gstvideoflip.c b/gst/videoflip/gstvideoflip.c index d5013b81..3b4a5450 100644 --- a/gst/videoflip/gstvideoflip.c +++ b/gst/videoflip/gstvideoflip.c @@ -28,15 +28,12 @@ /* elementfactory information */ -static GstElementDetails videoflip_details = { +static GstElementDetails videoflip_details = GST_ELEMENT_DETAILS ( "Video scaler", "Filter/Video", - "LGPL", "Resizes video", - VERSION, - "Wim Taymans <wim.taymans@chello.be>", - "(C) 2000", -}; + "Wim Taymans <wim.taymans@chello.be>" +); /* GstVideoflip signals and args */ enum { @@ -50,6 +47,7 @@ enum { /* FILL ME */ }; +static void gst_videoflip_base_init (gpointer g_class); static void gst_videoflip_class_init (GstVideoflipClass *klass); static void gst_videoflip_init (GstVideoflip *videoflip); @@ -85,6 +83,43 @@ gst_videoflip_method_get_type(void) return videoflip_method_type; } +static GstPadTemplate * +gst_videoflip_src_template_factory(void) +{ + static GstPadTemplate *templ = NULL; + + if(!templ){ + /* well, actually RGB too, but since there's no RGB format anyway */ + 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; +} + GType gst_videoflip_get_type (void) { @@ -92,7 +127,8 @@ gst_videoflip_get_type (void) if (!videoflip_type) { static const GTypeInfo videoflip_info = { - sizeof(GstVideoflipClass), NULL, + sizeof(GstVideoflipClass), + gst_videoflip_base_init, NULL, (GClassInitFunc)gst_videoflip_class_init, NULL, @@ -107,6 +143,16 @@ gst_videoflip_get_type (void) } static void +gst_videoflip_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (element_class, &videoflip_details); + + 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 void gst_videoflip_class_init (GstVideoflipClass *klass) { GObjectClass *gobject_class; @@ -127,43 +173,6 @@ gst_videoflip_class_init (GstVideoflipClass *klass) } -static GstPadTemplate * -gst_videoflip_src_template_factory(void) -{ - static GstPadTemplate *templ = NULL; - - if(!templ){ - /* well, actually RGB too, but since there's no RGB format anyway */ - 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; -} - static GstCaps * gst_videoflip_get_capslist(void) { @@ -438,26 +447,20 @@ gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GPara static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - GstElementFactory *factory; - - /* create an elementfactory for the videoflip element */ - factory = gst_element_factory_new("videoflip",GST_TYPE_VIDEOFLIP, - &videoflip_details); - g_return_val_if_fail(factory != NULL, FALSE); - - gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory)); - gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory)); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; + return gst_element_register (plugin, "videoflip", GST_RANK_NONE, GST_TYPE_VIDEOFLIP); } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "videoflip", - plugin_init -}; + "Resizes video", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) |