[gstreamermm] Added Gst::TaskPool.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gstreamermm] Added Gst::TaskPool.
- Date: Fri, 31 Jul 2009 21:45:07 +0000 (UTC)
commit aad72203205b651aa44f254eabf6d14227729b9f
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Fri Jul 31 17:38:57 2009 -0400
Added Gst::TaskPool.
ChangeLog | 11 ++++
gstreamer/gstreamermm.h | 6 ++-
gstreamer/src/Makefile_list_of_hg.am_fragment | 3 +-
gstreamer/src/plugin.ccg | 5 +-
gstreamer/src/taglist.ccg | 6 +-
gstreamer/src/taskpool.ccg | 68 +++++++++++++++++++++
gstreamer/src/taskpool.hg | 78 +++++++++++++++++++++++++
7 files changed, 170 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2001350..74e04d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-07-31 José Alburquerque <jaalburqu svn gnome org>
+
+ * gstreamer/src/Makefile_list_of_hg.am_fragment:
+ * gstreamer/src/taskpool.ccg:
+ * gstreamer/src/taskpool.hg: Added Gst::TaskPool.
+
+ * gstreamer/gstreamermm.h: Added missing includes.
+
+ * gstreamer/src/plugin.ccg:
+ * gstreamer/src/taglist.ccg: Slot usage corrections.
+
2009-07-30 José Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/bin.ccg:
diff --git a/gstreamer/gstreamermm.h b/gstreamer/gstreamermm.h
index 82fbe3c..0ce3573 100644
--- a/gstreamer/gstreamermm.h
+++ b/gstreamer/gstreamermm.h
@@ -33,12 +33,14 @@
#include <gstreamermm/pluginfeature.h>
#include <gstreamermm/preset.h>
#include <gstreamermm/query.h>
+#include <gstreamermm/registry.h>
#include <gstreamermm/segment.h>
#include <gstreamermm/structure.h>
#include <gstreamermm/systemclock.h>
#include <gstreamermm/taglist.h>
#include <gstreamermm/tagsetter.h>
#include <gstreamermm/task.h>
+#include <gstreamermm/taskpool.h>
//TODO: #include <gstreamermm/typefind.h>
//TODO: #include <gstreamermm/typefindfactory.h>
#include <gstreamermm/urihandler.h>
@@ -46,8 +48,8 @@
#include <gstreamermm/xml.h>
// Core library base includes
-#include <gstreamermm/basesrc.h>
#include <gstreamermm/basesink.h>
+#include <gstreamermm/basesrc.h>
#include <gstreamermm/basetransform.h>
#include <gstreamermm/pushsrc.h>
@@ -60,6 +62,7 @@
#include <gstreamermm/baseaudiosrc.h>
#include <gstreamermm/cddabasesrc.h>
#include <gstreamermm/ringbuffer.h>
+#include <gstreamermm/videosink.h>
// Base inteface includes
#include <gstreamermm/colorbalance.h>
@@ -67,6 +70,7 @@
#include <gstreamermm/mixer.h>
#include <gstreamermm/mixeroptions.h>
#include <gstreamermm/mixertrack.h>
+#include <gstreamermm/navigation.h>
#include <gstreamermm/propertyprobe.h>
#include <gstreamermm/tuner.h>
#include <gstreamermm/tunerchannel.h>
diff --git a/gstreamer/src/Makefile_list_of_hg.am_fragment b/gstreamer/src/Makefile_list_of_hg.am_fragment
index 2c9262b..b6d9b4c 100644
--- a/gstreamer/src/Makefile_list_of_hg.am_fragment
+++ b/gstreamer/src/Makefile_list_of_hg.am_fragment
@@ -17,8 +17,8 @@ files_general_hg = bin.hg \
event.hg \
filter.hg \
format.hg \
- index.hg \
ghostpad.hg \
+ index.hg \
indexfactory.hg \
interface.hg \
iterator.hg \
@@ -39,6 +39,7 @@ files_general_hg = bin.hg \
taglist.hg \
tagsetter.hg \
task.hg \
+ taskpool.hg \
urihandler.hg \
value.hg \
xml.hg \
diff --git a/gstreamer/src/plugin.ccg b/gstreamer/src/plugin.ccg
index 1062b3a..4f14485 100644
--- a/gstreamer/src/plugin.ccg
+++ b/gstreamer/src/plugin.ccg
@@ -30,6 +30,8 @@ gboolean Plugin_Init_gstreamermm_callback(GstPlugin* plugin, void* data)
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
result = (*the_slot)(Glib::wrap(plugin, true));
+ delete the_slot;
+ return result;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
@@ -38,8 +40,7 @@ gboolean Plugin_Init_gstreamermm_callback(GstPlugin* plugin, void* data)
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
- delete the_slot;
- return result;
+ return false;
}
namespace Gst
diff --git a/gstreamer/src/taglist.ccg b/gstreamer/src/taglist.ccg
index 25b4fee..4207ad0 100644
--- a/gstreamer/src/taglist.ccg
+++ b/gstreamer/src/taglist.ccg
@@ -119,9 +119,9 @@ void TagList::add(Tag tag, const char* data, TagMergeMode mode)
void TagList::foreach(const SlotForeach& slot)
{
- SlotForeach* slot_copy = new SlotForeach(slot);
- gst_tag_list_foreach(gobj(), &TagList_foreach_gstreamermm_callback, slot_copy);
- delete slot_copy;
+ SlotForeach slot_copy(slot);
+ gst_tag_list_foreach(gobj(), &TagList_foreach_gstreamermm_callback,
+ &slot_copy);
}
bool TagList::get(Tag tag, Glib::ValueBase& dest) const
diff --git a/gstreamer/src/taskpool.ccg b/gstreamer/src/taskpool.ccg
new file mode 100644
index 0000000..3d4976c
--- /dev/null
+++ b/gstreamer/src/taskpool.ccg
@@ -0,0 +1,68 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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/gstenumtypes.h>
+_PINCLUDE(gstreamermm/private/object_p.h)
+
+static void TaskPool_Push_gstreamermm_callback(void* data)
+{
+ Gst::TaskPool::SlotPush* the_slot = static_cast<Gst::TaskPool::SlotPush*>(data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ (*the_slot)();
+ delete the_slot;
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+namespace Gst
+{
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gpointer TaskPool::push(const SlotPush& slot)
+#else
+gpointer TaskPool::push(const SlotPush& slot, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ SlotPush* slot_copy = new SlotPush(slot);
+
+ gpointer ret_val = gst_task_pool_push(gobj(),
+ &TaskPool_Push_gstreamermm_callback, slot_copy, &gerror);
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return ret_val;
+}
+
+} //namespace Gst
diff --git a/gstreamer/src/taskpool.hg b/gstreamer/src/taskpool.hg
new file mode 100644
index 0000000..e47c430
--- /dev/null
+++ b/gstreamer/src/taskpool.hg
@@ -0,0 +1,78 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008-2009 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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/gsttaskpool.h>
+#include <gstreamermm/object.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+/** Gst::TaskPool - Pool of GStreamer streaming threads.
+ * This object provides an abstraction for creating threads. The default
+ * implementation uses a regular Glib::ThreadPool to start tasks.
+ *
+ * Subclasses can be made to create custom threads.
+ *
+ * Last reviewed on 2009-04-23 (0.10.24)
+ */
+class TaskPool : public Object
+{
+ _CLASS_GOBJECT(TaskPool, GstTaskPool, GST_TASK_POOL, Object, GstObject)
+ _CTOR_DEFAULT()
+
+public:
+ /** For example,
+ * void on_do_push();.
+ */
+ typedef sigc::slot<void> SlotPush;
+
+public:
+ /** Create a new default task pool. The default task pool will use a regular
+ * Glib::ThreadPool for threads.
+ * @return A new Gst::TaskPool.
+ */
+ _WRAP_CREATE()
+
+ /** @throw Glib::Error.
+ */
+ _WRAP_METHOD(void prepare(), gst_task_pool_prepare, errthrow)
+
+ /** Start the execution of a new thread from pool.
+ *
+ * @param slot The function to call.
+ * @return A pointer that should be used for the join() method. This pointer
+ * can be 0, you must check error to detect errors.
+ * @throw Glib::Error.
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ gpointer push(const SlotPush& slot);
+#else
+ gpointer push(const SlotPush& slot, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+ _IGNORE(gst_task_pool_push)
+
+ _WRAP_METHOD(void join(gpointer id), gst_task_pool_join)
+ _WRAP_METHOD(void cleanup(), gst_task_pool_cleanup)
+
+ //TODO: Wrap vfuncs.
+};
+
+} // namespace Gst
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]