Trait gstreamer::prelude::TaskExt

source ·
pub trait TaskExt: IsA<Task> + Sealed + 'static {
    // Provided methods
    fn pool(&self) -> TaskPool { ... }
    fn state(&self) -> TaskState { ... }
    fn join(&self) -> Result<(), BoolError> { ... }
    fn pause(&self) -> Result<(), BoolError> { ... }
    fn resume(&self) -> Result<(), BoolError> { ... }
    fn set_pool(&self, pool: &impl IsA<TaskPool>) { ... }
    fn set_state(&self, state: TaskState) -> Result<(), BoolError> { ... }
    fn start(&self) -> Result<(), BoolError> { ... }
    fn stop(&self) -> Result<(), BoolError> { ... }
}
Expand description

Trait containing all Task methods.

§Implementors

Task

Provided Methods§

source

fn pool(&self) -> TaskPool

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

MT safe.

§Returns

the TaskPool used by self. gst_object_unref() after usage.

source

fn state(&self) -> TaskState

Get the current state of the task.

§Returns

The TaskState of the task

MT safe.

source

fn join(&self) -> Result<(), BoolError>

Joins self. After this call, it is safe to unref the task and clean up the lock set with [TaskExtManual::set_lock()][crate::prelude::TaskExtManual::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.

§Returns

true if the task could be joined.

MT safe.

source

fn pause(&self) -> Result<(), BoolError>

Pauses self. 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.

§Returns

true if the task could be paused.

MT safe.

source

fn resume(&self) -> Result<(), BoolError>

Resume self in case it was paused. If the task was stopped, it will remain in that state and this function will return false.

§Returns

true if the task could be resumed.

MT safe.

source

fn set_pool(&self, pool: &impl IsA<TaskPool>)

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

MT safe.

§pool

a TaskPool

source

fn set_state(&self, state: TaskState) -> Result<(), BoolError>

Sets the state of self to state.

The self must have a lock associated with it using [TaskExtManual::set_lock()][crate::prelude::TaskExtManual::set_lock()] when going to GST_TASK_STARTED or GST_TASK_PAUSED or this function will return false.

MT safe.

§state

the new task state

§Returns

true if the state could be changed.

source

fn start(&self) -> Result<(), BoolError>

Starts self. The self must have a lock associated with it using [TaskExtManual::set_lock()][crate::prelude::TaskExtManual::set_lock()] or this function will return false.

§Returns

true if the task could be started.

MT safe.

source

fn stop(&self) -> Result<(), BoolError>

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

§Returns

true if the task could be stopped.

MT safe.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O: IsA<Task>> TaskExt for O