docs/design/part-buffering.txt: Fix some typos and set the estimated total for push mode to -1.

Original commit message from CVS:
* docs/design/part-buffering.txt:
Fix some typos and set the estimated total for push mode to -1.
* gst/gstquery.c: (gst_query_new_buffering):
Set buffering-left to 0 as we're not buffering by default.
* libs/gst/base/gstbasesrc.c: (gst_base_src_default_query):
Implement BUFFERING query.
This commit is contained in:
Wim Taymans 2008-04-09 18:26:15 +00:00
parent caff4eb9a6
commit 08beab1f20
4 changed files with 56 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2008-04-09 Wim Taymans <wim.taymans@collabora.co.uk>
* docs/design/part-buffering.txt:
Fix some typos and set the estimated total for push mode to -1.
* gst/gstquery.c: (gst_query_new_buffering):
Set buffering-left to 0 as we're not buffering by default.
* libs/gst/base/gstbasesrc.c: (gst_base_src_default_query):
Implement BUFFERING query.
2008-04-09 Tim-Philipp Müller <tim at centricular dot net>
Based on patch by: Milosz Derezynski <internalerror gmail com>

View file

@ -236,7 +236,7 @@ A GstBaseSrc with random access replies to the BUFFERING query with:
"format" = GST_FORMAT_BYTES
"start" = 0
"stop" = the total filesize
"estimated-time" = 0
"estimated-total" = 0
A GstBaseSrc in push mode replies to the BUFFERING query with:
@ -248,5 +248,5 @@ A GstBaseSrc in push mode replies to the BUFFERING query with:
"format" = a valid GST_TYPE_FORMAT
"start" = current position
"stop" = current position
"estimated-time" = 0
"estimated-total" = -1

View file

@ -1126,7 +1126,7 @@ gst_query_new_buffering (GstFormat format)
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,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, -1,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, 0,
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, -1,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, (gint64) - 1,

View file

@ -756,6 +756,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
GST_DEBUG_OBJECT (src, "duration query in format %s",
gst_format_get_name (format));
switch (format) {
case GST_FORMAT_PERCENT:
gst_query_set_duration (query, GST_FORMAT_PERCENT,
@ -858,6 +859,47 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
}
case GST_QUERY_JITTER:
case GST_QUERY_RATE:
res = FALSE;
break;
case GST_QUERY_BUFFERING:
{
res = FALSE;
GstFormat format;
gint64 start, stop, estimated;
gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL);
GST_DEBUG_OBJECT (src, "buffering query in format %s",
gst_format_get_name (format));
if (src->random_access) {
estimated = 0;
start = 0;
if (format == GST_FORMAT_PERCENT)
stop = GST_FORMAT_PERCENT_MAX;
else
stop = src->segment.duration;
} else {
estimated = -1;
start = -1;
stop = -1;
}
/* convert to required format. When the conversion fails, we can't answer
* the query. When the value is unknown, we can don't perform conversion
* but report TRUE. */
if (format != GST_FORMAT_PERCENT && stop != -1) {
res = gst_pad_query_convert (src->srcpad, src->segment.format,
stop, &format, &stop);
} else {
res = TRUE;
}
if (res && format != GST_FORMAT_PERCENT && start != -1)
res = gst_pad_query_convert (src->srcpad, src->segment.format,
start, &format, &start);
gst_query_set_buffering_range (query, format, start, stop, estimated);
break;
}
default:
res = FALSE;
break;