[gst-cvs] gstreamer: GstTask: add methods for configuring the pool

Wim Taymans wtay at kemper.freedesktop.org
Mon May 11 15:38:03 PDT 2009


Module: gstreamer
Branch: master
Commit: 02250179d9a133f8827ca924b09a970c1eb2e7f6
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=02250179d9a133f8827ca924b09a970c1eb2e7f6

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Thu Apr 23 17:19:11 2009 +0200

GstTask: add methods for configuring the pool

Add getter and setter for configuring the GstTaskPool to use for a GstTask.

---

 docs/gst/gstreamer-sections.txt |    3 ++
 gst/gsttask.c                   |   67 +++++++++++++++++++++++++++++++++++++++
 gst/gsttask.h                   |    3 ++
 3 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 4b4b1f9..1fd6afd 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -2210,6 +2210,9 @@ gst_task_create
 gst_task_set_lock
 gst_task_set_priority
 
+gst_task_set_pool
+gst_task_get_pool
+
 GstTaskThreadCallbacks
 gst_task_set_thread_callbacks
 
diff --git a/gst/gsttask.c b/gst/gsttask.c
index 857c867..3aec20f 100644
--- a/gst/gsttask.c
+++ b/gst/gsttask.c
@@ -401,6 +401,73 @@ gst_task_set_priority (GstTask * task, GThreadPriority priority)
 }
 
 /**
+ * gst_task_get_pool:
+ * @task: a #GstTask
+ *
+ * Get the #GstTaskPool that this task will use for its streaming
+ * threads.
+ *
+ * MT safe.
+ *
+ * Returns: the #GstTaskPool used by @task. gst_object_unref()
+ * after usage.
+ *
+ * Since: 0.10.24
+ */
+GstTaskPool *
+gst_task_get_pool (GstTask * task)
+{
+  GstTaskPool *result;
+  GstTaskPrivate *priv;
+
+  g_return_val_if_fail (GST_IS_TASK (task), NULL);
+
+  priv = task->priv;
+
+  GST_OBJECT_LOCK (task);
+  result = gst_object_ref (priv->pool);
+  GST_OBJECT_UNLOCK (task);
+
+  return result;
+}
+
+/**
+ * gst_task_set_pool:
+ * @task: a #GstTask
+ * @pool: a #GstTaskPool
+ *
+ * Set @pool as the new GstTaskPool for @task. Any new streaming threads that
+ * will be created by @task will now use @pool.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.24
+ */
+void
+gst_task_set_pool (GstTask * task, GstTaskPool * pool)
+{
+  GstTaskPool *old;
+  GstTaskPrivate *priv;
+
+  g_return_if_fail (GST_IS_TASK (task));
+  g_return_if_fail (GST_IS_TASK_POOL (pool));
+
+  priv = task->priv;
+
+  GST_OBJECT_LOCK (task);
+  if (priv->pool != pool) {
+    old = priv->pool;
+    priv->pool = gst_object_ref (pool);
+  } else
+    old = NULL;
+  GST_OBJECT_UNLOCK (task);
+
+  if (old)
+    gst_object_unref (old);
+}
+
+
+/**
  * gst_task_set_thread_callbacks:
  * @task: The #GstTask to use
  * @callbacks: a #GstTaskThreadCallbacks pointer
diff --git a/gst/gsttask.h b/gst/gsttask.h
index 936f296..b0b7c30 100644
--- a/gst/gsttask.h
+++ b/gst/gsttask.h
@@ -183,6 +183,9 @@ GstTask*	gst_task_create		(GstTaskFunction func, gpointer data);
 void		gst_task_set_lock	(GstTask *task, GStaticRecMutex *mutex);
 void		gst_task_set_priority	(GstTask *task, GThreadPriority priority);
 
+GstTaskPool *   gst_task_get_pool       (GstTask *task);
+void            gst_task_set_pool       (GstTask *task, GstTaskPool *pool);
+
 void            gst_task_set_thread_callbacks  (GstTask *task,
                                                 GstTaskThreadCallbacks *callbacks,
 						gpointer user_data,





More information about the Gstreamer-commits mailing list