gnomemm r1353 - in gstreamermm/trunk: . gstreamer gstreamer/src tools/m4



Author: jaalburqu
Date: Mon Feb 18 22:11:21 2008
New Revision: 1353
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1353&view=rev

Log:
2008-02-18  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/gstreamermm.h:
	* gstreamer/src/Makefile_list_of_hg.am_fragment:
	* gstreamer/src/elementfactory.hg:
	* gstreamer/src/filter.ccg:
	* gstreamer/src/filter.hg:
	* gstreamer/src/indexfactory.ccg:
	* gstreamer/src/indexfactory.hg: Added Filter and IndexFactory;
	Removed unused include in elementfactory.hg
	* gstreamer/src/structure.ccg:
	* gstreamer/src/structure.hg: Renamed MapSlot to SlotMap and moved
	outside of namespace Gst; Used glibmm types for slot typedefs
	* tools/m4/convert_gst.m4: Added Index and IndexFactory conversions

Added:
   gstreamermm/trunk/gstreamer/src/filter.ccg
   gstreamermm/trunk/gstreamer/src/filter.hg
   gstreamermm/trunk/gstreamer/src/indexfactory.ccg
   gstreamermm/trunk/gstreamer/src/indexfactory.hg
Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm.h
   gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
   gstreamermm/trunk/gstreamer/src/elementfactory.hg
   gstreamermm/trunk/gstreamer/src/structure.ccg
   gstreamermm/trunk/gstreamer/src/structure.hg
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/gstreamermm.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm.h	Mon Feb 18 22:11:21 2008
@@ -12,8 +12,10 @@
 #include <gstreamermm/enums.h>
 #include <gstreamermm/error.h>
 #include <gstreamermm/event.h>
+#include <gstreamermm/filter.h>
 #include <gstreamermm/format.h>
 #include <gstreamermm/index.h>
+#include <gstreamermm/indexfactory.h>
 #include <gstreamermm/iterator.h>
 #include <gstreamermm/message.h>
 #include <gstreamermm/object.h>

Modified: gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	(original)
+++ gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	Mon Feb 18 22:11:21 2008
@@ -5,10 +5,10 @@
 files_posix_hg =
 files_win32_hg =
 files_general_hg = bin.hg buffer.hg bus.hg caps.hg childproxy.hg clock.hg \
-	element.hg elementfactory.hg enums.hg error.hg event.hg format.hg \
-	index.hg iterator.hg message.hg pad.hg padtemplate.hg pipeline.hg \
-	plugin.hg pluginfeature.hg query.hg structure.hg systemclock.hg \
-	value.hg xml.hg
+	element.hg elementfactory.hg enums.hg error.hg event.hg filter.hg \
+	format.hg index.hg indexfactory.hg iterator.hg message.hg pad.hg \
+	padtemplate.hg pipeline.hg plugin.hg pluginfeature.hg query.hg \
+	structure.hg systemclock.hg value.hg xml.hg
 
 files_general_deprecated_hg =
 

Modified: gstreamermm/trunk/gstreamer/src/elementfactory.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/elementfactory.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/elementfactory.hg	Mon Feb 18 22:11:21 2008
@@ -20,7 +20,6 @@
  */
 
 #include <gst/gstelement.h>
-#include <gst/gstelementfactory.h>
 #include <gstreamermm/pluginfeature.h>
 
 _DEFS(gstreamermm,gst)

Added: gstreamermm/trunk/gstreamer/src/filter.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/filter.ccg	Mon Feb 18 22:11:21 2008
@@ -0,0 +1,54 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+ #include <gst/gstfilter.h>
+
+static gboolean SignalProxy_Filter_gstreamermm_callback(gpointer obj, void* data)
+{
+  Gst::Filter::SlotFilter* the_slot = static_cast<Gst::Filter::SlotFilter*>(data);
+
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+    return (*the_slot)(Glib::wrap((GObject*)(obj), true));
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  }
+  catch(...)
+  {
+    Glib::exception_handlers_invoke();
+  }
+
+  return 0; // arbitrary value
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+namespace Gst
+{
+
+Glib::ListHandle< Glib::RefPtr<Glib::Object> >
+Filter::run(const Glib::ListHandle<Glib::RefPtr<Glib::Object> >& list, const SlotFilter& slot, bool first)
+{
+  SlotFilter slot_copy(slot);
+  gst_filter_run(list.data(), &SignalProxy_Filter_gstreamermm_callback, first, &slot_copy);
+}
+
+} //namespace Gst

