mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
query: add SCHEDULING query
Add a new query to replace the checkgetrange function.
This commit is contained in:
parent
70e276e920
commit
5fa3082e19
5 changed files with 141 additions and 4 deletions
|
@ -52,6 +52,38 @@ The getrange function
|
|||
The getrange function is called when a peer pad performs a _pull_range() on the pad. This
|
||||
downstream pad can be a pulling element or another _pull_range() based element.
|
||||
|
||||
|
||||
Scheduling Query
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
A sinkpad can ask the upstream srcpad for its scheduling attributes. It does
|
||||
this with the SCHEDULING query.
|
||||
|
||||
|
||||
(out) "pull-mode", G_TYPE_BOOLEAN (default FALSE)
|
||||
- if the pad can operate in pull mode, if this flag is not set the pad
|
||||
will operate in push mode.
|
||||
|
||||
(out) "random-access", G_TYPE_BOOLEAN (default FALSE)
|
||||
- the offset of a pull operation can be specified, if this flag is false,
|
||||
the offset should be -1,
|
||||
|
||||
(out) "sequential", G_TYPE_BOOLEAN (default TRUE)
|
||||
- suggest sequential access to the data. If random-access is specified,
|
||||
seeks are allowed but should be avoided. This is common for network
|
||||
streams. (
|
||||
|
||||
(out) "minsize", G_TYPE_INT (default 1)
|
||||
- the suggested minimum size of pull requests
|
||||
|
||||
(out) "maxsize", G_TYPE_INT (default -1, unlimited)
|
||||
- the suggested maximum size of pull requests
|
||||
|
||||
(out) "align", G_TYPE_INT (default 1)
|
||||
- the suggested alignment for the pull requests.
|
||||
|
||||
|
||||
|
||||
Plug-in techniques
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ static const gchar *_quark_strings[] = {
|
|||
"code", "text", "percent", "timeout", "GstBufferPoolConfig", "caps", "size",
|
||||
"min-buffers", "max-buffers", "prefix", "postfix", "align", "time",
|
||||
"GstQueryAllocation", "need-pool", "meta", "pool", "GstEventCaps",
|
||||
"GstEventReconfigure",
|
||||
"segment"
|
||||
"GstEventReconfigure", "segment", "GstQueryScheduling", "pull-mode",
|
||||
"random-access", "sequential"
|
||||
};
|
||||
|
||||
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -148,8 +148,12 @@ typedef enum _GstQuarkId
|
|||
GST_QUARK_EVENT_CAPS = 119,
|
||||
GST_QUARK_EVENT_RECONFIGURE = 120,
|
||||
GST_QUARK_SEGMENT = 121,
|
||||
GST_QUARK_QUERY_SCHEDULING = 122,
|
||||
GST_QUARK_PULL_MODE = 123,
|
||||
GST_QUARK_RANDOM_ACCESS = 124,
|
||||
GST_QUARK_SEQUENTIAL = 125,
|
||||
|
||||
GST_QUARK_MAX = 122
|
||||
GST_QUARK_MAX = 126
|
||||
} GstQuarkId;
|
||||
|
||||
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -1757,3 +1757,93 @@ gst_query_parse_nth_allocation_meta (GstQuery * query, guint index)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_new_scheduling
|
||||
*
|
||||
* Constructs a new query object for querying the scheduling properties.
|
||||
*
|
||||
* Free-function: gst_query_unref
|
||||
*
|
||||
* Returns: (transfer full): a new #GstQuery
|
||||
*/
|
||||
GstQuery *
|
||||
gst_query_new_scheduling (void)
|
||||
{
|
||||
GstQuery *query;
|
||||
GstStructure *structure;
|
||||
|
||||
structure = gst_structure_id_new (GST_QUARK (QUERY_SCHEDULING),
|
||||
GST_QUARK (PULL_MODE), G_TYPE_BOOLEAN, FALSE,
|
||||
GST_QUARK (RANDOM_ACCESS), G_TYPE_BOOLEAN, FALSE,
|
||||
GST_QUARK (SEQUENTIAL), G_TYPE_BOOLEAN, TRUE,
|
||||
GST_QUARK (MINSIZE), G_TYPE_INT, 1,
|
||||
GST_QUARK (MAXSIZE), G_TYPE_INT, -1,
|
||||
GST_QUARK (ALIGN), G_TYPE_INT, 1, NULL);
|
||||
query = gst_query_new (GST_QUERY_SCHEDULING, structure);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_set_scheduling
|
||||
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
|
||||
* @pull_mode: if pull mode scheduling is supported
|
||||
* @random_access: if random access is possible
|
||||
* @sequential: if sequential access is recommended
|
||||
* @minsize: the suggested minimum size of pull requests
|
||||
* @maxsize the suggested maximum size of pull requests:
|
||||
* @align: the suggested alignment of pull requests
|
||||
*
|
||||
* Set the scheduling properties.
|
||||
*/
|
||||
void
|
||||
gst_query_set_scheduling (GstQuery * query, gboolean pull_mode,
|
||||
gboolean random_access, gboolean sequential,
|
||||
gint minsize, gint maxsize, gint align)
|
||||
{
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
|
||||
g_return_if_fail (gst_query_is_writable (query));
|
||||
|
||||
structure = GST_QUERY_STRUCTURE (query);
|
||||
gst_structure_id_set (structure,
|
||||
GST_QUARK (PULL_MODE), G_TYPE_BOOLEAN, pull_mode,
|
||||
GST_QUARK (RANDOM_ACCESS), G_TYPE_BOOLEAN, random_access,
|
||||
GST_QUARK (SEQUENTIAL), G_TYPE_BOOLEAN, sequential,
|
||||
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
|
||||
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
|
||||
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_parse_scheduling
|
||||
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
|
||||
* @pull_mode: if pull mode scheduling is supported
|
||||
* @random_access: if random access is possible
|
||||
* @sequential: if sequential access is recommended
|
||||
* @minsize: the suggested minimum size of pull requests
|
||||
* @maxsize the suggested maximum size of pull requests:
|
||||
* @align: the suggested alignment of pull requests
|
||||
*
|
||||
* Set the scheduling properties.
|
||||
*/
|
||||
void
|
||||
gst_query_parse_scheduling (GstQuery * query, gboolean * pull_mode,
|
||||
gboolean * random_access, gboolean * sequential,
|
||||
gint * minsize, gint * maxsize, gint * align)
|
||||
{
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
|
||||
|
||||
structure = GST_QUERY_STRUCTURE (query);
|
||||
gst_structure_id_get (structure,
|
||||
GST_QUARK (PULL_MODE), G_TYPE_BOOLEAN, pull_mode,
|
||||
GST_QUARK (RANDOM_ACCESS), G_TYPE_BOOLEAN, random_access,
|
||||
GST_QUARK (SEQUENTIAL), G_TYPE_BOOLEAN, sequential,
|
||||
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
|
||||
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
|
||||
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ G_BEGIN_DECLS
|
|||
* 0.10.22.
|
||||
* @GST_QUERY_URI: query the URI of the source or sink. Since 0.10.22.
|
||||
* @GST_QUERY_ALLOCATION: the buffer allocation properties
|
||||
* @GST_QUERY_SCHEDULING: the scheduling properties
|
||||
*
|
||||
* Standard predefined Query types
|
||||
*/
|
||||
|
@ -73,7 +74,8 @@ typedef enum {
|
|||
GST_QUERY_BUFFERING,
|
||||
GST_QUERY_CUSTOM,
|
||||
GST_QUERY_URI,
|
||||
GST_QUERY_ALLOCATION
|
||||
GST_QUERY_ALLOCATION,
|
||||
GST_QUERY_SCHEDULING
|
||||
} GstQueryType;
|
||||
|
||||
/**
|
||||
|
@ -363,6 +365,15 @@ void gst_query_add_allocation_meta (GstQuery *query, const gcha
|
|||
guint gst_query_get_n_allocation_metas (GstQuery *query);
|
||||
const gchar * gst_query_parse_nth_allocation_meta (GstQuery *query, guint index);
|
||||
|
||||
/* scheduling query */
|
||||
GstQuery * gst_query_new_scheduling (void);
|
||||
|
||||
void gst_query_set_scheduling (GstQuery *query, gboolean pull_mode,
|
||||
gboolean random_access, gboolean sequential,
|
||||
gint minsize, gint maxsize, gint align);
|
||||
void gst_query_parse_scheduling (GstQuery *query, gboolean *pull_mode,
|
||||
gboolean *random_access, gboolean *sequential,
|
||||
gint *minsize, gint *maxsize, gint *align);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue