[gstreamermm] add support for staticpadtemplates



commit b602de24651cedfc1496ecdf3a2f00713c192978
Author: Dirk Van Haerenborgh <vhdirk gmail com>
Date:   Thu Oct 17 16:52:11 2013 +0200

    add support for staticpadtemplates
    
    Signed-off-by: Marcin Kolny <marcin kolny gmail com>

 gstreamer/src/elementfactory.hg           |    9 +++---
 gstreamer/src/gst_extra_objects.defs      |    7 +++++
 gstreamer/src/padtemplate.ccg             |    2 +
 gstreamer/src/padtemplate.hg              |   43 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gst.cc |    1 +
 tools/m4/convert_gst.m4                   |    4 +++
 6 files changed, 61 insertions(+), 5 deletions(-)
---
diff --git a/gstreamer/src/elementfactory.hg b/gstreamer/src/elementfactory.hg
index 3a880ff..5df4b92 100644
--- a/gstreamer/src/elementfactory.hg
+++ b/gstreamer/src/elementfactory.hg
@@ -57,6 +57,8 @@ enum ElementFactoryListType
 class Caps;
 class Element;
 class PadTemplate;
+class StaticPadTemplate;
+struct StaticPadTemplateTraits;
 class Plugin;
 
 /** A class that creates Gst::Element objects from a factory.
@@ -140,11 +142,8 @@ public:
   _WRAP_METHOD(bool can_sink_caps(const Glib::RefPtr<const Gst::Caps>& caps) const, 
gst_element_factory_can_sink_caps)
   _WRAP_METHOD(bool can_src_caps(const Glib::RefPtr<const Gst::Caps>& caps) const, 
gst_element_factory_can_src_caps)
 
-#m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<Gst::PadTemplate> >', 
`$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
-  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Gst::PadTemplate> > get_static_pad_templates(), 
gst_element_factory_get_static_pad_templates)
-
-#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(`const GList*', `std::vector< Gst::StaticPadTemplate >', `Glib::ListHandler< 
Gst::StaticPadTemplate, StaticPadTemplateTraits >::list_to_vector(const_cast<GList*>($3), 
Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(std::vector< Gst::StaticPadTemplate > 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()')
diff --git a/gstreamer/src/gst_extra_objects.defs b/gstreamer/src/gst_extra_objects.defs
index cf7c2ed..c754a62 100644
--- a/gstreamer/src/gst_extra_objects.defs
+++ b/gstreamer/src/gst_extra_objects.defs
@@ -45,3 +45,10 @@
   (c-name "GstStructure")
   (gtype-id "GST_TYPE_STRUCTURE")
 )
+
+(define-object StaticPadTemplate
+  (in-module "Gst")
+  (c-name "GstStaticPadTemplate")
+  (gtype-id "GST_TYPE_STATIC_PAD_TEMPLATE")
+)
+
diff --git a/gstreamer/src/padtemplate.ccg b/gstreamer/src/padtemplate.ccg
index 0d7d063..3ee7c75 100644
--- a/gstreamer/src/padtemplate.ccg
+++ b/gstreamer/src/padtemplate.ccg
@@ -23,3 +23,5 @@
 
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(gstreamermm/private/object_p.h)
+
+
diff --git a/gstreamer/src/padtemplate.hg b/gstreamer/src/padtemplate.hg
index 608292a..a2d47e1 100644
--- a/gstreamer/src/padtemplate.hg
+++ b/gstreamer/src/padtemplate.hg
@@ -105,4 +105,47 @@ public:
   _IGNORE(gst_pad_template_pad_created)
 };
 
+
+class StaticPadTemplate
+{
+  _CLASS_BOXEDTYPE_STATIC(StaticPadTemplate, GstStaticPadTemplate)
+ 
+public:
+
+  _WRAP_METHOD(Glib::RefPtr<Gst::PadTemplate> get(), gst_static_pad_template_get)
+
+  /** Get the nametemplate of the padtemplate.
+   */
+  _MEMBER_GET(name_template, name_template, Glib::ustring, gchar*)
+
+  /** Get the Gst::PadDirection of the padtemplate.
+   */
+  _MEMBER_GET(direction, direction, PadDirection, GstPadDirection)
+
+  /** Get the Gst::PadPresence of the padtemplate.
+   */
+  _MEMBER_GET(presence, presence, PadPresence, GstPadPresence)
+  
+};
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+struct StaticPadTemplateTraits
+{
+  typedef const Gst::StaticPadTemplate   CppType;
+  typedef const GstStaticPadTemplate *   CType;
+  typedef GstStaticPadTemplate *         CTypeNonConst;
+
+  static CType   to_c_type      (CppType& obj) { return obj.gobj();  }
+  static CType   to_c_type      (CType   ptr)  { return ptr;      }
+  static CppType to_cpp_type    (CType   ptr)
+  {
+     return CppType(const_cast<CTypeNonConst>(ptr));
+  }
+
+  static void    release_c_type (CType   ptr)
+  {
+  }
+};
+#endif //DOXYGEN_SHOULD_SKIP_THIS
+
 } //namespace Gst
diff --git a/tools/extra_defs_gen/generate_defs_gst.cc b/tools/extra_defs_gen/generate_defs_gst.cc
index f547e9f..116e18f 100644
--- a/tools/extra_defs_gen/generate_defs_gst.cc
+++ b/tools/extra_defs_gen/generate_defs_gst.cc
@@ -110,6 +110,7 @@ int main (int argc, char *argv[])
             << get_defs(GST_TYPE_OBJECT, gst_type_is_a_pointer)
             << get_defs(GST_TYPE_PAD, gst_type_is_a_pointer)
             << get_defs(GST_TYPE_PAD_TEMPLATE, gst_type_is_a_pointer)
+            << get_defs(GST_TYPE_STATIC_PAD_TEMPLATE, gst_type_is_a_pointer)
             << get_defs(GST_TYPE_PIPELINE, gst_type_is_a_pointer)
             << get_defs(GST_TYPE_PLUGIN, gst_type_is_a_pointer)
             << get_defs(GST_TYPE_PLUGIN_FEATURE, gst_type_is_a_pointer)
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index b30e47c..1331120 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -182,6 +182,10 @@ _CONVERSION(`Glib::RefPtr<Gst::PadTemplate>',`GstPadTemplate*', `Glib::unwrap($3
 _CONVERSION(`const Glib::RefPtr<Gst::PadTemplate>&',`GstPadTemplate*',`Glib::unwrap($3)')
 _CONVERSION(`const Glib::RefPtr<const 
Gst::PadTemplate>&',`GstPadTemplate*',`const_cast<GstPadTemplate*>(Glib::unwrap($3))')
 
+dnl StaticPadTemplate
+_CONVERSION(`Gst::StaticPadTemplate&',`GstStaticPadTemplate*',($3).gobj())
+_CONVERSION(`const Gst::StaticPadTemplate&',`const GstStaticPadTemplate*',($3).gobj())
+
 dnl Plugin
 _CONVERSION(`const Glib::RefPtr<Gst::Plugin>&',`GstPlugin*',`Glib::unwrap($3)')
 _CONVERSION(`GstPlugin*',`Glib::RefPtr<Gst::Plugin>',`Glib::wrap($3)')


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