mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
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.
This commit is contained in:
parent
05cd564bea
commit
318baf4cd9
5 changed files with 31 additions and 3 deletions
|
@ -56,7 +56,7 @@ static const gchar *_quark_strings[] = {
|
||||||
"GstEventReconfigure", "segment", "GstQueryScheduling", "pull-mode",
|
"GstEventReconfigure", "segment", "GstQueryScheduling", "pull-mode",
|
||||||
"allocator", "GstEventFlushStop", "options", "GstQueryAcceptCaps",
|
"allocator", "GstEventFlushStop", "options", "GstQueryAcceptCaps",
|
||||||
"result", "GstQueryCaps", "filter", "modes", "GstEventStreamConfig",
|
"result", "GstQueryCaps", "filter", "modes", "GstEventStreamConfig",
|
||||||
"setup-data", "stream-headers", "GstEventGap"
|
"setup-data", "stream-headers", "GstEventGap", "GstQueryDrain"
|
||||||
};
|
};
|
||||||
|
|
||||||
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||||
|
|
|
@ -162,7 +162,8 @@ typedef enum _GstQuarkId
|
||||||
GST_QUARK_SETUP_DATA = 133,
|
GST_QUARK_SETUP_DATA = 133,
|
||||||
GST_QUARK_STREAM_HEADERS = 134,
|
GST_QUARK_STREAM_HEADERS = 134,
|
||||||
GST_QUARK_EVENT_GAP = 135,
|
GST_QUARK_EVENT_GAP = 135,
|
||||||
GST_QUARK_MAX = 136
|
GST_QUARK_QUERY_DRAIN = 136,
|
||||||
|
GST_QUARK_MAX = 137
|
||||||
} GstQuarkId;
|
} GstQuarkId;
|
||||||
|
|
||||||
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||||
|
|
|
@ -121,6 +121,7 @@ static GstQueryQuarks query_quarks[] = {
|
||||||
{GST_QUERY_SCHEDULING, "scheduling", 0},
|
{GST_QUERY_SCHEDULING, "scheduling", 0},
|
||||||
{GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
|
{GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
|
||||||
{GST_QUERY_CAPS, "caps", 0},
|
{GST_QUERY_CAPS, "caps", 0},
|
||||||
|
{GST_QUERY_DRAIN, "drain", 0},
|
||||||
|
|
||||||
{0, NULL, 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_query_set_caps_result (query, res);
|
||||||
gst_caps_unref (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_SCHEDULING: the scheduling properties
|
||||||
* @GST_QUERY_ACCEPT_CAPS: the accept caps query
|
* @GST_QUERY_ACCEPT_CAPS: the accept caps query
|
||||||
* @GST_QUERY_CAPS: the caps query
|
* @GST_QUERY_CAPS: the caps query
|
||||||
|
* @GST_QUERY_DRAIN: wait till all serialized data is consumed downstream
|
||||||
*
|
*
|
||||||
* Standard predefined Query types
|
* Standard predefined Query types
|
||||||
*/
|
*/
|
||||||
|
@ -123,7 +124,8 @@ typedef enum {
|
||||||
GST_QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
|
GST_QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
|
||||||
GST_QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
|
GST_QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
|
||||||
GST_QUERY_ACCEPT_CAPS = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
|
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;
|
} GstQueryType;
|
||||||
#undef FLAG
|
#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,
|
void gst_query_intersect_caps_result (GstQuery *query, GstCaps *filter,
|
||||||
GstCapsIntersectMode mode);
|
GstCapsIntersectMode mode);
|
||||||
|
/* drain query */
|
||||||
|
GstQuery * gst_query_new_drain (void) G_GNUC_MALLOC;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -825,6 +825,7 @@ EXPORTS
|
||||||
gst_query_new_caps
|
gst_query_new_caps
|
||||||
gst_query_new_convert
|
gst_query_new_convert
|
||||||
gst_query_new_custom
|
gst_query_new_custom
|
||||||
|
gst_query_new_drain
|
||||||
gst_query_new_duration
|
gst_query_new_duration
|
||||||
gst_query_new_formats
|
gst_query_new_formats
|
||||||
gst_query_new_latency
|
gst_query_new_latency
|
||||||
|
|
Loading…
Reference in a new issue