Added: gstreamermm/trunk/gstreamer/src/filter.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/filter.hg	Mon Feb 18 22:11:21 2008
@@ -0,0 +1,52 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+/** Filter â A utility function to filter Lists.
+ */
+class Filter
+{
+
+public:
+  /** For example, bool on_filter(const Glib::RefPtr<Glib::Object>& object)
+   */
+  typedef sigc::slot<bool, const Glib::RefPtr<Glib::Object>& > SlotFilter;
+
+/**
+ * Iterates over the elements in the list, calling the slot with each
+ * object.  If the slot returns TRUE, the object is
+ * prepended to the list of results returned.  If first is true,
+ * the search is halted after the first result is found.
+ *
+ * @param list a list of objects
+ * @param slot the slot to execute for each item
+ * @param first flag to stop execution after a successful item
+ *
+ * @return the list of results
+ */
+  static Glib::ListHandle< Glib::RefPtr<Glib::Object> > run(const Glib::ListHandle<Glib::RefPtr<Glib::Object> >& list, const SlotFilter& slot, bool first);
+};
+
+} // namespace Gst

Added: gstreamermm/trunk/gstreamer/src/indexfactory.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/indexfactory.ccg	Mon Feb 18 22:11:21 2008
@@ -0,0 +1,32 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gstreamermm/index.h>
+
+namespace Gst
+{
+
+IndexFactory::~IndexFactory()
+{
+  gst_index_factory_destroy(gobj());
+}
+
+} //namespace Gst

Added: gstreamermm/trunk/gstreamer/src/indexfactory.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/indexfactory.hg	Mon Feb 18 22:11:21 2008
@@ -0,0 +1,54 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gstelement.h>
+#include <gstreamermm/pluginfeature.h>
+
+_DEFS(gstreamermm,gst)
+_PINCLUDE(gstreamermm/private/pluginfeature_p.h)
+
+namespace Gst
+{
+
+class Index;
+
+/** IndexFactory â Create Indexes from a factory.
+ * IndexFactory is used to dynamically create Index implementations.
+ */
+class IndexFactory : public PluginFeature
+{
+  _CLASS_GOBJECT(IndexFactory, GstIndexFactory, GST_INDEX_FACTORY, PluginFeature, GstPluginFeature)
+  _CUSTOM_DTOR
+
+protected:
+  _WRAP_CTOR(IndexFactory(const Glib::ustring& name, const Glib::ustring& longdesc, GType type), gst_index_factory_new)
+
+public:
+  _WRAP_CREATE(const Glib::ustring& name, const Glib::ustring& longdesc, GType type)
+
+  _WRAP_METHOD(static Glib::RefPtr<IndexFactory> find(const Glib::ustring& name), gst_index_factory_find)
+  _WRAP_METHOD(Glib::RefPtr<Index> make(), gst_index_factory_create)
+
+  _WRAP_METHOD(static Glib::RefPtr<Index> make(const Glib::ustring& factory_name), gst_index_factory_make)
+};
+
+} // namespace Gst
+

Modified: gstreamermm/trunk/gstreamer/src/structure.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/structure.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/structure.ccg	Mon Feb 18 22:11:21 2008
@@ -22,23 +22,31 @@
 #include <gst/gstvalue.h> //Must be included before gststructure.h
 #include <gst/gststructure.h>
 
