[gstreamermm] General API: Use actual slot instead of a copy where possible.



commit 5f6a0c3afda36b5f387a6ebae70d2c76684905ca
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Aug 4 17:54:48 2009 -0400

    	General API: Use actual slot instead of a copy where possible.
    
    	* gstreamer/src/filter.ccg:
    	* gstreamer/src/registry.ccg:
    	* gstreamer/src/structure.ccg:
    	* gstreamer/src/taglist.ccg: Used actual slot instead of copies where
    	possible.
    	* gstreamer/src/ringbuffer.ccg:
    	* gstreamer/src/typefind.ccg: Typos.

 ChangeLog                    |   19 +++++++++++++++++++
 gstreamer/src/filter.ccg     |    9 +++------
 gstreamer/src/registry.ccg   |   30 ++++++++++++++----------------
 gstreamer/src/ringbuffer.ccg |    2 +-
 gstreamer/src/structure.ccg  |    7 ++-----
 gstreamer/src/taglist.ccg    |    3 +--
 gstreamer/src/typefind.ccg   |    1 -
 7 files changed, 40 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 415f1be..e89a576 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2009-08-04  José Alburquerque  <jaalburqu svn gnome org>
+
+	General API: Use actual slot instead of a copy where possible.
+
+	* gstreamer/src/filter.ccg:
+	* gstreamer/src/registry.ccg:
+	* gstreamer/src/structure.ccg:
+	* gstreamer/src/taglist.ccg: Used actual slot instead of copies where
+	possible.
+	* gstreamer/src/ringbuffer.ccg:
+	* gstreamer/src/typefind.ccg: Typos.
+
+2009-08-04  Murray Cumming  <murrayc murrayc com>
+
+	Structure: Remove some uses of GQuark from the API.
+
+	* gstreamer/src/structure.[hg|ccg]: foreach(), map_in_place(): Use a
+	ustring instead of a nasty internal GQuark in the slot parameters.
+
 2009-08-03  José Alburquerque  <jaalburqu svn gnome org>
 
 	* gstreamer/src/taglist.hg: Added a comment to a TODO.
diff --git a/gstreamer/src/filter.ccg b/gstreamer/src/filter.ccg
index afdb951..b945550 100644
--- a/gstreamer/src/filter.ccg
+++ b/gstreamer/src/filter.ccg
@@ -28,10 +28,6 @@ static gboolean Filter_Filter_gstreamermm_callback(void* obj, void* data)
   {
   #endif //GLIBMM_EXCEPTIONS_ENABLED
     bool result = (*the_slot)(Glib::wrap((GObject*)(obj), true));
-
-    //Delete the once executing slot before returning result
-    delete the_slot;
-
     return result;
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
@@ -50,8 +46,9 @@ 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 = new SlotFilter(slot);
-  return Glib::ListHandle< Glib::RefPtr<Glib::Object> >(gst_filter_run(list.data(), &Filter_Filter_gstreamermm_callback, first, slot_copy), Glib::OWNERSHIP_DEEP);
+  return Glib::ListHandle< Glib::RefPtr<Glib::Object> >(
+    gst_filter_run(list.data(), &Filter_Filter_gstreamermm_callback, first,
+    const_cast<SlotFilter*>(&slot)), Glib::OWNERSHIP_DEEP);
 }
 
 } //namespace Gst
diff --git a/gstreamer/src/registry.ccg b/gstreamer/src/registry.ccg
index 73f50dc..7d41466 100644
--- a/gstreamer/src/registry.ccg
+++ b/gstreamer/src/registry.ccg
@@ -31,10 +31,6 @@ static gboolean Registry_Plugin_Filter_gstreamermm_callback(GstPlugin* plugin, v
   {
   #endif //GLIBMM_EXCEPTIONS_ENABLED
     bool result = (*the_slot)(Glib::wrap(plugin, true));
-
-    //Delete the once executing slot before returning result
-    delete the_slot;
-
     return result;
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
@@ -56,10 +52,6 @@ static gboolean Registry_PluginFeature_Filter_gstreamermm_callback(GstPluginFeat
   {
   #endif //GLIBMM_EXCEPTIONS_ENABLED
     bool result = (*the_slot)(Glib::wrap(feature, true));
-
-    //Delete the once executing slot before returning result
-    delete the_slot;
-
     return result;
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
@@ -78,8 +70,10 @@ namespace Gst
 Glib::ListHandle< Glib::RefPtr<Gst::Plugin> >
 Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first)
 {
-  Plugin::SlotFilter* slot_copy = new Plugin::SlotFilter(filter);
-  GList* list = gst_registry_plugin_filter(gobj(), &Registry_Plugin_Filter_gstreamermm_callback, first, slot_copy);
+  GList* list = gst_registry_plugin_filter(gobj(),
+    &Registry_Plugin_Filter_gstreamermm_callback, first,
+    const_cast<Plugin::SlotFilter*>(&filter));
+
   return Glib::ListHandle< Glib::RefPtr<Gst::Plugin> >(list,
     Glib::OWNERSHIP_DEEP);
 }
@@ -87,9 +81,10 @@ Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first)
 Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> >
 Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first) const
 {
-  Plugin::SlotFilter* slot_copy = new Plugin::SlotFilter(filter);
   GList* list = gst_registry_plugin_filter(const_cast<GstRegistry*>(gobj()),
-    &Registry_Plugin_Filter_gstreamermm_callback, first, slot_copy);
+    &Registry_Plugin_Filter_gstreamermm_callback, first,
+    const_cast<Plugin::SlotFilter*>(&filter));
+
   return Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> >(list,
     Glib::OWNERSHIP_DEEP);
 }
