query: add convenience API to query for scheduling mode and flags

This commit is contained in:
Mark Nauwelaerts 2012-09-11 16:39:34 +02:00
parent 00c6fa74f5
commit d1567a82ac
4 changed files with 30 additions and 0 deletions

View file

@ -2267,6 +2267,7 @@ gst_query_add_scheduling_mode
gst_query_get_n_scheduling_modes
gst_query_parse_nth_scheduling_mode
gst_query_has_scheduling_mode
gst_query_has_scheduling_mode_with_flags
gst_query_new_drain
<SUBSECTION Standard>

View file

@ -2129,6 +2129,32 @@ gst_query_has_scheduling_mode (GstQuery * query, GstPadMode mode)
return FALSE;
}
/**
* gst_query_has_scheduling_mode_with_flags:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
* @mode: the scheduling mode
* @flags: #GstSchedulingFlags
*
* Check if @query has scheduling mode set and @flags is set in
* query scheduling flags.
*
* Returns: TRUE when @mode is in the list of scheduling modes
* and @flags are compatible with query flags.
*/
gboolean
gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
GstSchedulingFlags flags)
{
GstSchedulingFlags sched_flags;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
gst_query_parse_scheduling (query, &sched_flags, NULL, NULL, NULL);
return ((flags & sched_flags) != 0) &&
gst_query_has_scheduling_mode (query, mode);
}
/**
* gst_query_new_accept_caps:
* @caps: a fixed #GstCaps

View file

@ -456,6 +456,8 @@ void gst_query_add_scheduling_mode (GstQuery *query, GstPadMode
guint gst_query_get_n_scheduling_modes (GstQuery *query);
GstPadMode gst_query_parse_nth_scheduling_mode (GstQuery *query, guint index);
gboolean gst_query_has_scheduling_mode (GstQuery *query, GstPadMode mode);
gboolean gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
GstSchedulingFlags flags);
/* accept-caps query */
GstQuery * gst_query_new_accept_caps (GstCaps *caps) G_GNUC_MALLOC;

View file

@ -859,6 +859,7 @@ EXPORTS
gst_query_get_structure
gst_query_get_type
gst_query_has_scheduling_mode
gst_query_has_scheduling_mode_with_flags
gst_query_new_accept_caps
gst_query_new_allocation
gst_query_new_buffering