GstTask: add methods for configuring the pool
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 23 Apr 2009 15:19:11 +0000 (17:19 +0200)
committerWim Taymans <wim@metal.(none)>
Mon, 11 May 2009 22:26:58 +0000 (00:26 +0200)
Add getter and setter for configuring the GstTaskPool to use for a GstTask.

docs/gst/gstreamer-sections.txt
gst/gsttask.c
gst/gsttask.h

index 4b4b1f94a66d266c9df194a141498871e8e61c93..1fd6afdd12135468496dd5a15c0c3773aee7a2e9 100644 (file)
@@ -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
 
index 857c8673b5c1c8200f2d8ceb16fbbb8217d7b683..3aec20ffd0771af1895f36df9bed6915c5d952be 100644 (file)
@@ -400,6 +400,73 @@ gst_task_set_priority (GstTask * task, GThreadPriority priority)
   GST_OBJECT_UNLOCK (task);
 }
 
+/**
+ * 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
index 936f296702e11af31735a6f709b102c3d62219bf..b0b7c30932e0cf96078682bc8ddbda1a449a1240 100644 (file)
@@ -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,