Commit 318baf4c authored by Wim Taymans's avatar Wim Taymans
Browse files

query: add new drain query

With the new serialized downstream queries we can implement a drain query that
makes an element waits until a downstream element replies to the query.
parent 05cd564b
......@@ -56,7 +56,7 @@ static const gchar *_quark_strings[] = {
"GstEventReconfigure", "segment", "GstQueryScheduling", "pull-mode",
"allocator", "GstEventFlushStop", "options", "GstQueryAcceptCaps",
"result", "GstQueryCaps", "filter", "modes", "GstEventStreamConfig",
"setup-data", "stream-headers", "GstEventGap"
"setup-data", "stream-headers", "GstEventGap", "GstQueryDrain"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
......
......@@ -162,7 +162,8 @@ typedef enum _GstQuarkId
GST_QUARK_SETUP_DATA = 133,
GST_QUARK_STREAM_HEADERS = 134,
GST_QUARK_EVENT_GAP = 135,
GST_QUARK_MAX = 136
GST_QUARK_QUERY_DRAIN = 136,
GST_QUARK_MAX = 137
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
......
......@@ -121,6 +121,7 @@ static GstQueryQuarks query_quarks[] = {
{GST_QUERY_SCHEDULING, "scheduling", 0},
{GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
{GST_QUERY_CAPS, "caps", 0},
{GST_QUERY_DRAIN, "drain", 0},
{0, NULL, 0}
};
......@@ -2147,3 +2148,24 @@ gst_query_intersect_caps_result (GstQuery * query, GstCaps * filter,
gst_query_set_caps_result (query, res);
gst_caps_unref (res);
}
/**
* gst_query_new_drain:
*
* Constructs a new query object for querying the drain state.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_drain (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id_empty (GST_QUARK (QUERY_DRAIN));
query = gst_query_new_custom (GST_QUERY_DRAIN, structure);
return query;
}
......@@ -101,6 +101,7 @@ typedef enum {
* @GST_QUERY_SCHEDULING: the scheduling properties
* @GST_QUERY_ACCEPT_CAPS: the accept caps query
* @GST_QUERY_CAPS: the caps query
* @GST_QUERY_DRAIN: wait till all serialized data is consumed downstream
*
* Standard predefined Query types
*/
......@@ -123,7 +124,8 @@ typedef enum {
GST_QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
GST_QUERY_ACCEPT_CAPS = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
GST_QUERY_CAPS = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH))
GST_QUERY_CAPS = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH)),
GST_QUERY_DRAIN = GST_QUERY_MAKE_TYPE (180, FLAG(DOWNSTREAM) | FLAG(SERIALIZED))
} GstQueryType;
#undef FLAG
......@@ -456,6 +458,8 @@ void gst_query_parse_caps_result (GstQuery *query, GstCaps **c
void gst_query_intersect_caps_result (GstQuery *query, GstCaps *filter,
GstCapsIntersectMode mode);
/* drain query */
GstQuery * gst_query_new_drain (void) G_GNUC_MALLOC;
G_END_DECLS
......
......@@ -825,6 +825,7 @@ EXPORTS
gst_query_new_caps
gst_query_new_convert
gst_query_new_custom
gst_query_new_drain
gst_query_new_duration
gst_query_new_formats
gst_query_new_latency
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment