X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fmedian%2Fgstmedian.c;h=b4d41660c630dbf5bc1334eac7375c4d0ec60b5d;hb=e46d34995dbfd1481f962b620df4dfa4266f7977;hp=e1e84b25f93dba1f3c63807ffc277a1ab458fc3c;hpb=90da904f1e435812ce245928b80cfd325785ff37;p=platform%2Fupstream%2Fgst-plugins-good.git diff --git a/gst/median/gstmedian.c b/gst/median/gstmedian.c index e1e84b2..b4d4166 100644 --- a/gst/median/gstmedian.c +++ b/gst/median/gstmedian.c @@ -22,26 +22,26 @@ #endif #include #include +#include /* elementfactory information */ static GstElementDetails median_details = { "Median effect", - "Filter/Video", - "LGPL", + "Filter/Effect/Video", "Apply a median filter to an image", - VERSION, - "Wim Taymans ", - "(C) 2000", + "Wim Taymans " }; GST_PAD_TEMPLATE_FACTORY (median_src_factory, "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( + gst_caps_new ( "median_src", - "video/raw", - "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + "video/x-raw-yuv", + GST_VIDEO_YUV_PAD_TEMPLATE_PROPS ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + ) ) ) @@ -49,10 +49,12 @@ GST_PAD_TEMPLATE_FACTORY (median_sink_factory, "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "median_src", - "video/raw", - "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + gst_caps_new ( + "median_src", + "video/x-raw-yuv", + GST_VIDEO_YUV_PAD_TEMPLATE_PROPS ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + ) ) ) @@ -72,11 +74,12 @@ enum { static GType gst_median_get_type (void); static void gst_median_class_init (GstMedianClass *klass); +static void gst_median_base_init (GstMedianClass *klass); static void gst_median_init (GstMedian *median); static void median_5 (unsigned char *src, unsigned char *dest, int height, int width); static void median_9 (unsigned char *src, unsigned char *dest, int height, int width); -static void gst_median_chain (GstPad *pad, GstBuffer *buf); +static void gst_median_chain (GstPad *pad, GstData *_data); static void gst_median_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_median_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); @@ -91,7 +94,10 @@ gst_median_get_type (void) if (!median_type) { static const GTypeInfo median_info = { - sizeof(GstMedianClass), NULL, NULL, (GClassInitFunc)gst_median_class_init, + sizeof(GstMedianClass), + (GBaseInitFunc)gst_median_base_init, + NULL, + (GClassInitFunc)gst_median_class_init, NULL, NULL, sizeof(GstMedian), @@ -104,6 +110,18 @@ gst_median_get_type (void) } static void +gst_median_base_init (GstMedianClass *klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + GST_PAD_TEMPLATE_GET (median_sink_factory)); + gst_element_class_add_pad_template (element_class, + GST_PAD_TEMPLATE_GET (median_src_factory)); + gst_element_class_set_details (element_class, &median_details); +} + +static void gst_median_class_init (GstMedianClass *klass) { GObjectClass *gobject_class; @@ -262,8 +280,9 @@ median_9 (unsigned char *src, unsigned char *dest, int width, int height) } static void -gst_median_chain (GstPad *pad, GstBuffer *buf) +gst_median_chain (GstPad *pad, GstData *_data) { + GstBuffer *buf = GST_BUFFER (_data); GstMedian *median; guchar *data; gulong size; @@ -278,7 +297,7 @@ gst_median_chain (GstPad *pad, GstBuffer *buf) median = GST_MEDIAN (GST_OBJECT_PARENT (pad)); if (!median->active) { - gst_pad_push(median->srcpad,buf); + gst_pad_push(median->srcpad,GST_DATA (buf)); return; } @@ -318,7 +337,7 @@ gst_median_chain (GstPad *pad, GstBuffer *buf) gst_buffer_unref(buf); - gst_pad_push(median->srcpad,outbuf); + gst_pad_push(median->srcpad,GST_DATA (outbuf)); } static void @@ -379,26 +398,20 @@ gst_median_get_property (GObject *object, guint prop_id, GValue *value, GParamSp static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - GstElementFactory *factory; - - factory = gst_element_factory_new("median",GST_TYPE_MEDIAN, - &median_details); - g_return_val_if_fail(factory != NULL, FALSE); - - gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (median_sink_factory)); - gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (median_src_factory)); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; + return gst_element_register (plugin, "median", + GST_RANK_NONE, GST_TYPE_MEDIAN); } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "median", - plugin_init -}; - + "Video median filter", + plugin_init, + VERSION, + GST_LICENSE, + GST_PACKAGE, + GST_ORIGIN +)