mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
pad: Add API to get the current state of a task
Avoiding the user to need to deal with the locking himself etc. API: gst_pad_task_get_state https://bugzilla.gnome.org/show_bug.cgi?id=778830
This commit is contained in:
parent
d6dba3fd6f
commit
6326c764ee
3 changed files with 36 additions and 0 deletions
|
@ -2058,6 +2058,7 @@ gst_pad_chain_list
|
||||||
gst_pad_start_task
|
gst_pad_start_task
|
||||||
gst_pad_pause_task
|
gst_pad_pause_task
|
||||||
gst_pad_stop_task
|
gst_pad_stop_task
|
||||||
|
gst_pad_task_get_state
|
||||||
|
|
||||||
gst_pad_set_active
|
gst_pad_set_active
|
||||||
|
|
||||||
|
|
34
gst/gstpad.c
34
gst/gstpad.c
|
@ -6069,6 +6069,40 @@ no_task:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_pad_get_task_state:
|
||||||
|
* @pad: the #GstPad to get task state from
|
||||||
|
*
|
||||||
|
* Get @pad task state. If no task is currently
|
||||||
|
* set, GST_TASK_STOPPED is returned.
|
||||||
|
*
|
||||||
|
* Returns: The current state of @pad's task.
|
||||||
|
*/
|
||||||
|
GstTaskState
|
||||||
|
gst_pad_get_task_state (GstPad * pad)
|
||||||
|
{
|
||||||
|
GstTask *task;
|
||||||
|
GstTaskState res;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), GST_TASK_STOPPED);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (pad);
|
||||||
|
task = GST_PAD_TASK (pad);
|
||||||
|
if (task == NULL)
|
||||||
|
goto no_task;
|
||||||
|
res = gst_task_get_state (task);
|
||||||
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
no_task:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (pad, "pad has no task");
|
||||||
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
return GST_TASK_STOPPED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_pad_stop_task:
|
* gst_pad_stop_task:
|
||||||
* @pad: the #GstPad to stop the task of
|
* @pad: the #GstPad to stop the task of
|
||||||
|
|
|
@ -1417,6 +1417,7 @@ gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
|
||||||
gpointer user_data, GDestroyNotify notify);
|
gpointer user_data, GDestroyNotify notify);
|
||||||
gboolean gst_pad_pause_task (GstPad *pad);
|
gboolean gst_pad_pause_task (GstPad *pad);
|
||||||
gboolean gst_pad_stop_task (GstPad *pad);
|
gboolean gst_pad_stop_task (GstPad *pad);
|
||||||
|
GstTaskState gst_pad_get_task_state (GstPad *pad);
|
||||||
|
|
||||||
/* internal links */
|
/* internal links */
|
||||||
void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
|
void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
|
||||||
|
|
Loading…
Reference in a new issue