[gstreamermm] ElementFactory: Added filter(), get_elements() and is_of_type().



commit 2349006735a5ec08845cc78e4fbb4e872d3af745
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue May 24 18:08:41 2011 -0400

    ElementFactory: Added filter(), get_elements() and is_of_type().
    
    	* gstreamer/src/elementfactory.{ccg,hg}: Wrapped the
    	GstElementFactoryListType as an enum as in TagList.  Added the missing
    	new methods.
    	* tools/m4/convert_gst.m4: Added a GstRank enum conversion.

 ChangeLog                        |    9 +++++++++
 gstreamer/src/elementfactory.ccg |   27 +++++++++++++++++++++++++++
 gstreamer/src/elementfactory.hg  |   36 ++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gst.m4          |    1 +
 4 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7cfc350..145e5bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-05-24  José Alburquerque  <jaalburqu svn gnome org>
 
+	ElementFactory: Added filter(), get_elements() and is_of_type().
+
+	* gstreamer/src/elementfactory.{ccg,hg}: Wrapped the
+	GstElementFactoryListType as an enum as in TagList.  Added the missing
+	new methods.
+	* tools/m4/convert_gst.m4: Added a GstRank enum conversion.
+
+2011-05-24  José Alburquerque  <jaalburqu svn gnome org>
+
 	Value: Glib::Value<> specializations: Derive from ValueBase_Boxed.
 
 	* gstreamer/src/value.hg: Make sure the Glib::Value<> specializations
diff --git a/gstreamer/src/elementfactory.ccg b/gstreamer/src/elementfactory.ccg
index 7b104d8..77b4ab4 100644
--- a/gstreamer/src/elementfactory.ccg
+++ b/gstreamer/src/elementfactory.ccg
@@ -28,6 +28,33 @@ _PINCLUDE(gstreamermm/private/pluginfeature_p.h)
 namespace Gst
 {
 
+// Make sure the order here is the same as in Gst::ElementFactoryListType.
+static GstElementFactoryListType const _list_types[] = 
+{
+  GST_ELEMENT_FACTORY_TYPE_ANY,
+  GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS,
+  GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER,
+  GST_ELEMENT_FACTORY_TYPE_DECODABLE,
+  GST_ELEMENT_FACTORY_TYPE_DECODER,
+  GST_ELEMENT_FACTORY_TYPE_DEMUXER,
+  GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER,
+  GST_ELEMENT_FACTORY_TYPE_ENCODER,
+  GST_ELEMENT_FACTORY_TYPE_FORMATTER,
+  GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO,
+  GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY,
+  GST_ELEMENT_FACTORY_TYPE_MUXER,
+  GST_ELEMENT_FACTORY_TYPE_PARSER,
+  GST_ELEMENT_FACTORY_TYPE_PAYLOADER,
+  GST_ELEMENT_FACTORY_TYPE_SINK,
+  GST_ELEMENT_FACTORY_TYPE_SRC,
+  GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER
+};
+
 Glib::RefPtr<Gst::Element> ElementFactory::create_element(const Glib::ustring& factory_name)
 {
   return Glib::wrap(gst_element_factory_make(factory_name.c_str(), 0));
diff --git a/gstreamer/src/elementfactory.hg b/gstreamer/src/elementfactory.hg
index e6d715f..18c3621 100644
--- a/gstreamer/src/elementfactory.hg
+++ b/gstreamer/src/elementfactory.hg
@@ -18,6 +18,7 @@
  */
 
 #include <gst/gstelement.h>
+#include <gstreamermm/pad.h>
 #include <gstreamermm/pluginfeature.h>
 
 _DEFS(gstreamermm,gst)
@@ -25,6 +26,32 @@ _DEFS(gstreamermm,gst)
 namespace Gst
 {
 
+enum ElementFactoryListType
+{
+  ELEMENT_FACTORY_TYPE_ANY,
+  ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS,
+  ELEMENT_FACTORY_TYPE_AUDIO_ENCODER,
+  ELEMENT_FACTORY_TYPE_DECODABLE,
+  ELEMENT_FACTORY_TYPE_DECODER,
+  ELEMENT_FACTORY_TYPE_DEMUXER,
+  ELEMENT_FACTORY_TYPE_DEPAYLOADER,
+  ELEMENT_FACTORY_TYPE_ENCODER,
+  ELEMENT_FACTORY_TYPE_FORMATTER,
+  ELEMENT_FACTORY_TYPE_MAX_ELEMENTS,
+  ELEMENT_FACTORY_TYPE_MEDIA_AUDIO,
+  ELEMENT_FACTORY_TYPE_MEDIA_IMAGE,
+  ELEMENT_FACTORY_TYPE_MEDIA_METADATA,
+  ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE,
+  ELEMENT_FACTORY_TYPE_MEDIA_VIDEO,
+  ELEMENT_FACTORY_TYPE_MEDIA_ANY,
+  ELEMENT_FACTORY_TYPE_MUXER,
+  ELEMENT_FACTORY_TYPE_PARSER,
+  ELEMENT_FACTORY_TYPE_PAYLOADER,
+  ELEMENT_FACTORY_TYPE_SINK,
+  ELEMENT_FACTORY_TYPE_SRC,
+  ELEMENT_FACTORY_TYPE_VIDEO_ENCODER
+};
+
 class Caps;
 class Element;
 class PadTemplate;
@@ -118,6 +145,15 @@ public:
 
 #m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<const Gst::PadTemplate> >', `$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
   _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Gst::PadTemplate> > get_static_pad_templates() const, gst_element_factory_get_static_pad_templates)
+
+#m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<Gst::ElementFactory> >', `Glib::ListHandler< Glib::RefPtr<Gst::ElementFactory> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Gst::ElementFactory> >&', `GList*', `Glib::ListHandler< Glib::RefPtr<Gst::ElementFactory> >::vector_to_list($3).data()')
+  _WRAP_METHOD(static std::vector< Glib::RefPtr<Gst::ElementFactory> > filter(const std::vector< Glib::RefPtr<Gst::ElementFactory> >& list, const Glib::RefPtr<const Gst::Caps>& caps, PadDirection direction, bool subsetonly), gst_element_factory_list_filter)
+
+#m4 _CONVERSION(`ElementFactoryListType', `GstElementFactoryListType', `_list_types[$3]')
+
+  _WRAP_METHOD(static std::vector< Glib::RefPtr<Gst::ElementFactory> > get_elements(ElementFactoryListType type, Rank minrank), gst_element_factory_list_get_elements)
+  _WRAP_METHOD(bool is_type(ElementFactoryListType type) const, gst_element_factory_list_is_type)
 };
 
 } // namespace Gst
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index d00548b..c45fb6b 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -31,6 +31,7 @@ _CONV_ENUM(Gst,PadLinkReturn)
 _CONV_ENUM(Gst,PadPresence)
 _CONV_ENUM(Gst,PluginDependencyFlags)
 _CONV_ENUM(Gst,QueryType)
+_CONV_ENUM(Gst,Rank)
 _CONV_ENUM(Gst,SeekFlags)
 _CONV_ENUM(Gst,SeekType)
 _CONV_ENUM(Gst,State)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]