From 1584d16b1c8d21c095d41f549fc893dd1fe01e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 18 Apr 2010 10:17:52 +0200 Subject: [PATCH] videofilter: Move all elements into a single plugin Having all these small elements in a separate plugin is not very memory effective... --- Makefile.am | 5 +++- gst/videofilter/Makefile.am | 44 ++++++++--------------------- gst/videofilter/gstgamma.c | 18 ++---------- gst/videofilter/gstvideobalance.c | 14 --------- gst/videofilter/gstvideoflip.c | 17 ++--------- gst/videofilter/plugin.c | 47 +++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 79 deletions(-) create mode 100644 gst/videofilter/plugin.c diff --git a/Makefile.am b/Makefile.am index 948593504b..0f0be61ef8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,10 @@ include $(top_srcdir)/common/coverage/lcov.mak CRUFT_FILES = \ $(top_builddir)/common/shave \ - $(top_builddir)/common/shave-libtool + $(top_builddir)/common/shave-libtool \ + $(top_builddir)/gst/videofilter/.libs/*videoflip.{so,dll,DLL,dylib} \ + $(top_builddir)/gst/videofilter/.libs/*videobalance.{so,dll,DLL,dylib} \ + $(top_builddir)/gst/videofilter/.libs/*gamma.{so,dll,DLL,dylib} include $(top_srcdir)/common/cruft.mak diff --git a/gst/videofilter/Makefile.am b/gst/videofilter/Makefile.am index 409affbb23..c21b93ee6b 100644 --- a/gst/videofilter/Makefile.am +++ b/gst/videofilter/Makefile.am @@ -1,46 +1,24 @@ -# noinst_LTLIBRARIES = libgstvideoexample.la -plugin_LTLIBRARIES = libgstvideoflip.la libgstvideobalance.la libgstgamma.la +plugin_LTLIBRARIES = libgstvideofilter.la noinst_HEADERS = gstvideoflip.h gstvideobalance.h gstgamma.h EXTRA_DIST = gstvideotemplate.c make_filter CLEANFILES = gstvideoexample.c -# libgstvideoexample_la_SOURCES = gstvideoexample.c -# libgstvideoexample_la_CFLAGS = $(GST_CFLAGS) -# libgstvideoexample_la_LIBADD = libgstvideofilter-@GST_MAJORMINOR@.la $(GST_LIBS) -# libgstvideoexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -# libgstvideoexample_la_LIBTOOLFLAGS = --tag=disable-static - -libgstvideoflip_la_SOURCES = gstvideoflip.c -libgstvideoflip_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) -libgstvideoflip_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ $(GST_BASE_LIBS) $(GST_LIBS) -libgstvideoflip_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstvideoflip_la_LIBTOOLFLAGS = --tag=disable-static - -libgstvideobalance_la_SOURCES = gstvideobalance.c -libgstvideobalance_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) -libgstvideobalance_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) \ - -lgstvideo-@GST_MAJORMINOR@ \ - -lgstinterfaces-@GST_MAJORMINOR@ \ - $(GST_BASE_LIBS) \ - $(GST_LIBS) \ - $(LIBM) -libgstvideobalance_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstvideobalance_la_LIBTOOLFLAGS = --tag=disable-static - -libgstgamma_la_SOURCES = gstgamma.c -libgstgamma_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS) \ +libgstvideofilter_la_SOURCES = plugin.c \ + gstvideoflip.c \ + gstvideobalance.c \ + gstgamma.c +libgstvideofilter_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS) \ $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) -libgstgamma_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \ +libgstvideofilter_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ + -lgstvideo-@GST_MAJORMINOR@ \ + -lgstinterfaces-@GST_MAJORMINOR@ \ $(GST_CONTROLLER_LIBS) \ $(GST_BASE_LIBS) $(GST_LIBS) -libgstgamma_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM) -libgstgamma_la_LIBTOOLFLAGS = --tag=disable-static +libgstvideofilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM) +libgstvideofilter_la_LIBTOOLFLAGS = --tag=disable-static gstvideoexample.c: $(srcdir)/make_filter $(srcdir)/gstvideotemplate.c $(srcdir)/make_filter Videoexample $(srcdir)/gstvideotemplate.c diff --git a/gst/videofilter/gstgamma.c b/gst/videofilter/gstgamma.c index aeab6efd6b..4f30de204c 100644 --- a/gst/videofilter/gstgamma.c +++ b/gst/videofilter/gstgamma.c @@ -131,6 +131,8 @@ gst_gamma_class_init (GstGammaClass * g_class) GObjectClass *gobject_class = (GObjectClass *) g_class; GstBaseTransformClass *trans_class = (GstBaseTransformClass *) g_class; + GST_DEBUG_CATEGORY_INIT (gamma_debug, "gamma", 0, "gamma"); + gobject_class->set_property = gst_gamma_set_property; gobject_class->get_property = gst_gamma_get_property; @@ -436,19 +438,3 @@ not_negotiated: return GST_FLOW_NOT_NEGOTIATED; } } - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gamma_debug, "gamma", 0, "gamma"); - - gst_controller_init (NULL, NULL); - - return gst_element_register (plugin, "gamma", GST_RANK_NONE, GST_TYPE_GAMMA); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gamma", - "Changes gamma on video images", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gst/videofilter/gstvideobalance.c b/gst/videofilter/gstvideobalance.c index 9ad0a6d2c2..fb78c12089 100644 --- a/gst/videofilter/gstvideobalance.c +++ b/gst/videofilter/gstvideobalance.c @@ -610,17 +610,3 @@ gst_video_balance_get_type (void) } return video_balance_type; } - - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "videobalance", GST_RANK_NONE, - GST_TYPE_VIDEO_BALANCE); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "videobalance", - "Changes hue, saturation, brightness etc. on video images", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c index 3f018e0475..74c7378809 100644 --- a/gst/videofilter/gstvideoflip.c +++ b/gst/videofilter/gstvideoflip.c @@ -625,6 +625,8 @@ gst_video_flip_class_init (gpointer klass, gpointer class_data) GObjectClass *gobject_class; GstBaseTransformClass *trans_class; + GST_DEBUG_CATEGORY_INIT (video_flip_debug, "videoflip", 0, "videoflip"); + gobject_class = (GObjectClass *) klass; trans_class = (GstBaseTransformClass *) klass; @@ -659,15 +661,6 @@ gst_video_flip_init (GTypeInstance * instance, gpointer g_class) GST_DEBUG_FUNCPTR (gst_video_flip_handle_src_event)); } -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (video_flip_debug, "videoflip", 0, "videoflip"); - - return gst_element_register (plugin, "videoflip", GST_RANK_NONE, - GST_TYPE_VIDEO_FLIP); -} - GType gst_video_flip_get_type (void) { @@ -691,9 +684,3 @@ gst_video_flip_get_type (void) } return video_flip_type; } - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "videoflip", - "Flips and rotates video", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gst/videofilter/plugin.c b/gst/videofilter/plugin.c new file mode 100644 index 0000000000..e0fcede731 --- /dev/null +++ b/gst/videofilter/plugin.c @@ -0,0 +1,47 @@ +/* GStreamer + * Copyright (C) 2010 Sebastian Dröge + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "gstgamma.h" +#include "gstvideoflip.h" +#include "gstvideobalance.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + gst_controller_init (NULL, NULL); + + return (gst_element_register (plugin, "gamma", GST_RANK_NONE, GST_TYPE_GAMMA) + && gst_element_register (plugin, "videobalance", GST_RANK_NONE, + GST_TYPE_VIDEO_BALANCE) + && gst_element_register (plugin, "videoflip", GST_RANK_NONE, + GST_TYPE_VIDEO_FLIP)); +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "videofilter", + "Video filters plugin", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);