Package ch.bailu.gtk.gst
Klasse Task
- Alle implementierten Schnittstellen:
PointerInterface
#GstTask is used by #GstElement and #GstPad to provide the data passing
threads in a #GstPipeline.
A #GstPad will typically start a #GstTask to push or pull data to/from the
peer pads. Most source elements start a #GstTask to push data. In some cases
a demuxer element can start a #GstTask to pull data from a peer element. This
is typically done when the demuxer can perform random access on the upstream
peer element for improved performance.
Although convenience functions exist on #GstPad to start/pause/stop tasks, it
might sometimes be needed to create a #GstTask manually if it is not related to
a #GstPad.
Before the #GstTask can be run, it needs a #GRecMutex that can be set with
gst_task_set_lock().
The task can be started, paused and stopped with gst_task_start(), gst_task_pause()
and gst_task_stop() respectively or with the gst_task_set_state() function.
A #GstTask will repeatedly call the #GstTaskFunction with the user data
that was provided when creating the task with gst_task_new(). While calling
the function it will acquire the provided lock. The provided lock is released
when the task pauses or stops.
Stopping a task with gst_task_stop() will not immediately make sure the task is
not running anymore. Use gst_task_join() to make sure the task is completely
stopped and the thread is stopped.
After creating a #GstTask, use gst_object_unref() to free its resources. This can
only be done when the task is not running anymore.
Task functions can send a #GstMessage to send out-of-band data to the
application. The application can receive messages from the #GstBus in its
mainloop.
For debugging purposes, the task will configure its object name as the thread
name on Linux. Please note that the object name should be configured before the
task is started; changing the object name after the task has been started, has
no effect on the thread name.
threads in a #GstPipeline.
A #GstPad will typically start a #GstTask to push or pull data to/from the
peer pads. Most source elements start a #GstTask to push data. In some cases
a demuxer element can start a #GstTask to pull data from a peer element. This
is typically done when the demuxer can perform random access on the upstream
peer element for improved performance.
Although convenience functions exist on #GstPad to start/pause/stop tasks, it
might sometimes be needed to create a #GstTask manually if it is not related to
a #GstPad.
Before the #GstTask can be run, it needs a #GRecMutex that can be set with
gst_task_set_lock().
The task can be started, paused and stopped with gst_task_start(), gst_task_pause()
and gst_task_stop() respectively or with the gst_task_set_state() function.
A #GstTask will repeatedly call the #GstTaskFunction with the user data
that was provided when creating the task with gst_task_new(). While calling
the function it will acquire the provided lock. The provided lock is released
when the task pauses or stops.
Stopping a task with gst_task_stop() will not immediately make sure the task is
not running anymore. Use gst_task_join() to make sure the task is completely
stopped and the thread is stopped.
After creating a #GstTask, use gst_object_unref() to free its resources. This can
only be done when the task is not running anymore.
Task functions can send a #GstMessage to send out-of-band data to the
application. The application can receive messages from the #GstBus in its
mainloop.
For debugging purposes, the task will configure its object name as the thread
name on Linux. Please note that the object name should be configured before the
task is started; changing the object name after the task has been started, has
no effect on the thread name.
https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungTask
(Task.OnTaskFunction func, Pointer user_data, Task.OnDestroyNotify notify) Create a new Task that will repeatedly call the provided @func
with @user_data as a parameter.Task
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
Wait for all tasks to be stopped.static ClassHandler
static int
static long
static TypeSystem.TypeSize
getPool()
Get the #GstTaskPool that this task will use for its streaming
threads.int
getState()
Get the current state of the task.static long
static TypeSystem.TypeSize
boolean
join()
Joins @task.boolean
pause()
Pauses @task.boolean
resume()
Resume @task in case it was paused.void
setEnterCallback
(Task.OnTaskThreadFunc enter_func, Pointer user_data, Task.OnDestroyNotify notify) Call @enter_func when the task function of @task is entered.void
setLeaveCallback
(Task.OnTaskThreadFunc leave_func, Pointer user_data, Task.OnDestroyNotify notify) Call @leave_func when the task function of @task is left.void
Set the mutex used by the task.void
Set @pool as the new GstTaskPool for @task.boolean
setState
(int state) Sets the state of @task to @state.boolean
start()
Starts @task.boolean
stop()
Stops @task.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
Task
-
Task
Create a new Task that will repeatedly call the provided @func
with @user_data as a parameter. Typically the task will run in
a new thread.
The function cannot be changed after the task has been created. You
must create a new #GstTask to change the function.
This function will not yet create and start a thread. Use gst_task_start() or
gst_task_pause() to create and start the GThread.
Before the task can be used, a #GRecMutex must be configured using the
gst_task_set_lock() function. This lock will always be acquired while
@func is called.- Parameter:
func
- The #GstTaskFunction to useuser_data
- User data to pass to @funcnotify
- the function to call when @user_data is no longer needed.
-
-
Methodendetails
-
getClassHandler
-
getPool
Get the #GstTaskPool that this task will use for its streaming
threads.
MT safe.- Gibt zurück:
- the #GstTaskPool used by @task. gst_object_unref() after usage.
-
getState
public int getState()Get the current state of the task.- Gibt zurück:
- The #GstTaskState of the task MT safe.
-
join
public boolean join()Joins @task. After this call, it is safe to unref the task
and clean up the lock set with gst_task_set_lock().
The task will automatically be stopped with this call.
This function cannot be called from within a task function as this
would cause a deadlock. The function will detect this and print a
g_warning.- Gibt zurück:
- %TRUE if the task could be joined. MT safe.
-
pause
public boolean pause()Pauses @task. This method can also be called on a task in the
stopped state, in which case a thread will be started and will remain
in the paused state. This function does not wait for the task to complete
the paused state.- Gibt zurück:
- %TRUE if the task could be paused. MT safe.
-
resume
public boolean resume()Resume @task in case it was paused. If the task was stopped, it will
remain in that state and this function will return %FALSE.- Gibt zurück:
- %TRUE if the task could be resumed. MT safe.
-
setEnterCallback
public void setEnterCallback(Task.OnTaskThreadFunc enter_func, @Nullable Pointer user_data, Task.OnDestroyNotify notify) Call @enter_func when the task function of @task is entered. @user_data will
be passed to @enter_func and @notify will be called when @user_data is no
longer referenced.- Parameter:
enter_func
- a #GstTaskThreadFuncuser_data
- user data passed to @enter_funcnotify
- called when @user_data is no longer referenced
-
setLeaveCallback
public void setLeaveCallback(Task.OnTaskThreadFunc leave_func, @Nullable Pointer user_data, Task.OnDestroyNotify notify) Call @leave_func when the task function of @task is left. @user_data will
be passed to @leave_func and @notify will be called when @user_data is no
longer referenced.- Parameter:
leave_func
- a #GstTaskThreadFuncuser_data
- user data passed to @leave_funcnotify
- called when @user_data is no longer referenced
-
setLock
Set the mutex used by the task. The mutex will be acquired before
calling the #GstTaskFunction.
This function has to be called before calling gst_task_pause() or
gst_task_start().
MT safe.- Parameter:
mutex
- The #GRecMutex to use
-
setPool
Set @pool as the new GstTaskPool for @task. Any new streaming threads that
will be created by @task will now use @pool.
MT safe.- Parameter:
pool
- a #GstTaskPool
-
setState
public boolean setState(int state) Sets the state of @task to @state.
The @task must have a lock associated with it using
gst_task_set_lock() when going to GST_TASK_STARTED or GST_TASK_PAUSED or
this function will return %FALSE.
MT safe.- Parameter:
state
- the new task state- Gibt zurück:
- %TRUE if the state could be changed.
-
start
public boolean start()Starts @task. The @task must have a lock associated with it using
gst_task_set_lock() or this function will return %FALSE.- Gibt zurück:
- %TRUE if the task could be started. MT safe.
-
stop
public boolean stop()Stops @task. This method merely schedules the task to stop and
will not wait for the task to have completely stopped. Use
gst_task_join() to stop and wait for completion.- Gibt zurück:
- %TRUE if the task could be stopped. MT safe.
-
cleanupAll
public static void cleanupAll()Wait for all tasks to be stopped. This is mainly used internally
to ensure proper cleanup of internal data structures in test suites.
MT safe. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-