Class: Gst::Task
Class Method Summary collapse
-
.cleanup_all ⇒ nil
Wait for all tasks to be stopped.
Instance Method Summary collapse
-
#initialize(func, user_data, notify) ⇒ Gst::Task
constructor
Create a new Task that will repeatedly call the provided func with user_data as a parameter.
-
#join ⇒ Boolean
Joins task.
-
#lock=(mutex) ⇒ nil
Set the mutex used by the task.
-
#pause ⇒ Boolean
Pauses task.
-
#pool ⇒ Gst::TaskPool
Get the Gst::TaskPool that this task will use for its streaming threads.
-
#pool=(pool) ⇒ nil
Set pool as the new GstTaskPool for task.
-
#resume ⇒ Boolean
Resume task in case it was paused.
-
#set_enter_callback(enter_func, user_data, notify) ⇒ nil
Call enter_func when the task function of task is entered.
-
#set_leave_callback(leave_func, user_data, notify) ⇒ nil
Call leave_func when the task function of task is left.
-
#start ⇒ Boolean
Starts task.
-
#state ⇒ Gst::TaskState
Get the current state of the task.
-
#state=(state) ⇒ Boolean
Sets the state of task to state.
-
#stop ⇒ Boolean
Stops task.
Methods inherited from Object
#add_control_binding, check_uniqueness, #control_bindings_disabled=, #control_rate, #control_rate=, default_deep_notify, #default_error, #get_control_binding, #get_g_value_array, #get_value, #get_value_array, #has_active_control_bindings, #has_ancestor, #has_as_ancestor, #has_as_parent, #name, #name=, #parent, #parent=, #path_string, #ref, ref_sink, #remove_control_binding, replace, #set_control_binding_disabled, #suggest_next_sync, #sync_values, #unparent, #unref
Constructor Details
#initialize(func, user_data, notify) ⇒ Gst::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 Gst::Task 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 GRec::Mutex must be configured using the gst_task_set_lock() function. This lock will always be acquired while func is called. MT safe.
Class Method Details
.cleanup_all ⇒ nil
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.
Instance Method Details
#join ⇒ Boolean
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. MT safe.
#lock=(mutex) ⇒ nil
Set the mutex used by the task. The mutex will be acquired before calling the Gst::TaskFunction.
This function has to be called before calling gst_task_pause() or gst_task_start().
MT safe.
#pause ⇒ Boolean
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. MT safe.
#pool ⇒ Gst::TaskPool
Get the Gst::TaskPool that this task will use for its streaming threads.
MT safe. after usage.
#pool=(pool) ⇒ nil
Set pool as the new GstTaskPool for task. Any new streaming threads that will be created by task will now use pool.
MT safe.
#resume ⇒ Boolean
Resume task in case it was paused. If the task was stopped, it will remain in that state and this function will return false. MT safe.
#set_enter_callback(enter_func, user_data, notify) ⇒ nil
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.
#set_leave_callback(leave_func, user_data, notify) ⇒ nil
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.
#start ⇒ Boolean
Starts task. The task must have a lock associated with it using gst_task_set_lock() or this function will return false. MT safe.
#state ⇒ Gst::TaskState
Get the current state of the task. MT safe.
#state=(state) ⇒ Boolean
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.
#stop ⇒ Boolean
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. MT safe.