gi-gst-1.0.11: GStreamer bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gst.Objects.Task

Contents

Description

Task is used by Element and Pad to provide the data passing threads in a Pipeline.

A Pad will typically start a Task to push or pull data to/from the peer pads. Most source elements start a Task to push data. In some cases a demuxer element can start a Task 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 Pad to start/pause/stop tasks, it might sometimes be needed to create a Task manually if it is not related to a Pad.

Before the Task can be run, it needs a RecMutex that can be set with taskSetLock.

The task can be started, paused and stopped with taskStart, taskPause and taskStop respectively or with the taskSetState function.

A Task will repeatedly call the TaskFunction with the user data that was provided when creating the task with taskNew. 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 taskStop will not immediately make sure the task is not running anymore. Use taskJoin to make sure the task is completely stopped and the thread is stopped.

After creating a Task, use objectUnref to free its resources. This can only be done when the task is not running anymore.

Task functions can send a Message to send out-of-band data to the application. The application can receive messages from the Bus 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.

Synopsis

Exported types

newtype Task Source #

Constructors

Task (ManagedPtr Task) 

Instances

GObject Task Source # 

Methods

gobjectType :: Task -> IO GType #

IsObject Task Source # 
IsTask Task Source # 
IsObject Task Source # 
((~) * info (ResolveTaskMethod t Task), MethodInfo * info Task p) => IsLabel t (Task -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Task -> p #

((~) * info (ResolveTaskMethod t Task), MethodInfo * info Task p) => IsLabelProxy t (Task -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Task -> p #

HasAttributeList * Task Source # 
type AttributeList Task Source # 
type SignalList Task Source # 

toTask :: IsTask o => o -> IO Task Source #

Methods

cleanupAll

taskCleanupAll :: (HasCallStack, MonadIO m) => m () Source #

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.

getPool

data TaskGetPoolMethodInfo Source #

Instances

((~) * signature (m TaskPool), MonadIO m, IsTask a) => MethodInfo * TaskGetPoolMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskGetPoolMethodInfo a -> signature -> s #

taskGetPool Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: a Task

-> m TaskPool

Returns: the TaskPool used by task. objectUnref after usage.

Get the TaskPool that this task will use for its streaming threads.

MT safe.

getState

data TaskGetStateMethodInfo Source #

Instances

((~) * signature (m TaskState), MonadIO m, IsTask a) => MethodInfo * TaskGetStateMethodInfo a signature Source # 

taskGetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to query

-> m TaskState

Returns: The TaskState of the task

MT safe.

Get the current state of the task.

join

data TaskJoinMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsTask a) => MethodInfo * TaskJoinMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskJoinMethodInfo a -> signature -> s #

taskJoin Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to join

-> m Bool

Returns: True if the task could be joined.

MT safe.

Joins task. After this call, it is safe to unref the task and clean up the lock set with taskSetLock.

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.

new

taskNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> TaskFunction

func: The TaskFunction to use

-> m Task

Returns: A new Task.

MT safe.

Create a new Task that will repeatedly call the provided func with userData 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 Task to change the function.

This function will not yet create and start a thread. Use taskStart or taskPause to create and start the GThread.

Before the task can be used, a RecMutex must be configured using the taskSetLock function. This lock will always be acquired while func is called.

pause

data TaskPauseMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsTask a) => MethodInfo * TaskPauseMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskPauseMethodInfo a -> signature -> s #

taskPause Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to pause

-> m Bool

Returns: True if the task could be paused.

MT safe.

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.

setEnterCallback

taskSetEnterCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to use

-> TaskThreadFunc

enterFunc: a TaskThreadFunc

-> m () 

Call enterFunc when the task function of task is entered. userData will be passed to enterFunc and notify will be called when userData is no longer referenced.

setLeaveCallback

taskSetLeaveCallback Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to use

-> TaskThreadFunc

leaveFunc: a TaskThreadFunc

-> m () 

Call leaveFunc when the task function of task is left. userData will be passed to leaveFunc and notify will be called when userData is no longer referenced.

setLock

data TaskSetLockMethodInfo Source #

Instances

((~) * signature (RecMutex -> m ()), MonadIO m, IsTask a) => MethodInfo * TaskSetLockMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskSetLockMethodInfo a -> signature -> s #

taskSetLock Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to use

-> RecMutex

mutex: The RecMutex to use

-> m () 

Set the mutex used by the task. The mutex will be acquired before calling the TaskFunction.

This function has to be called before calling taskPause or taskStart.

MT safe.

setPool

data TaskSetPoolMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsTask a, IsTaskPool b) => MethodInfo * TaskSetPoolMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskSetPoolMethodInfo a -> signature -> s #

taskSetPool Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a, IsTaskPool b) 
=> a

task: a Task

-> b

pool: a TaskPool

-> m () 

Set pool as the new GstTaskPool for task. Any new streaming threads that will be created by task will now use pool.

MT safe.

setState

data TaskSetStateMethodInfo Source #

Instances

((~) * signature (TaskState -> m Bool), MonadIO m, IsTask a) => MethodInfo * TaskSetStateMethodInfo a signature Source # 

taskSetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: a Task

-> TaskState

state: the new task state

-> m Bool

Returns: True if the state could be changed.

Sets the state of task to state.

The task must have a lock associated with it using taskSetLock when going to GST_TASK_STARTED or GST_TASK_PAUSED or this function will return False.

MT safe.

start

data TaskStartMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsTask a) => MethodInfo * TaskStartMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskStartMethodInfo a -> signature -> s #

taskStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to start

-> m Bool

Returns: True if the task could be started.

MT safe.

Starts task. The task must have a lock associated with it using taskSetLock or this function will return False.

stop

data TaskStopMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsTask a) => MethodInfo * TaskStopMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TaskStopMethodInfo a -> signature -> s #

taskStop Source #

Arguments

:: (HasCallStack, MonadIO m, IsTask a) 
=> a

task: The Task to stop

-> m Bool

Returns: True if the task could be stopped.

MT safe.

Stops task. This method merely schedules the task to stop and will not wait for the task to have completely stopped. Use taskJoin to stop and wait for completion.