From 565efa30eaa05fd415a1ca54c13aa5ede117a26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 29 Mar 2011 10:42:31 +0200 Subject: [PATCH] funnel: Integrate into the build system and rename the types --- docs/plugins/gstreamer-plugins-docs.sgml | 1 + docs/plugins/gstreamer-plugins-sections.txt | 15 ++ docs/plugins/gstreamer-plugins.hierarchy | 49 +++---- docs/plugins/inspect/plugin-coreelements.xml | 21 +++ .../plugins/inspect/plugin-staticelements.xml | 12 ++ plugins/elements/Makefile.am | 2 + plugins/elements/gstelements.c | 2 + plugins/elements/gstfunnel.c | 131 ++++++++---------- plugins/elements/gstfunnel.h | 44 +++--- tests/check/Makefile.am | 1 + tests/check/elements/funnel.c | 4 +- 11 files changed, 158 insertions(+), 124 deletions(-) create mode 100644 docs/plugins/inspect/plugin-staticelements.xml diff --git a/docs/plugins/gstreamer-plugins-docs.sgml b/docs/plugins/gstreamer-plugins-docs.sgml index 3d6a15cb6a..a6c34e9e0f 100644 --- a/docs/plugins/gstreamer-plugins-docs.sgml +++ b/docs/plugins/gstreamer-plugins-docs.sgml @@ -24,6 +24,7 @@ + diff --git a/docs/plugins/gstreamer-plugins-sections.txt b/docs/plugins/gstreamer-plugins-sections.txt index 742fdf9dad..e862a13f73 100644 --- a/docs/plugins/gstreamer-plugins-sections.txt +++ b/docs/plugins/gstreamer-plugins-sections.txt @@ -95,6 +95,21 @@ GST_IS_FILE_SINK_CLASS gst_file_sink_get_type +
+element-funnel +funnel +GstFunnel + +GstFunnelClass +GST_FUNNEL +GST_IS_FUNNEL +GST_TYPE_FUNNEL +GST_FUNNEL_CLASS +GST_IS_FUNNEL_CLASS + +gst_funnel_get_type +
+
element-capsfilter capsfilter diff --git a/docs/plugins/gstreamer-plugins.hierarchy b/docs/plugins/gstreamer-plugins.hierarchy index d6a33d1a23..4201ecb5b2 100644 --- a/docs/plugins/gstreamer-plugins.hierarchy +++ b/docs/plugins/gstreamer-plugins.hierarchy @@ -1,43 +1,44 @@ GObject GstObject - GstBus - GstClock + GstPad + GstPadTemplate + GstPluginFeature + GstElementFactory + GstTypeFindFactory + GstIndexFactory GstElement + GstBin + GstPipeline + GstBaseTransform + GstCapsFilter + GstIdentity + GstBaseSrc + GstFakeSrc + GstPushSrc + GstFdSrc + GstFileSrc GstBaseSink GstFakeSink GstFdSink GstFileSink - GstBaseSrc - GstFakeSrc - GstFileSrc - GstPushSrc - GstFdSrc - GstBaseTransform - GstCapsFilter - GstIdentity - GstBin - GstPipeline + GstFunnel GstInputSelector - GstMultiQueue GstOutputSelector GstQueue GstQueue2 GstTee GstTypeFindElement + GstMultiQueue GstValve - GstIndex - GstFileIndex - GstMemIndex - GstPad - GstPadTemplate - GstPlugin - GstPluginFeature - GstElementFactory - GstIndexFactory - GstTypeFindFactory - GstRegistry + GstBus GstTask GstTaskPool + GstClock + GstPlugin + GstRegistry + GstIndex + GstMemIndex + GstFileIndex GstSignalObject GInterface GTypePlugin diff --git a/docs/plugins/inspect/plugin-coreelements.xml b/docs/plugins/inspect/plugin-coreelements.xml index 10036790c8..d0acd6440b 100644 --- a/docs/plugins/inspect/plugin-coreelements.xml +++ b/docs/plugins/inspect/plugin-coreelements.xml @@ -120,6 +120,27 @@ + + funnel + Farsight Funnel pipe fitting + Generic + N-to-1 pipe fitting + Olivier Crete <olivier.crete@collabora.co.uk> + + + sink%d + sink + request +
ANY
+
+ + src + source + always +
ANY
+
+
+
identity Identity diff --git a/docs/plugins/inspect/plugin-staticelements.xml b/docs/plugins/inspect/plugin-staticelements.xml new file mode 100644 index 0000000000..75b81e9831 --- /dev/null +++ b/docs/plugins/inspect/plugin-staticelements.xml @@ -0,0 +1,12 @@ + + staticelements core elements linked into the GStreamer library 0.10.29.1 LGPL gstreamer GStreamer git Unknown package origin + + bin Generic bin Generic/Bin Simple container object Erik Walthinsen <omega@cse.ogi.edu>,Wim Taymans <wim.taymans@gmail.com> + + + + pipeline Pipeline object Generic/Bin Complete pipeline object Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim@fluendo.com> + + + + diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am index 0106deb383..b37592980e 100644 --- a/plugins/elements/Makefile.am +++ b/plugins/elements/Makefile.am @@ -11,6 +11,7 @@ libgstcoreelements_la_SOURCES = \ gstfdsink.c \ gstfilesink.c \ gstfilesrc.c \ + gstfunnel.c \ gstidentity.c \ gstinputselector.c \ gstoutputselector.c \ @@ -36,6 +37,7 @@ noinst_HEADERS = \ gstfdsink.h \ gstfilesink.h \ gstfilesrc.h \ + gstfunnel.h \ gstidentity.h \ gstinputselector.h \ gstoutputselector.h \ diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index 581ed9d950..8d00729c0a 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -34,6 +34,7 @@ #include "gstfdsink.h" #include "gstfilesink.h" #include "gstfilesrc.h" +#include "gstfunnel.h" #include "gstidentity.h" #include "gstinputselector.h" #include "gstoutputselector.h" @@ -61,6 +62,7 @@ static struct _elements_entry _elements[] = { {"fdsink", GST_RANK_NONE, gst_fd_sink_get_type}, #endif {"filesrc", GST_RANK_PRIMARY, gst_file_src_get_type}, + {"funnel", GST_RANK_NONE, gst_funnel_get_type}, {"identity", GST_RANK_NONE, gst_identity_get_type}, {"input-selector", GST_RANK_NONE, gst_input_selector_get_type}, {"output-selector", GST_RANK_NONE, gst_output_selector_get_type}, diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c index 96d0871257..25b66ec32e 100644 --- a/plugins/elements/gstfunnel.c +++ b/plugins/elements/gstfunnel.c @@ -1,11 +1,11 @@ /* - * Farsight2 - Farsight Funnel element + * GStreamer Funnel element * * Copyright 2007 Collabora Ltd. * @author: Olivier Crete * Copyright 2007 Nokia Corp. * - * fs-funnel.c: Simple Funnel element + * gstfunnel.c: Simple Funnel element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,26 +23,20 @@ */ /** - * SECTION:element-fsfunnel + * SECTION:element-funnel * @short_description: N-to-1 simple funnel * * Takes packets from various input sinks into one output source */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif -#include "fs-funnel.h" +#include "gstfunnel.h" -GST_DEBUG_CATEGORY_STATIC (fs_funnel_debug); -#define GST_CAT_DEFAULT fs_funnel_debug - -static const GstElementDetails fs_funnel_details = -GST_ELEMENT_DETAILS ("Farsight Funnel pipe fitting", - "Generic", - "N-to-1 pipe fitting", - "Olivier Crete "); +GST_DEBUG_CATEGORY_STATIC (gst_funnel_debug); +#define GST_CAT_DEFAULT gst_funnel_debug static GstStaticPadTemplate funnel_sink_template = GST_STATIC_PAD_TEMPLATE ("sink%d", @@ -56,44 +50,43 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); - static void _do_init (GType type) { - GST_DEBUG_CATEGORY_INIT (fs_funnel_debug, "fsfunnel", 0, "fsfunnel element"); + GST_DEBUG_CATEGORY_INIT (gst_funnel_debug, "funnel", 0, "funnel element"); } -GST_BOILERPLATE_FULL (FsFunnel, fs_funnel, GstElement, GST_TYPE_ELEMENT, +GST_BOILERPLATE_FULL (GstFunnel, gst_funnel, GstElement, GST_TYPE_ELEMENT, _do_init); - - -static GstStateChangeReturn fs_funnel_change_state (GstElement * element, +static GstStateChangeReturn gst_funnel_change_state (GstElement * element, GstStateChange transition); -static GstPad *fs_funnel_request_new_pad (GstElement * element, +static GstPad *gst_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name); -static void fs_funnel_release_pad (GstElement * element, GstPad * pad); +static void gst_funnel_release_pad (GstElement * element, GstPad * pad); -static GstFlowReturn fs_funnel_buffer_alloc (GstPad * pad, guint64 offset, +static GstFlowReturn gst_funnel_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); -static GstFlowReturn fs_funnel_chain (GstPad * pad, GstBuffer * buffer); -static gboolean fs_funnel_event (GstPad * pad, GstEvent * event); -static gboolean fs_funnel_src_event (GstPad * pad, GstEvent * event); -static GstCaps *fs_funnel_getcaps (GstPad * pad); +static GstFlowReturn gst_funnel_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_funnel_event (GstPad * pad, GstEvent * event); +static gboolean gst_funnel_src_event (GstPad * pad, GstEvent * event); +static GstCaps *gst_funnel_getcaps (GstPad * pad); typedef struct { GstSegment segment; -} FsFunnelPadPrivate; +} GstFunnelPadPrivate; static void -fs_funnel_base_init (gpointer g_class) +gst_funnel_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_set_details (gstelement_class, &fs_funnel_details); + gst_element_class_set_details_simple (gstelement_class, + "Farsight Funnel pipe fitting", "Generic", "N-to-1 pipe fitting", + "Olivier Crete "); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&funnel_sink_template)); @@ -103,7 +96,7 @@ fs_funnel_base_init (gpointer g_class) static void -fs_funnel_dispose (GObject * object) +gst_funnel_dispose (GObject * object) { GList *item; @@ -121,34 +114,34 @@ restart: } static void -fs_funnel_class_init (FsFunnelClass * klass) +gst_funnel_class_init (GstFunnelClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - gobject_class->dispose = GST_DEBUG_FUNCPTR (fs_funnel_dispose); + gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_funnel_dispose); gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (fs_funnel_request_new_pad); - gstelement_class->release_pad = GST_DEBUG_FUNCPTR (fs_funnel_release_pad); - gstelement_class->change_state = GST_DEBUG_FUNCPTR (fs_funnel_change_state); + GST_DEBUG_FUNCPTR (gst_funnel_request_new_pad); + gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_funnel_release_pad); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_funnel_change_state); } static void -fs_funnel_init (FsFunnel * funnel, FsFunnelClass * g_class) +gst_funnel_init (GstFunnel * funnel, GstFunnelClass * g_class) { funnel->srcpad = gst_pad_new_from_static_template (&funnel_src_template, "src"); - gst_pad_set_event_function (funnel->srcpad, fs_funnel_src_event); + gst_pad_set_event_function (funnel->srcpad, gst_funnel_src_event); gst_pad_use_fixed_caps (funnel->srcpad); gst_element_add_pad (GST_ELEMENT (funnel), funnel->srcpad); } static GstFlowReturn -fs_funnel_buffer_alloc (GstPad * pad, guint64 offset, guint size, +gst_funnel_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf) { - FsFunnel *funnel = FS_FUNNEL (gst_pad_get_parent_element (pad)); + GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent_element (pad)); GstFlowReturn ret = GST_FLOW_OK; ret = gst_pad_alloc_buffer (funnel->srcpad, offset, size, caps, buf); @@ -160,21 +153,22 @@ fs_funnel_buffer_alloc (GstPad * pad, guint64 offset, guint size, static GstPad * -fs_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ, +gst_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name) { GstPad *sinkpad; - FsFunnelPadPrivate *priv = g_slice_alloc0 (sizeof (FsFunnelPadPrivate)); + GstFunnelPadPrivate *priv = g_slice_alloc0 (sizeof (GstFunnelPadPrivate)); GST_DEBUG_OBJECT (element, "requesting pad"); sinkpad = gst_pad_new_from_template (templ, name); - gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_chain)); - gst_pad_set_event_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_event)); - gst_pad_set_getcaps_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_getcaps)); + gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (gst_funnel_chain)); + gst_pad_set_event_function (sinkpad, GST_DEBUG_FUNCPTR (gst_funnel_event)); + gst_pad_set_getcaps_function (sinkpad, + GST_DEBUG_FUNCPTR (gst_funnel_getcaps)); gst_pad_set_bufferalloc_function (sinkpad, - GST_DEBUG_FUNCPTR (fs_funnel_buffer_alloc)); + GST_DEBUG_FUNCPTR (gst_funnel_buffer_alloc)); gst_segment_init (&priv->segment, GST_FORMAT_UNDEFINED); gst_pad_set_element_private (sinkpad, priv); @@ -187,25 +181,25 @@ fs_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ, } static void -fs_funnel_release_pad (GstElement * element, GstPad * pad) +gst_funnel_release_pad (GstElement * element, GstPad * pad) { - FsFunnel *funnel = FS_FUNNEL (element); - FsFunnelPadPrivate *priv = gst_pad_get_element_private (pad); + GstFunnel *funnel = GST_FUNNEL (element); + GstFunnelPadPrivate *priv = gst_pad_get_element_private (pad); GST_DEBUG_OBJECT (funnel, "releasing pad"); gst_pad_set_active (pad, FALSE); if (priv) - g_slice_free1 (sizeof (FsFunnelPadPrivate), priv); + g_slice_free1 (sizeof (GstFunnelPadPrivate), priv); gst_element_remove_pad (GST_ELEMENT_CAST (funnel), pad); } static GstCaps * -fs_funnel_getcaps (GstPad * pad) +gst_funnel_getcaps (GstPad * pad) { - FsFunnel *funnel = FS_FUNNEL (gst_pad_get_parent (pad)); + GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent (pad)); GstCaps *caps; caps = gst_pad_peer_get_caps_reffed (funnel->srcpad); @@ -218,11 +212,11 @@ fs_funnel_getcaps (GstPad * pad) } static GstFlowReturn -fs_funnel_chain (GstPad * pad, GstBuffer * buffer) +gst_funnel_chain (GstPad * pad, GstBuffer * buffer) { GstFlowReturn res; - FsFunnel *funnel = FS_FUNNEL (gst_pad_get_parent (pad)); - FsFunnelPadPrivate *priv = gst_pad_get_element_private (pad); + GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent (pad)); + GstFunnelPadPrivate *priv = gst_pad_get_element_private (pad); GstEvent *event = NULL; GstClockTime newts; GstCaps *padcaps; @@ -283,10 +277,10 @@ out: } static gboolean -fs_funnel_event (GstPad * pad, GstEvent * event) +gst_funnel_event (GstPad * pad, GstEvent * event) { - FsFunnel *funnel = FS_FUNNEL (gst_pad_get_parent (pad)); - FsFunnelPadPrivate *priv = gst_pad_get_element_private (pad); + GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent (pad)); + GstFunnelPadPrivate *priv = gst_pad_get_element_private (pad); gboolean forward = TRUE; gboolean res = TRUE; @@ -334,7 +328,7 @@ fs_funnel_event (GstPad * pad, GstEvent * event) } static gboolean -fs_funnel_src_event (GstPad * pad, GstEvent * event) +gst_funnel_src_event (GstPad * pad, GstEvent * event) { GstElement *funnel; GstIterator *iter; @@ -376,7 +370,7 @@ static void reset_pad (gpointer data, gpointer user_data) { GstPad *pad = data; - FsFunnelPadPrivate *priv = gst_pad_get_element_private (pad); + GstFunnelPadPrivate *priv = gst_pad_get_element_private (pad); GST_OBJECT_LOCK (pad); gst_segment_init (&priv->segment, GST_FORMAT_UNDEFINED); @@ -385,9 +379,9 @@ reset_pad (gpointer data, gpointer user_data) } static GstStateChangeReturn -fs_funnel_change_state (GstElement * element, GstStateChange transition) +gst_funnel_change_state (GstElement * element, GstStateChange transition) { - FsFunnel *funnel = FS_FUNNEL (element); + GstFunnel *funnel = GST_FUNNEL (element); GstStateChangeReturn ret; switch (transition) { @@ -418,18 +412,3 @@ fs_funnel_change_state (GstElement * element, GstStateChange transition) return ret; } - - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "fsfunnel", - GST_RANK_NONE, FS_TYPE_FUNNEL); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "fsfunnel", - "Farsight Funnel plugin", - plugin_init, - VERSION, "LGPL", "Farsight", "http://farsight.freedesktop.org/") diff --git a/plugins/elements/gstfunnel.h b/plugins/elements/gstfunnel.h index c1d5094e46..588a6516fe 100644 --- a/plugins/elements/gstfunnel.h +++ b/plugins/elements/gstfunnel.h @@ -1,11 +1,11 @@ /* - * Farsight2 - Farsight Funnel element + * GStreamer Funnel element * * Copyright 2007 Collabora Ltd. * @author: Olivier Crete * Copyright 2007 Nokia Corp. * - * fs-funnel.h: Simple Funnel element + * gstfunnel.h: Simple Funnel element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,33 +23,33 @@ */ -#ifndef __FS_FUNNEL_H__ -#define __FS_FUNNEL_H__ +#ifndef __GST_FUNNEL_H__ +#define __GST_FUNNEL_H__ #include G_BEGIN_DECLS -#define FS_TYPE_FUNNEL \ - (fs_funnel_get_type ()) -#define FS_FUNNEL(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),FS_TYPE_FUNNEL,FsFunnel)) -#define FS_FUNNEL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),FS_TYPE_FUNNEL,FsFunnelClass)) -#define FS_IS_FUNNEL(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_FUNNEL)) -#define FS_IS_FUNNEL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_FUNNEL)) +#define GST_TYPE_FUNNEL \ + (gst_funnel_get_type ()) +#define GST_FUNNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FUNNEL,GstFunnel)) +#define GST_FUNNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FUNNEL,GstFunnelClass)) +#define GST_IS_FUNNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FUNNEL)) +#define GST_IS_FUNNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FUNNEL)) -typedef struct _FsFunnel FsFunnel; -typedef struct _FsFunnelClass FsFunnelClass; +typedef struct _GstFunnel GstFunnel; +typedef struct _GstFunnelClass GstFunnelClass; /** - * FsFunnel: + * GstFunnel: * - * Opaque #FsFunnel data structure. + * Opaque #GstFunnel data structure. */ -struct _FsFunnel { +struct _GstFunnel { GstElement element; /*< private >*/ @@ -58,12 +58,12 @@ struct _FsFunnel { gboolean has_segment; }; -struct _FsFunnelClass { +struct _GstFunnelClass { GstElementClass parent_class; }; -GType fs_funnel_get_type (void); +GType gst_funnel_get_type (void); G_END_DECLS -#endif /* __FS_FUNNEL_H__ */ +#endif /* __GST_FUNNEL_H__ */ diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index d006bc7f67..3094a7e97f 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -77,6 +77,7 @@ REGISTRY_CHECKS = \ elements/fdsrc \ elements/filesink \ elements/filesrc \ + elements/funnel \ elements/identity \ elements/multiqueue \ elements/selector \ diff --git a/tests/check/elements/funnel.c b/tests/check/elements/funnel.c index 8da1c3b1cf..3e0c589b60 100644 --- a/tests/check/elements/funnel.c +++ b/tests/check/elements/funnel.c @@ -1,4 +1,4 @@ -/* Farsight 2 unit tests for the fsfunnel +/* GStreamer unit tests for the funnel * * Copyright (C) 2008 Collabora, Nokia * @author: Olivier Crete @@ -39,7 +39,7 @@ setup_test_objects (struct TestData *td, GstPadChainFunction chain_func, { td->mycaps = gst_caps_new_simple ("test/test", NULL); - td->funnel = gst_element_factory_make ("fsfunnel", NULL); + td->funnel = gst_element_factory_make ("funnel", NULL); td->funnelsrc = gst_element_get_static_pad (td->funnel, "src"); fail_unless (td->funnelsrc != NULL);