@@ -97,8 +92,10 @@ Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first) const
 Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >
 Registry::get_feature_list(const PluginFeature::SlotFilter& filter, bool first)
 {
-  PluginFeature::SlotFilter* slot_copy = new PluginFeature::SlotFilter(filter);
-  GList* list = gst_registry_feature_filter(gobj(), &Registry_PluginFeature_Filter_gstreamermm_callback, first, slot_copy);
+  GList* list = gst_registry_feature_filter(gobj(),
+    &Registry_PluginFeature_Filter_gstreamermm_callback, first,
+    const_cast<PluginFeature::SlotFilter*>(&filter));
+
   return Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >(list,
     Glib::OWNERSHIP_DEEP);
 }
@@ -107,9 +104,10 @@ Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >
 Registry::get_feature_list(const PluginFeature::SlotFilter& filter,
   bool first) const
 {
-  PluginFeature::SlotFilter* slot_copy = new PluginFeature::SlotFilter(filter);
   GList* list = gst_registry_feature_filter(const_cast<GstRegistry*>(gobj()),
-    &Registry_PluginFeature_Filter_gstreamermm_callback, first, slot_copy);
+    &Registry_PluginFeature_Filter_gstreamermm_callback, first,
+    const_cast<PluginFeature::SlotFilter*>(&filter));
+
   return Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >(list,
     Glib::OWNERSHIP_DEEP);
 }
diff --git a/gstreamer/src/ringbuffer.ccg b/gstreamer/src/ringbuffer.ccg
index c39597c..718f545 100644
--- a/gstreamer/src/ringbuffer.ccg
+++ b/gstreamer/src/ringbuffer.ccg
@@ -140,7 +140,7 @@ bool RingBuffer::parse_caps(Gst::RingBufferSpec& spec, const Glib::RefPtr<Gst::C
 
 RingBuffer::~RingBuffer()
 {
-    // Delete task's slot upon destruction
+    // Delete ringbuffer's slot upon destruction
   if(_slot_set)
     delete slot;
 }
diff --git a/gstreamer/src/structure.ccg b/gstreamer/src/structure.ccg
index 1cdbe83..d5578c1 100644
--- a/gstreamer/src/structure.ccg
+++ b/gstreamer/src/structure.ccg
@@ -63,7 +63,6 @@ Structure_Map_gstreamermm_callback(GQuark field_id, GValue *value, void* data)
   {
   #endif //GLIBMM_EXCEPTIONS_ENABLED
     bool result = (*slot)(quark_to_ustring(field_id), *reinterpret_cast<Glib::ValueBase*>(value));
-    delete slot;
     return result;
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
@@ -413,14 +412,12 @@ bool Structure::get_field(const Glib::ustring& name, Gst::FractionRange& range)
 
 bool Structure::foreach(const SlotForeach& slot)
 {
-  SlotForeach slot_copy(slot); //TODO: Can't we just use slot directly?
-  return gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, &slot_copy);
+  return gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, const_cast<SlotForeach*>(&slot));
 }
 
 bool Structure::map_in_place(const SlotMap& slot)
 {
-  SlotMap slot_copy = SlotMap(slot); //TODO: Can't we just use slot directly?
-  return gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, &slot_copy);
+  return gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, const_cast<SlotMap*>(&slot));
 }
 
 Structure Structure::create_from_string(const Glib::ustring& the_string)
diff --git a/gstreamer/src/taglist.ccg b/gstreamer/src/taglist.ccg
index 9e6bd91..aa70cb3 100644
--- a/gstreamer/src/taglist.ccg
+++ b/gstreamer/src/taglist.ccg
@@ -129,9 +129,8 @@ void TagList::add(const Glib::ustring& tag, const char* data, TagMergeMode mode)
 
 void TagList::foreach(const SlotForeach& slot)
 {
-  SlotForeach slot_copy(slot);
   gst_tag_list_foreach(gobj(), &TagList_foreach_gstreamermm_callback,
-    &slot_copy);
+    const_cast<SlotForeach*>(&slot));
 }
 
 bool TagList::get_value(Tag tag, Glib::ValueBase& dest) const
diff --git a/gstreamer/src/typefind.ccg b/gstreamer/src/typefind.ccg
index 8e84870..27b8f7a 100644
--- a/gstreamer/src/typefind.ccg
+++ b/gstreamer/src/typefind.ccg
@@ -45,7 +45,6 @@ static void TypeFind_Find_gstreamermm_callback_destroy(void* data)
   delete static_cast<Gst::TypeFind::SlotFind*>(data);
 }
 
-
 namespace Gst
 {
 



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