-namespace Gst
-{
-
 static gboolean
-Structure_ForEach_gstreamermm_callback(GQuark field_id, const GValue *value, gpointer data)
+Structure_Foreach_gstreamermm_callback(GQuark field_id, const GValue *value, gpointer data)
 {
-  Structure::ForeachSlot& slot = *static_cast<Structure::ForeachSlot*>(data);
-  return slot(field_id, value);
+  Glib::ValueBase val_base;
+  val_base.init(value);
+
+  Gst::Structure::SlotForeach& slot = *static_cast<Gst::Structure::SlotForeach*>(data);
+
+  return slot(Glib::QueryQuark(field_id), val_base);
 }
 
 static gboolean
 Structure_Map_gstreamermm_callback(GQuark field_id, GValue *value, gpointer data)
 {
-  Structure::MapSlot& slot = *static_cast<Structure::MapSlot*>(data);
-  return slot(field_id, value);
+  Glib::ValueBase val_base;
+  val_base.init(value);
+
+  Gst::Structure::SlotMap& slot = *static_cast<Gst::Structure::SlotMap*>(data);
+
+  return slot(Glib::QueryQuark(field_id), val_base);
 }
 
+namespace Gst
+{
+
 Structure::Structure(const Glib::ustring& name)
 {
   gobject_ = gst_structure_empty_new(name.c_str());
@@ -158,16 +166,16 @@
 }
 
 bool
-Structure::foreach(const ForeachSlot& slot)
+Structure::foreach(const SlotForeach& slot)
 {
-  ForeachSlot slot_copy(slot);
-  gst_structure_foreach(gobj(), &Structure_ForEach_gstreamermm_callback, &slot_copy);
+  SlotForeach slot_copy(slot);
+  gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, &slot_copy);
 }
 
 bool
-Structure::map_in_place(const MapSlot& slot)
+Structure::map_in_place(const SlotMap& slot)
 {
-  MapSlot slot_copy(slot);
+  SlotMap slot_copy(slot);
   gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, &slot_copy);
 }
 

Modified: gstreamermm/trunk/gstreamer/src/structure.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/structure.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/structure.hg	Mon Feb 18 22:11:21 2008
@@ -47,8 +47,15 @@
   _CLASS_BOXEDTYPE(Structure, GstStructure, NONE, gst_structure_copy, gst_structure_free)
 
 public:
-  typedef sigc::slot<bool, GQuark, const GValue*> ForeachSlot;
-  typedef sigc::slot<bool, GQuark, GValue*> MapSlot;
+  /** For example,
+   * bool on_foreach(const Glib::QueryQuark& id, const Glib::ValueBase& value);
+   */
+  typedef sigc::slot<bool, const Glib::QueryQuark&, const Glib::ValueBase&> SlotForeach;
+
+  /** For example,
+   * bool on_map(const Glib::QueryQuark& id, Glib::ValueBase& value);
+   */
+  typedef sigc::slot<bool, const Glib::QueryQuark&, Glib::ValueBase&> SlotMap;
 
 public:
   Structure(const Glib::ustring& name);
@@ -63,7 +70,7 @@
   _WRAP_METHOD(void remove_field(const Glib::ustring& fieldname), gst_structure_remove_field)
   _WRAP_METHOD(GType get_field_type(const Glib::ustring& fieldname) const, gst_structure_get_field_type)
 
-  bool foreach(const ForeachSlot& slot);
+  bool foreach(const SlotForeach& slot);
 
   _WRAP_METHOD(bool has_field(const Glib::ustring& fieldname) const, gst_structure_has_field)
   _WRAP_METHOD(bool has_field(const Glib::ustring& fieldname, GType type) const, gst_structure_has_field_typed)
@@ -90,7 +97,7 @@
 
   bool get_fraction(const Glib::ustring& fieldname, int& value_numerator, int& value_denominator) const;
 
-  bool map_in_place(const MapSlot& slot);
+  bool map_in_place(const SlotMap& slot);
 
   static Structure create_from_string(const Glib::ustring& the_string);
 

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Mon Feb 18 22:11:21 2008
@@ -56,6 +56,10 @@
 #Index
 _CONVERSION(`GstIndexEntry*',`IndexEntry',`Glib::wrap($3)')
 _CONVERSION(`const IndexAssociation&',`const GstIndexAssociation*',`((GstIndexAssociation*)(&($3)))')
+_CONVERSION(`GstIndex*',`Glib::RefPtr<Index>',`Glib::wrap($3)')
+
+#IndexFactory
+_CONVERSION(`GstIndexFactory*',`Glib::RefPtr<IndexFactory>',`Glib::wrap($3)')
 
 #Message
 _CONVERSION(`GstMessage*',`Glib::RefPtr<Message>',`Gst::Message::wrap($3)')



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