1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>GstTask: GStreamer 1.0 Core Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer 1.0 Core Reference Manual"> 8<link rel="up" href="libgstreamer.html" title="GStreamer Core Library"> 9<link rel="prev" href="GstTagSetter.html" title="GstTagsetter"> 10<link rel="next" href="GstTaskPool.html" title="GstTaskPool"> 11<meta name="generator" content="GTK-Doc V1.28 (XML mode)"> 12<link rel="stylesheet" href="style.css" type="text/css"> 13</head> 14<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 15<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> 16<td width="100%" align="left" class="shortcuts"> 17<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 18 <a href="#GstTask.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#GstTask.object-hierarchy" class="shortcut">Object Hierarchy</a></span> 20</td> 21<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 22<td><a accesskey="u" href="libgstreamer.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 23<td><a accesskey="p" href="GstTagSetter.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 24<td><a accesskey="n" href="GstTaskPool.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 25</tr></table> 26<div class="refentry"> 27<a name="GstTask"></a><div class="titlepage"></div> 28<div class="refnamediv"><table width="100%"><tr> 29<td valign="top"> 30<h2><span class="refentrytitle"><a name="GstTask.top_of_page"></a>GstTask</span></h2> 31<p>GstTask — Abstraction of GStreamer streaming threads.</p> 32</td> 33<td class="gallery_image" valign="top" align="right"></td> 34</tr></table></div> 35<div class="refsect1"> 36<a name="GstTask.functions"></a><h2>Functions</h2> 37<div class="informaltable"><table class="informaltable" width="100%" border="0"> 38<colgroup> 39<col width="150px" class="functions_return"> 40<col class="functions_name"> 41</colgroup> 42<tbody> 43<tr> 44<td class="function_type"> 45<span class="returnvalue">void</span> 46</td> 47<td class="function_name"> 48<span class="c_punctuation">(</span><a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()">*GstTaskFunction</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> 49</td> 50</tr> 51<tr> 52<td class="define_keyword">#define</td> 53<td class="function_name"> 54<a class="link" href="GstTask.html#GST-TASK-BROADCAST:CAPS" title="GST_TASK_BROADCAST()">GST_TASK_BROADCAST</a><span class="c_punctuation">()</span> 55</td> 56</tr> 57<tr> 58<td class="define_keyword">#define</td> 59<td class="function_name"> 60<a class="link" href="GstTask.html#GST-TASK-GET-COND:CAPS" title="GST_TASK_GET_COND()">GST_TASK_GET_COND</a><span class="c_punctuation">()</span> 61</td> 62</tr> 63<tr> 64<td class="define_keyword">#define</td> 65<td class="function_name"> 66<a class="link" href="GstTask.html#GST-TASK-GET-LOCK:CAPS" title="GST_TASK_GET_LOCK()">GST_TASK_GET_LOCK</a><span class="c_punctuation">()</span> 67</td> 68</tr> 69<tr> 70<td class="define_keyword">#define</td> 71<td class="function_name"> 72<a class="link" href="GstTask.html#GST-TASK-SIGNAL:CAPS" title="GST_TASK_SIGNAL()">GST_TASK_SIGNAL</a><span class="c_punctuation">()</span> 73</td> 74</tr> 75<tr> 76<td class="define_keyword">#define</td> 77<td class="function_name"> 78<a class="link" href="GstTask.html#GST-TASK-STATE:CAPS" title="GST_TASK_STATE()">GST_TASK_STATE</a><span class="c_punctuation">()</span> 79</td> 80</tr> 81<tr> 82<td class="define_keyword">#define</td> 83<td class="function_name"> 84<a class="link" href="GstTask.html#GST-TASK-WAIT:CAPS" title="GST_TASK_WAIT()">GST_TASK_WAIT</a><span class="c_punctuation">()</span> 85</td> 86</tr> 87<tr> 88<td class="function_type"> 89<a class="link" href="GstTask.html" title="GstTask"><span class="returnvalue">GstTask</span></a> * 90</td> 91<td class="function_name"> 92<a class="link" href="GstTask.html#gst-task-new" title="gst_task_new ()">gst_task_new</a> <span class="c_punctuation">()</span> 93</td> 94</tr> 95<tr> 96<td class="function_type"> 97<span class="returnvalue">void</span> 98</td> 99<td class="function_name"> 100<a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()">gst_task_set_lock</a> <span class="c_punctuation">()</span> 101</td> 102</tr> 103<tr> 104<td class="function_type"> 105<span class="returnvalue">void</span> 106</td> 107<td class="function_name"> 108<a class="link" href="GstTask.html#gst-task-set-pool" title="gst_task_set_pool ()">gst_task_set_pool</a> <span class="c_punctuation">()</span> 109</td> 110</tr> 111<tr> 112<td class="function_type"> 113<a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="returnvalue">GstTaskPool</span></a> * 114</td> 115<td class="function_name"> 116<a class="link" href="GstTask.html#gst-task-get-pool" title="gst_task_get_pool ()">gst_task_get_pool</a> <span class="c_punctuation">()</span> 117</td> 118</tr> 119<tr> 120<td class="function_type"> 121<span class="returnvalue">void</span> 122</td> 123<td class="function_name"> 124<span class="c_punctuation">(</span><a class="link" href="GstTask.html#GstTaskThreadFunc" title="GstTaskThreadFunc ()">*GstTaskThreadFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> 125</td> 126</tr> 127<tr> 128<td class="function_type"> 129<span class="returnvalue">void</span> 130</td> 131<td class="function_name"> 132<a class="link" href="GstTask.html#gst-task-set-enter-callback" title="gst_task_set_enter_callback ()">gst_task_set_enter_callback</a> <span class="c_punctuation">()</span> 133</td> 134</tr> 135<tr> 136<td class="function_type"> 137<span class="returnvalue">void</span> 138</td> 139<td class="function_name"> 140<a class="link" href="GstTask.html#gst-task-set-leave-callback" title="gst_task_set_leave_callback ()">gst_task_set_leave_callback</a> <span class="c_punctuation">()</span> 141</td> 142</tr> 143<tr> 144<td class="function_type"> 145<a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState"><span class="returnvalue">GstTaskState</span></a> 146</td> 147<td class="function_name"> 148<a class="link" href="GstTask.html#gst-task-get-state" title="gst_task_get_state ()">gst_task_get_state</a> <span class="c_punctuation">()</span> 149</td> 150</tr> 151<tr> 152<td class="function_type"> 153<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 154</td> 155<td class="function_name"> 156<a class="link" href="GstTask.html#gst-task-set-state" title="gst_task_set_state ()">gst_task_set_state</a> <span class="c_punctuation">()</span> 157</td> 158</tr> 159<tr> 160<td class="function_type"> 161<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 162</td> 163<td class="function_name"> 164<a class="link" href="GstTask.html#gst-task-pause" title="gst_task_pause ()">gst_task_pause</a> <span class="c_punctuation">()</span> 165</td> 166</tr> 167<tr> 168<td class="function_type"> 169<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 170</td> 171<td class="function_name"> 172<a class="link" href="GstTask.html#gst-task-start" title="gst_task_start ()">gst_task_start</a> <span class="c_punctuation">()</span> 173</td> 174</tr> 175<tr> 176<td class="function_type"> 177<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 178</td> 179<td class="function_name"> 180<a class="link" href="GstTask.html#gst-task-stop" title="gst_task_stop ()">gst_task_stop</a> <span class="c_punctuation">()</span> 181</td> 182</tr> 183<tr> 184<td class="function_type"> 185<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 186</td> 187<td class="function_name"> 188<a class="link" href="GstTask.html#gst-task-join" title="gst_task_join ()">gst_task_join</a> <span class="c_punctuation">()</span> 189</td> 190</tr> 191<tr> 192<td class="function_type"> 193<span class="returnvalue">void</span> 194</td> 195<td class="function_name"> 196<a class="link" href="GstTask.html#gst-task-cleanup-all" title="gst_task_cleanup_all ()">gst_task_cleanup_all</a> <span class="c_punctuation">()</span> 197</td> 198</tr> 199</tbody> 200</table></div> 201</div> 202<div class="refsect1"> 203<a name="GstTask.other"></a><h2>Types and Values</h2> 204<div class="informaltable"><table class="informaltable" width="100%" border="0"> 205<colgroup> 206<col width="150px" class="name"> 207<col class="description"> 208</colgroup> 209<tbody> 210<tr> 211<td class="datatype_keyword">struct</td> 212<td class="function_name"><a class="link" href="GstTask.html#GstTask-struct" title="struct GstTask">GstTask</a></td> 213</tr> 214<tr> 215<td class="datatype_keyword">enum</td> 216<td class="function_name"><a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState">GstTaskState</a></td> 217</tr> 218</tbody> 219</table></div> 220</div> 221<div class="refsect1"> 222<a name="GstTask.object-hierarchy"></a><h2>Object Hierarchy</h2> 223<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 224 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 225 <span class="lineart">╰──</span> <a class="link" href="GstObject.html" title="GstObject">GstObject</a> 226 <span class="lineart">╰──</span> GstTask 227</pre> 228</div> 229<div class="refsect1"> 230<a name="GstTask.includes"></a><h2>Includes</h2> 231<pre class="synopsis">#include <gst/gst.h> 232</pre> 233</div> 234<div class="refsect1"> 235<a name="GstTask.description"></a><h2>Description</h2> 236<p><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> is used by <a class="link" href="GstElement.html" title="GstElement"><span class="type">GstElement</span></a> and <a class="link" href="GstPad.html" title="GstPad"><span class="type">GstPad</span></a> to provide the data passing 237threads in a <a class="link" href="GstPipeline.html" title="GstPipeline"><span class="type">GstPipeline</span></a>.</p> 238<p>A <a class="link" href="GstPad.html" title="GstPad"><span class="type">GstPad</span></a> will typically start a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to push or pull data to/from the 239peer pads. Most source elements start a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to push data. In some cases 240a demuxer element can start a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to pull data from a peer element. This 241is typically done when the demuxer can perform random access on the upstream 242peer element for improved performance.</p> 243<p>Although convenience functions exist on <a class="link" href="GstPad.html" title="GstPad"><span class="type">GstPad</span></a> to start/pause/stop tasks, it 244might sometimes be needed to create a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> manually if it is not related to 245a <a class="link" href="GstPad.html" title="GstPad"><span class="type">GstPad</span></a>.</p> 246<p>Before the <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> can be run, it needs a <a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GRecMutex"><span class="type">GRecMutex</span></a> that can be set with 247<a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()"><code class="function">gst_task_set_lock()</code></a>.</p> 248<p>The task can be started, paused and stopped with <a class="link" href="GstTask.html#gst-task-start" title="gst_task_start ()"><code class="function">gst_task_start()</code></a>, <a class="link" href="GstTask.html#gst-task-pause" title="gst_task_pause ()"><code class="function">gst_task_pause()</code></a> 249and <a class="link" href="GstTask.html#gst-task-stop" title="gst_task_stop ()"><code class="function">gst_task_stop()</code></a> respectively or with the <a class="link" href="GstTask.html#gst-task-set-state" title="gst_task_set_state ()"><code class="function">gst_task_set_state()</code></a> function.</p> 250<p>A <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> will repeatedly call the <a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()"><span class="type">GstTaskFunction</span></a> with the user data 251that was provided when creating the task with <a class="link" href="GstTask.html#gst-task-new" title="gst_task_new ()"><code class="function">gst_task_new()</code></a>. While calling 252the function it will acquire the provided lock. The provided lock is released 253when the task pauses or stops.</p> 254<p>Stopping a task with <a class="link" href="GstTask.html#gst-task-stop" title="gst_task_stop ()"><code class="function">gst_task_stop()</code></a> will not immediately make sure the task is 255not running anymore. Use <a class="link" href="GstTask.html#gst-task-join" title="gst_task_join ()"><code class="function">gst_task_join()</code></a> to make sure the task is completely 256stopped and the thread is stopped.</p> 257<p>After creating a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a>, use <a class="link" href="GstObject.html#gst-object-unref" title="gst_object_unref ()"><code class="function">gst_object_unref()</code></a> to free its resources. This can 258only be done when the task is not running anymore.</p> 259<p>Task functions can send a <a class="link" href="GstMessage.html" title="GstMessage"><span class="type">GstMessage</span></a> to send out-of-band data to the 260application. The application can receive messages from the <a class="link" href="GstBus.html" title="GstBus"><span class="type">GstBus</span></a> in its 261mainloop.</p> 262<p>For debugging purposes, the task will configure its object name as the thread 263name on Linux. Please note that the object name should be configured before the 264task is started; changing the object name after the task has been started, has 265no effect on the thread name.</p> 266</div> 267<div class="refsect1"> 268<a name="GstTask.functions_details"></a><h2>Functions</h2> 269<div class="refsect2"> 270<a name="GstTaskFunction"></a><h3>GstTaskFunction ()</h3> 271<pre class="programlisting"><span class="returnvalue">void</span> 272<span class="c_punctuation">(</span>*GstTaskFunction<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> 273<p>A function that will repeatedly be called in the thread created by 274a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a>.</p> 275<div class="refsect3"> 276<a name="GstTaskFunction.parameters"></a><h4>Parameters</h4> 277<div class="informaltable"><table class="informaltable" width="100%" border="0"> 278<colgroup> 279<col width="150px" class="parameters_name"> 280<col class="parameters_description"> 281<col width="200px" class="parameters_annotations"> 282</colgroup> 283<tbody><tr> 284<td class="parameter_name"><p>user_data</p></td> 285<td class="parameter_description"><p>user data passed to the function</p></td> 286<td class="parameter_annotations"> </td> 287</tr></tbody> 288</table></div> 289</div> 290</div> 291<hr> 292<div class="refsect2"> 293<a name="GST-TASK-BROADCAST:CAPS"></a><h3>GST_TASK_BROADCAST()</h3> 294<pre class="programlisting">#define GST_TASK_BROADCAST(task) g_cond_broadcast(GST_TASK_GET_COND (task)) 295</pre> 296<p>Send a broadcast signal to all waiting task conds</p> 297<div class="refsect3"> 298<a name="GST-TASK-BROADCAST.parameters"></a><h4>Parameters</h4> 299<div class="informaltable"><table class="informaltable" width="100%" border="0"> 300<colgroup> 301<col width="150px" class="parameters_name"> 302<col class="parameters_description"> 303<col width="200px" class="parameters_annotations"> 304</colgroup> 305<tbody><tr> 306<td class="parameter_name"><p>task</p></td> 307<td class="parameter_description"><p>Task to broadcast</p></td> 308<td class="parameter_annotations"> </td> 309</tr></tbody> 310</table></div> 311</div> 312</div> 313<hr> 314<div class="refsect2"> 315<a name="GST-TASK-GET-COND:CAPS"></a><h3>GST_TASK_GET_COND()</h3> 316<pre class="programlisting">#define GST_TASK_GET_COND(task) (&GST_TASK_CAST(task)->cond) 317</pre> 318<p>Get access to the cond of the task.</p> 319<div class="refsect3"> 320<a name="GST-TASK-GET-COND.parameters"></a><h4>Parameters</h4> 321<div class="informaltable"><table class="informaltable" width="100%" border="0"> 322<colgroup> 323<col width="150px" class="parameters_name"> 324<col class="parameters_description"> 325<col width="200px" class="parameters_annotations"> 326</colgroup> 327<tbody><tr> 328<td class="parameter_name"><p>task</p></td> 329<td class="parameter_description"><p>Task to get the cond of</p></td> 330<td class="parameter_annotations"> </td> 331</tr></tbody> 332</table></div> 333</div> 334</div> 335<hr> 336<div class="refsect2"> 337<a name="GST-TASK-GET-LOCK:CAPS"></a><h3>GST_TASK_GET_LOCK()</h3> 338<pre class="programlisting">#define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock) 339</pre> 340<p>Get access to the task lock.</p> 341<div class="refsect3"> 342<a name="GST-TASK-GET-LOCK.parameters"></a><h4>Parameters</h4> 343<div class="informaltable"><table class="informaltable" width="100%" border="0"> 344<colgroup> 345<col width="150px" class="parameters_name"> 346<col class="parameters_description"> 347<col width="200px" class="parameters_annotations"> 348</colgroup> 349<tbody><tr> 350<td class="parameter_name"><p>task</p></td> 351<td class="parameter_description"><p>Task to get the lock of</p></td> 352<td class="parameter_annotations"> </td> 353</tr></tbody> 354</table></div> 355</div> 356</div> 357<hr> 358<div class="refsect2"> 359<a name="GST-TASK-SIGNAL:CAPS"></a><h3>GST_TASK_SIGNAL()</h3> 360<pre class="programlisting">#define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (task)) 361</pre> 362<p>Signal the task cond</p> 363<div class="refsect3"> 364<a name="GST-TASK-SIGNAL.parameters"></a><h4>Parameters</h4> 365<div class="informaltable"><table class="informaltable" width="100%" border="0"> 366<colgroup> 367<col width="150px" class="parameters_name"> 368<col class="parameters_description"> 369<col width="200px" class="parameters_annotations"> 370</colgroup> 371<tbody><tr> 372<td class="parameter_name"><p>task</p></td> 373<td class="parameter_description"><p>Task to signal</p></td> 374<td class="parameter_annotations"> </td> 375</tr></tbody> 376</table></div> 377</div> 378</div> 379<hr> 380<div class="refsect2"> 381<a name="GST-TASK-STATE:CAPS"></a><h3>GST_TASK_STATE()</h3> 382<pre class="programlisting">#define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state) 383</pre> 384<p>Get access to the state of the task.</p> 385<div class="refsect3"> 386<a name="GST-TASK-STATE.parameters"></a><h4>Parameters</h4> 387<div class="informaltable"><table class="informaltable" width="100%" border="0"> 388<colgroup> 389<col width="150px" class="parameters_name"> 390<col class="parameters_description"> 391<col width="200px" class="parameters_annotations"> 392</colgroup> 393<tbody><tr> 394<td class="parameter_name"><p>task</p></td> 395<td class="parameter_description"><p>Task to get the state of</p></td> 396<td class="parameter_annotations"> </td> 397</tr></tbody> 398</table></div> 399</div> 400</div> 401<hr> 402<div class="refsect2"> 403<a name="GST-TASK-WAIT:CAPS"></a><h3>GST_TASK_WAIT()</h3> 404<pre class="programlisting">#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task)) 405</pre> 406<p>Wait for the task cond to be signalled</p> 407<div class="refsect3"> 408<a name="GST-TASK-WAIT.parameters"></a><h4>Parameters</h4> 409<div class="informaltable"><table class="informaltable" width="100%" border="0"> 410<colgroup> 411<col width="150px" class="parameters_name"> 412<col class="parameters_description"> 413<col width="200px" class="parameters_annotations"> 414</colgroup> 415<tbody><tr> 416<td class="parameter_name"><p>task</p></td> 417<td class="parameter_description"><p>Task to wait for</p></td> 418<td class="parameter_annotations"> </td> 419</tr></tbody> 420</table></div> 421</div> 422</div> 423<hr> 424<div class="refsect2"> 425<a name="gst-task-new"></a><h3>gst_task_new ()</h3> 426<pre class="programlisting"><a class="link" href="GstTask.html" title="GstTask"><span class="returnvalue">GstTask</span></a> * 427gst_task_new (<em class="parameter"><code><a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()"><span class="type">GstTaskFunction</span></a> func</code></em>, 428 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, 429 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre> 430<p>Create a new Task that will repeatedly call the provided <em class="parameter"><code>func</code></em> 431 432with <em class="parameter"><code>user_data</code></em> 433 as a parameter. Typically the task will run in 434a new thread.</p> 435<p>The function cannot be changed after the task has been created. You 436must create a new <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to change the function.</p> 437<p>This function will not yet create and start a thread. Use <a class="link" href="GstTask.html#gst-task-start" title="gst_task_start ()"><code class="function">gst_task_start()</code></a> or 438<a class="link" href="GstTask.html#gst-task-pause" title="gst_task_pause ()"><code class="function">gst_task_pause()</code></a> to create and start the GThread.</p> 439<p>Before the task can be used, a <a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GRecMutex"><span class="type">GRecMutex</span></a> must be configured using the 440<a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()"><code class="function">gst_task_set_lock()</code></a> function. This lock will always be acquired while 441<em class="parameter"><code>func</code></em> 442 is called.</p> 443<div class="refsect3"> 444<a name="gst-task-new.parameters"></a><h4>Parameters</h4> 445<div class="informaltable"><table class="informaltable" width="100%" border="0"> 446<colgroup> 447<col width="150px" class="parameters_name"> 448<col class="parameters_description"> 449<col width="200px" class="parameters_annotations"> 450</colgroup> 451<tbody> 452<tr> 453<td class="parameter_name"><p>func</p></td> 454<td class="parameter_description"><p>The <a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()"><span class="type">GstTaskFunction</span></a> to use</p></td> 455<td class="parameter_annotations"> </td> 456</tr> 457<tr> 458<td class="parameter_name"><p>user_data</p></td> 459<td class="parameter_description"><p>User data to pass to <em class="parameter"><code>func</code></em> 460</p></td> 461<td class="parameter_annotations"> </td> 462</tr> 463<tr> 464<td class="parameter_name"><p>notify</p></td> 465<td class="parameter_description"><p>the function to call when <em class="parameter"><code>user_data</code></em> 466is no longer needed.</p></td> 467<td class="parameter_annotations"> </td> 468</tr> 469</tbody> 470</table></div> 471</div> 472<div class="refsect3"> 473<a name="gst-task-new.returns"></a><h4>Returns</h4> 474<p>A new <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a>.</p> 475<p>MT safe. </p> 476<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 477</div> 478</div> 479<hr> 480<div class="refsect2"> 481<a name="gst-task-set-lock"></a><h3>gst_task_set_lock ()</h3> 482<pre class="programlisting"><span class="returnvalue">void</span> 483gst_task_set_lock (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 484 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GRecMutex"><span class="type">GRecMutex</span></a> *mutex</code></em>);</pre> 485<p>Set the mutex used by the task. The mutex will be acquired before 486calling the <a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()"><span class="type">GstTaskFunction</span></a>.</p> 487<p>This function has to be called before calling <a class="link" href="GstTask.html#gst-task-pause" title="gst_task_pause ()"><code class="function">gst_task_pause()</code></a> or 488<a class="link" href="GstTask.html#gst-task-start" title="gst_task_start ()"><code class="function">gst_task_start()</code></a>.</p> 489<p>MT safe.</p> 490<div class="refsect3"> 491<a name="gst-task-set-lock.parameters"></a><h4>Parameters</h4> 492<div class="informaltable"><table class="informaltable" width="100%" border="0"> 493<colgroup> 494<col width="150px" class="parameters_name"> 495<col class="parameters_description"> 496<col width="200px" class="parameters_annotations"> 497</colgroup> 498<tbody> 499<tr> 500<td class="parameter_name"><p>task</p></td> 501<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to use</p></td> 502<td class="parameter_annotations"> </td> 503</tr> 504<tr> 505<td class="parameter_name"><p>mutex</p></td> 506<td class="parameter_description"><p>The <a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GRecMutex"><span class="type">GRecMutex</span></a> to use</p></td> 507<td class="parameter_annotations"> </td> 508</tr> 509</tbody> 510</table></div> 511</div> 512</div> 513<hr> 514<div class="refsect2"> 515<a name="gst-task-set-pool"></a><h3>gst_task_set_pool ()</h3> 516<pre class="programlisting"><span class="returnvalue">void</span> 517gst_task_set_pool (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 518 <em class="parameter"><code><a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="type">GstTaskPool</span></a> *pool</code></em>);</pre> 519<p>Set <em class="parameter"><code>pool</code></em> 520 as the new GstTaskPool for <em class="parameter"><code>task</code></em> 521. Any new streaming threads that 522will be created by <em class="parameter"><code>task</code></em> 523 will now use <em class="parameter"><code>pool</code></em> 524.</p> 525<p>MT safe.</p> 526<div class="refsect3"> 527<a name="gst-task-set-pool.parameters"></a><h4>Parameters</h4> 528<div class="informaltable"><table class="informaltable" width="100%" border="0"> 529<colgroup> 530<col width="150px" class="parameters_name"> 531<col class="parameters_description"> 532<col width="200px" class="parameters_annotations"> 533</colgroup> 534<tbody> 535<tr> 536<td class="parameter_name"><p>task</p></td> 537<td class="parameter_description"><p>a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a></p></td> 538<td class="parameter_annotations"> </td> 539</tr> 540<tr> 541<td class="parameter_name"><p>pool</p></td> 542<td class="parameter_description"><p>a <a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="type">GstTaskPool</span></a>. </p></td> 543<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td> 544</tr> 545</tbody> 546</table></div> 547</div> 548</div> 549<hr> 550<div class="refsect2"> 551<a name="gst-task-get-pool"></a><h3>gst_task_get_pool ()</h3> 552<pre class="programlisting"><a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="returnvalue">GstTaskPool</span></a> * 553gst_task_get_pool (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 554<p>Get the <a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="type">GstTaskPool</span></a> that this task will use for its streaming 555threads.</p> 556<p>MT safe.</p> 557<div class="refsect3"> 558<a name="gst-task-get-pool.parameters"></a><h4>Parameters</h4> 559<div class="informaltable"><table class="informaltable" width="100%" border="0"> 560<colgroup> 561<col width="150px" class="parameters_name"> 562<col class="parameters_description"> 563<col width="200px" class="parameters_annotations"> 564</colgroup> 565<tbody><tr> 566<td class="parameter_name"><p>task</p></td> 567<td class="parameter_description"><p>a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a></p></td> 568<td class="parameter_annotations"> </td> 569</tr></tbody> 570</table></div> 571</div> 572<div class="refsect3"> 573<a name="gst-task-get-pool.returns"></a><h4>Returns</h4> 574<p>the <a class="link" href="GstTaskPool.html" title="GstTaskPool"><span class="type">GstTaskPool</span></a> used by <em class="parameter"><code>task</code></em> 575. <a class="link" href="GstObject.html#gst-object-unref" title="gst_object_unref ()"><code class="function">gst_object_unref()</code></a> 576after usage. </p> 577<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 578</div> 579</div> 580<hr> 581<div class="refsect2"> 582<a name="GstTaskThreadFunc"></a><h3>GstTaskThreadFunc ()</h3> 583<pre class="programlisting"><span class="returnvalue">void</span> 584<span class="c_punctuation">(</span>*GstTaskThreadFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 585 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GThread"><span class="type">GThread</span></a> *thread</code></em>, 586 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> 587<p>Custom GstTask thread callback functions that can be installed.</p> 588<div class="refsect3"> 589<a name="GstTaskThreadFunc.parameters"></a><h4>Parameters</h4> 590<div class="informaltable"><table class="informaltable" width="100%" border="0"> 591<colgroup> 592<col width="150px" class="parameters_name"> 593<col class="parameters_description"> 594<col width="200px" class="parameters_annotations"> 595</colgroup> 596<tbody> 597<tr> 598<td class="parameter_name"><p>task</p></td> 599<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a></p></td> 600<td class="parameter_annotations"> </td> 601</tr> 602<tr> 603<td class="parameter_name"><p>thread</p></td> 604<td class="parameter_description"><p>The <a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GThread"><span class="type">GThread</span></a></p></td> 605<td class="parameter_annotations"> </td> 606</tr> 607<tr> 608<td class="parameter_name"><p>user_data</p></td> 609<td class="parameter_description"><p>user data</p></td> 610<td class="parameter_annotations"> </td> 611</tr> 612</tbody> 613</table></div> 614</div> 615</div> 616<hr> 617<div class="refsect2"> 618<a name="gst-task-set-enter-callback"></a><h3>gst_task_set_enter_callback ()</h3> 619<pre class="programlisting"><span class="returnvalue">void</span> 620gst_task_set_enter_callback (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 621 <em class="parameter"><code><a class="link" href="GstTask.html#GstTaskThreadFunc" title="GstTaskThreadFunc ()"><span class="type">GstTaskThreadFunc</span></a> enter_func</code></em>, 622 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, 623 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre> 624<p>Call <em class="parameter"><code>enter_func</code></em> 625 when the task function of <em class="parameter"><code>task</code></em> 626 is entered. <em class="parameter"><code>user_data</code></em> 627 will 628be passed to <em class="parameter"><code>enter_func</code></em> 629 and <em class="parameter"><code>notify</code></em> 630 will be called when <em class="parameter"><code>user_data</code></em> 631 is no 632longer referenced.</p> 633<div class="refsect3"> 634<a name="gst-task-set-enter-callback.parameters"></a><h4>Parameters</h4> 635<div class="informaltable"><table class="informaltable" width="100%" border="0"> 636<colgroup> 637<col width="150px" class="parameters_name"> 638<col class="parameters_description"> 639<col width="200px" class="parameters_annotations"> 640</colgroup> 641<tbody> 642<tr> 643<td class="parameter_name"><p>task</p></td> 644<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to use</p></td> 645<td class="parameter_annotations"> </td> 646</tr> 647<tr> 648<td class="parameter_name"><p>enter_func</p></td> 649<td class="parameter_description"><p>a <a class="link" href="GstTask.html#GstTaskThreadFunc" title="GstTaskThreadFunc ()"><span class="type">GstTaskThreadFunc</span></a>. </p></td> 650<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input. Default is transfer none."><span class="acronym">in</span></acronym>]</span></td> 651</tr> 652<tr> 653<td class="parameter_name"><p>user_data</p></td> 654<td class="parameter_description"><p>user data passed to <em class="parameter"><code>enter_func</code></em> 655</p></td> 656<td class="parameter_annotations"> </td> 657</tr> 658<tr> 659<td class="parameter_name"><p>notify</p></td> 660<td class="parameter_description"><p>called when <em class="parameter"><code>user_data</code></em> 661is no longer referenced</p></td> 662<td class="parameter_annotations"> </td> 663</tr> 664</tbody> 665</table></div> 666</div> 667</div> 668<hr> 669<div class="refsect2"> 670<a name="gst-task-set-leave-callback"></a><h3>gst_task_set_leave_callback ()</h3> 671<pre class="programlisting"><span class="returnvalue">void</span> 672gst_task_set_leave_callback (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 673 <em class="parameter"><code><a class="link" href="GstTask.html#GstTaskThreadFunc" title="GstTaskThreadFunc ()"><span class="type">GstTaskThreadFunc</span></a> leave_func</code></em>, 674 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, 675 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre> 676<p>Call <em class="parameter"><code>leave_func</code></em> 677 when the task function of <em class="parameter"><code>task</code></em> 678 is left. <em class="parameter"><code>user_data</code></em> 679 will 680be passed to <em class="parameter"><code>leave_func</code></em> 681 and <em class="parameter"><code>notify</code></em> 682 will be called when <em class="parameter"><code>user_data</code></em> 683 is no 684longer referenced.</p> 685<div class="refsect3"> 686<a name="gst-task-set-leave-callback.parameters"></a><h4>Parameters</h4> 687<div class="informaltable"><table class="informaltable" width="100%" border="0"> 688<colgroup> 689<col width="150px" class="parameters_name"> 690<col class="parameters_description"> 691<col width="200px" class="parameters_annotations"> 692</colgroup> 693<tbody> 694<tr> 695<td class="parameter_name"><p>task</p></td> 696<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to use</p></td> 697<td class="parameter_annotations"> </td> 698</tr> 699<tr> 700<td class="parameter_name"><p>leave_func</p></td> 701<td class="parameter_description"><p>a <a class="link" href="GstTask.html#GstTaskThreadFunc" title="GstTaskThreadFunc ()"><span class="type">GstTaskThreadFunc</span></a>. </p></td> 702<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input. Default is transfer none."><span class="acronym">in</span></acronym>]</span></td> 703</tr> 704<tr> 705<td class="parameter_name"><p>user_data</p></td> 706<td class="parameter_description"><p>user data passed to <em class="parameter"><code>leave_func</code></em> 707</p></td> 708<td class="parameter_annotations"> </td> 709</tr> 710<tr> 711<td class="parameter_name"><p>notify</p></td> 712<td class="parameter_description"><p>called when <em class="parameter"><code>user_data</code></em> 713is no longer referenced</p></td> 714<td class="parameter_annotations"> </td> 715</tr> 716</tbody> 717</table></div> 718</div> 719</div> 720<hr> 721<div class="refsect2"> 722<a name="gst-task-get-state"></a><h3>gst_task_get_state ()</h3> 723<pre class="programlisting"><a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState"><span class="returnvalue">GstTaskState</span></a> 724gst_task_get_state (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 725<p>Get the current state of the task.</p> 726<div class="refsect3"> 727<a name="gst-task-get-state.parameters"></a><h4>Parameters</h4> 728<div class="informaltable"><table class="informaltable" width="100%" border="0"> 729<colgroup> 730<col width="150px" class="parameters_name"> 731<col class="parameters_description"> 732<col width="200px" class="parameters_annotations"> 733</colgroup> 734<tbody><tr> 735<td class="parameter_name"><p>task</p></td> 736<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to query</p></td> 737<td class="parameter_annotations"> </td> 738</tr></tbody> 739</table></div> 740</div> 741<div class="refsect3"> 742<a name="gst-task-get-state.returns"></a><h4>Returns</h4> 743<p> The <a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState"><span class="type">GstTaskState</span></a> of the task</p> 744<p>MT safe.</p> 745</div> 746</div> 747<hr> 748<div class="refsect2"> 749<a name="gst-task-set-state"></a><h3>gst_task_set_state ()</h3> 750<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 751gst_task_set_state (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>, 752 <em class="parameter"><code><a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState"><span class="type">GstTaskState</span></a> state</code></em>);</pre> 753<p>Sets the state of <em class="parameter"><code>task</code></em> 754 to <em class="parameter"><code>state</code></em> 755.</p> 756<p>The <em class="parameter"><code>task</code></em> 757 must have a lock associated with it using 758<a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()"><code class="function">gst_task_set_lock()</code></a> when going to GST_TASK_STARTED or GST_TASK_PAUSED or 759this function will return <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p> 760<p>MT safe.</p> 761<div class="refsect3"> 762<a name="gst-task-set-state.parameters"></a><h4>Parameters</h4> 763<div class="informaltable"><table class="informaltable" width="100%" border="0"> 764<colgroup> 765<col width="150px" class="parameters_name"> 766<col class="parameters_description"> 767<col width="200px" class="parameters_annotations"> 768</colgroup> 769<tbody> 770<tr> 771<td class="parameter_name"><p>task</p></td> 772<td class="parameter_description"><p>a <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a></p></td> 773<td class="parameter_annotations"> </td> 774</tr> 775<tr> 776<td class="parameter_name"><p>state</p></td> 777<td class="parameter_description"><p>the new task state</p></td> 778<td class="parameter_annotations"> </td> 779</tr> 780</tbody> 781</table></div> 782</div> 783<div class="refsect3"> 784<a name="gst-task-set-state.returns"></a><h4>Returns</h4> 785<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the state could be changed.</p> 786</div> 787</div> 788<hr> 789<div class="refsect2"> 790<a name="gst-task-pause"></a><h3>gst_task_pause ()</h3> 791<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 792gst_task_pause (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 793<p>Pauses <em class="parameter"><code>task</code></em> 794. This method can also be called on a task in the 795stopped state, in which case a thread will be started and will remain 796in the paused state. This function does not wait for the task to complete 797the paused state.</p> 798<div class="refsect3"> 799<a name="gst-task-pause.parameters"></a><h4>Parameters</h4> 800<div class="informaltable"><table class="informaltable" width="100%" border="0"> 801<colgroup> 802<col width="150px" class="parameters_name"> 803<col class="parameters_description"> 804<col width="200px" class="parameters_annotations"> 805</colgroup> 806<tbody><tr> 807<td class="parameter_name"><p>task</p></td> 808<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to pause</p></td> 809<td class="parameter_annotations"> </td> 810</tr></tbody> 811</table></div> 812</div> 813<div class="refsect3"> 814<a name="gst-task-pause.returns"></a><h4>Returns</h4> 815<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the task could be paused.</p> 816<p>MT safe.</p> 817</div> 818</div> 819<hr> 820<div class="refsect2"> 821<a name="gst-task-start"></a><h3>gst_task_start ()</h3> 822<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 823gst_task_start (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 824<p>Starts <em class="parameter"><code>task</code></em> 825. The <em class="parameter"><code>task</code></em> 826 must have a lock associated with it using 827<a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()"><code class="function">gst_task_set_lock()</code></a> or this function will return <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p> 828<div class="refsect3"> 829<a name="gst-task-start.parameters"></a><h4>Parameters</h4> 830<div class="informaltable"><table class="informaltable" width="100%" border="0"> 831<colgroup> 832<col width="150px" class="parameters_name"> 833<col class="parameters_description"> 834<col width="200px" class="parameters_annotations"> 835</colgroup> 836<tbody><tr> 837<td class="parameter_name"><p>task</p></td> 838<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to start</p></td> 839<td class="parameter_annotations"> </td> 840</tr></tbody> 841</table></div> 842</div> 843<div class="refsect3"> 844<a name="gst-task-start.returns"></a><h4>Returns</h4> 845<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the task could be started.</p> 846<p>MT safe.</p> 847</div> 848</div> 849<hr> 850<div class="refsect2"> 851<a name="gst-task-stop"></a><h3>gst_task_stop ()</h3> 852<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 853gst_task_stop (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 854<p>Stops <em class="parameter"><code>task</code></em> 855. This method merely schedules the task to stop and 856will not wait for the task to have completely stopped. Use 857<a class="link" href="GstTask.html#gst-task-join" title="gst_task_join ()"><code class="function">gst_task_join()</code></a> to stop and wait for completion.</p> 858<div class="refsect3"> 859<a name="gst-task-stop.parameters"></a><h4>Parameters</h4> 860<div class="informaltable"><table class="informaltable" width="100%" border="0"> 861<colgroup> 862<col width="150px" class="parameters_name"> 863<col class="parameters_description"> 864<col width="200px" class="parameters_annotations"> 865</colgroup> 866<tbody><tr> 867<td class="parameter_name"><p>task</p></td> 868<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to stop</p></td> 869<td class="parameter_annotations"> </td> 870</tr></tbody> 871</table></div> 872</div> 873<div class="refsect3"> 874<a name="gst-task-stop.returns"></a><h4>Returns</h4> 875<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the task could be stopped.</p> 876<p>MT safe.</p> 877</div> 878</div> 879<hr> 880<div class="refsect2"> 881<a name="gst-task-join"></a><h3>gst_task_join ()</h3> 882<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 883gst_task_join (<em class="parameter"><code><a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> *task</code></em>);</pre> 884<p>Joins <em class="parameter"><code>task</code></em> 885. After this call, it is safe to unref the task 886and clean up the lock set with <a class="link" href="GstTask.html#gst-task-set-lock" title="gst_task_set_lock ()"><code class="function">gst_task_set_lock()</code></a>.</p> 887<p>The task will automatically be stopped with this call.</p> 888<p>This function cannot be called from within a task function as this 889would cause a deadlock. The function will detect this and print a 890g_warning.</p> 891<div class="refsect3"> 892<a name="gst-task-join.parameters"></a><h4>Parameters</h4> 893<div class="informaltable"><table class="informaltable" width="100%" border="0"> 894<colgroup> 895<col width="150px" class="parameters_name"> 896<col class="parameters_description"> 897<col width="200px" class="parameters_annotations"> 898</colgroup> 899<tbody><tr> 900<td class="parameter_name"><p>task</p></td> 901<td class="parameter_description"><p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> to join</p></td> 902<td class="parameter_annotations"> </td> 903</tr></tbody> 904</table></div> 905</div> 906<div class="refsect3"> 907<a name="gst-task-join.returns"></a><h4>Returns</h4> 908<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the task could be joined.</p> 909<p>MT safe.</p> 910</div> 911</div> 912<hr> 913<div class="refsect2"> 914<a name="gst-task-cleanup-all"></a><h3>gst_task_cleanup_all ()</h3> 915<pre class="programlisting"><span class="returnvalue">void</span> 916gst_task_cleanup_all (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> 917<p>Wait for all tasks to be stopped. This is mainly used internally 918to ensure proper cleanup of internal data structures in test suites.</p> 919<p>MT safe.</p> 920</div> 921</div> 922<div class="refsect1"> 923<a name="GstTask.other_details"></a><h2>Types and Values</h2> 924<div class="refsect2"> 925<a name="GstTask-struct"></a><h3>struct GstTask</h3> 926<pre class="programlisting">struct GstTask { 927 GstTaskState state; 928 GCond cond; 929 930 GRecMutex *lock; 931 932 GstTaskFunction func; 933 gpointer user_data; 934 GDestroyNotify notify; 935 936 gboolean running; 937}; 938</pre> 939<p>The <a class="link" href="GstTask.html" title="GstTask"><span class="type">GstTask</span></a> object.</p> 940<div class="refsect3"> 941<a name="GstTask.members"></a><h4>Members</h4> 942<div class="informaltable"><table class="informaltable" width="100%" border="0"> 943<colgroup> 944<col width="300px" class="struct_members_name"> 945<col class="struct_members_description"> 946<col width="200px" class="struct_members_annotations"> 947</colgroup> 948<tbody> 949<tr> 950<td class="struct_member_name"><p><a class="link" href="GstTask.html#GstTaskState" title="enum GstTaskState"><span class="type">GstTaskState</span></a> <em class="structfield"><code><a name="GstTask-struct.state"></a>state</code></em>;</p></td> 951<td class="struct_member_description"><p>the state of the task</p></td> 952<td class="struct_member_annotations"> </td> 953</tr> 954<tr> 955<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GCond"><span class="type">GCond</span></a> <em class="structfield"><code><a name="GstTask-struct.cond"></a>cond</code></em>;</p></td> 956<td class="struct_member_description"><p>used to pause/resume the task</p></td> 957<td class="struct_member_annotations"> </td> 958</tr> 959<tr> 960<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Threads.html#GRecMutex"><span class="type">GRecMutex</span></a> *<em class="structfield"><code><a name="GstTask-struct.lock"></a>lock</code></em>;</p></td> 961<td class="struct_member_description"><p>The lock taken when iterating the task function</p></td> 962<td class="struct_member_annotations"> </td> 963</tr> 964<tr> 965<td class="struct_member_name"><p><a class="link" href="GstTask.html#GstTaskFunction" title="GstTaskFunction ()"><span class="type">GstTaskFunction</span></a> <em class="structfield"><code><a name="GstTask-struct.func"></a>func</code></em>;</p></td> 966<td class="struct_member_description"><p>the function executed by this task</p></td> 967<td class="struct_member_annotations"> </td> 968</tr> 969<tr> 970<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> <em class="structfield"><code><a name="GstTask-struct.user-data"></a>user_data</code></em>;</p></td> 971<td class="struct_member_description"><p>user_data passed to the task function</p></td> 972<td class="struct_member_annotations"> </td> 973</tr> 974<tr> 975<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> <em class="structfield"><code><a name="GstTask-struct.notify"></a>notify</code></em>;</p></td> 976<td class="struct_member_description"><p>GDestroyNotify for <em class="parameter"><code>user_data</code></em> 977</p></td> 978<td class="struct_member_annotations"> </td> 979</tr> 980<tr> 981<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> <em class="structfield"><code><a name="GstTask-struct.running"></a>running</code></em>;</p></td> 982<td class="struct_member_description"><p>a flag indicating that the task is running</p></td> 983<td class="struct_member_annotations"> </td> 984</tr> 985</tbody> 986</table></div> 987</div> 988</div> 989<hr> 990<div class="refsect2"> 991<a name="GstTaskState"></a><h3>enum GstTaskState</h3> 992<p>The different states a task can be in</p> 993<div class="refsect3"> 994<a name="GstTaskState.members"></a><h4>Members</h4> 995<div class="informaltable"><table class="informaltable" width="100%" border="0"> 996<colgroup> 997<col width="300px" class="enum_members_name"> 998<col class="enum_members_description"> 999<col width="200px" class="enum_members_annotations"> 1000</colgroup> 1001<tbody> 1002<tr> 1003<td class="enum_member_name"><p><a name="GST-TASK-STARTED:CAPS"></a>GST_TASK_STARTED</p></td> 1004<td class="enum_member_description"> 1005<p>the task is started and running</p> 1006</td> 1007<td class="enum_member_annotations"> </td> 1008</tr> 1009<tr> 1010<td class="enum_member_name"><p><a name="GST-TASK-STOPPED:CAPS"></a>GST_TASK_STOPPED</p></td> 1011<td class="enum_member_description"> 1012<p>the task is stopped</p> 1013</td> 1014<td class="enum_member_annotations"> </td> 1015</tr> 1016<tr> 1017<td class="enum_member_name"><p><a name="GST-TASK-PAUSED:CAPS"></a>GST_TASK_PAUSED</p></td> 1018<td class="enum_member_description"> 1019<p>the task is paused</p> 1020</td> 1021<td class="enum_member_annotations"> </td> 1022</tr> 1023</tbody> 1024</table></div> 1025</div> 1026</div> 1027</div> 1028<div class="refsect1"> 1029<a name="GstTask.see-also"></a><h2>See Also</h2> 1030<p><a class="link" href="GstElement.html" title="GstElement"><span class="type">GstElement</span></a>, <a class="link" href="GstPad.html" title="GstPad"><span class="type">GstPad</span></a></p> 1031</div> 1032</div> 1033<div class="footer"> 1034<hr>Generated by GTK-Doc V1.28</div> 1035</body> 1036</html>