Add busy field and quark for the buffering query so that the app can only use the query to see if buffering is in pro...

Original commit message from CVS:
* docs/design/part-buffering.txt:
* gst/gstquark.c:
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_parse_latency),
(gst_query_new_buffering), (gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent):
* gst/gstquery.h:
Add busy field and quark for the buffering query so that the app can
only use the query to see if buffering is in progress.
This commit is contained in:
Wim Taymans 2008-04-08 20:17:49 +00:00
parent 5e14412c47
commit 1365624d74
6 changed files with 36 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2008-04-08 Wim Taymans <wim.taymans@collabora.co.uk>
* docs/design/part-buffering.txt:
* gst/gstquark.c:
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_parse_latency),
(gst_query_new_buffering), (gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent):
* gst/gstquery.h:
Add busy field and quark for the buffering query so that the app can
only use the query to see if buffering is in progress.
2008-04-08 Wim Taymans <wim.taymans@collabora.co.uk>
* docs/gst/gstreamer-sections.txt:

View file

@ -191,6 +191,10 @@ In addition to all the fields present in the buffering message, the BUFFERING
query contains the following field, which indicate the available downloaded
range in a specific format and the estimated time to complete:
"busy", G_TYPE_BOOLEAN
- if buffering was busy. This flag allows the application to pause the
pipeline by using the query only.
"format", GST_TYPE_FORMAT
- the format of the "start" and "stop" values below

View file

@ -34,7 +34,7 @@ static const gchar *_quark_strings[] = {
"avg-in-rate", "avg-out-rate", "buffering-left",
"estimated-total", "old-state", "new-state", "pending-state",
"clock", "ready", "position", "new-base-time", "live", "min-latency",
"max-latency"
"max-latency", "busy"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -59,8 +59,9 @@ typedef enum _GstQuarkId
GST_QUARK_LIVE = 30,
GST_QUARK_MIN_LATENCY = 31,
GST_QUARK_MAX_LATENCY = 32,
GST_QUARK_BUSY = 33,
GST_QUARK_MAX = 33
GST_QUARK_MAX = 34
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -1118,8 +1118,11 @@ gst_query_new_buffering (GstFormat format)
GstStructure *structure;
structure = gst_structure_empty_new ("GstQueryBuffering");
/* by default, we configure the answer as no buffering with a 100% buffering
* progress */
gst_structure_id_set (structure,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, -1,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1,
@ -1137,36 +1140,45 @@ gst_query_new_buffering (GstFormat format)
/**
* gst_query_set_buffering_percent
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @busy: if buffering is busy
* @percent: a buffering percent
*
* Set the percentage of buffered data. This is a value between 0 and 100.
* The @busy indicator is %TRUE when the buffering is in progress.
*
* Since: 0.10.20
*/
void
gst_query_set_buffering_percent (GstQuery * query, gint percent)
gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent)
{
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
g_return_if_fail (percent >= 0 && percent <= 100);
gst_structure_id_set (query->structure,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL);
}
/**
* gst_query_parse_buffering_percent
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @busy: if buffering is busy
* @percent: a buffering percent
*
* Get the percentage of buffered data. This is a value between 0 and 100.
* The @busy indicator is %TRUE when the buffering is in progress.
*
* Since: 0.10.20
*/
void
gst_query_parse_buffering_percent (GstQuery * query, gint * percent)
gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy,
gint * percent)
{
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
if (busy)
*busy = g_value_get_boolean (gst_structure_id_get_value (query->structure,
GST_QUARK (BUSY)));
if (percent)
*percent = g_value_get_int (gst_structure_id_get_value (query->structure,
GST_QUARK (BUFFER_PERCENT)));

View file

@ -266,8 +266,8 @@ void gst_query_parse_formats_nth (GstQuery *query, guint nth, Gst
/* buffering query */
GstQuery* gst_query_new_buffering (GstFormat format);
void gst_query_set_buffering_percent (GstQuery *query, gint percent);
void gst_query_parse_buffering_percent (GstQuery *query, gint *percent);
void gst_query_set_buffering_percent (GstQuery *query, gboolean busy, gint percent);
void gst_query_parse_buffering_percent (GstQuery *query, gboolean *busy, gint *percent);
void gst_query_set_buffering_stats (GstQuery *query, GstBufferingMode mode,
gint avg_in, gint avg_out,