plugins: update for query API changes

This commit is contained in:
Tim-Philipp Müller 2011-07-27 00:28:19 +01:00
parent 913e5e310c
commit 99742dc57e
2 changed files with 9 additions and 11 deletions

View file

@ -811,7 +811,6 @@ update_buffering (GstQueue2 * queue)
queue->buffering_percent = percent;
if (!QUEUE_IS_USING_QUEUE (queue)) {
GstFormat fmt = GST_FORMAT_BYTES;
gint64 duration;
if (QUEUE_IS_USING_RING_BUFFER (queue))
@ -820,10 +819,12 @@ update_buffering (GstQueue2 * queue)
mode = GST_BUFFERING_DOWNLOAD;
if (queue->byte_in_rate > 0) {
if (gst_pad_query_peer_duration (queue->sinkpad, &fmt, &duration))
if (gst_pad_query_peer_duration (queue->sinkpad, GST_FORMAT_BYTES,
&duration)) {
buffering_left =
(gdouble) ((duration -
queue->current->writing_pos) * 1000) / queue->byte_in_rate;
}
} else {
buffering_left = G_MAXINT64;
}
@ -2489,7 +2490,6 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
guint64 writing_pos;
gint percent;
gint64 estimated_total, buffering_left;
GstFormat peer_fmt;
gint64 duration;
gboolean peer_res, is_buffering, is_eos;
gdouble byte_in_rate, byte_out_rate;
@ -2512,9 +2512,8 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
duration = writing_pos;
} else {
/* get duration of upstream in bytes */
peer_fmt = GST_FORMAT_BYTES;
peer_res = gst_pad_query_peer_duration (queue->sinkpad, &peer_fmt,
&duration);
peer_res = gst_pad_query_peer_duration (queue->sinkpad,
GST_FORMAT_BYTES, &duration);
}
/* calculate remaining and total download time */
@ -2634,10 +2633,10 @@ gst_queue2_handle_query (GstElement * element, GstQuery * query)
static void
gst_queue2_update_upstream_size (GstQueue2 * queue)
{
GstFormat fmt = GST_FORMAT_BYTES;
gint64 upstream_size = -1;
if (gst_pad_query_peer_duration (queue->sinkpad, &fmt, &upstream_size)) {
if (gst_pad_query_peer_duration (queue->sinkpad, GST_FORMAT_BYTES,
&upstream_size)) {
GST_INFO_OBJECT (queue, "upstream size: %" G_GINT64_FORMAT, upstream_size);
queue->upstream_size = upstream_size;
}

View file

@ -940,10 +940,9 @@ gst_type_find_element_activate (GstPad * pad)
peer = gst_pad_get_peer (pad);
if (peer) {
gint64 size;
GstFormat format = GST_FORMAT_BYTES;
gchar *ext;
if (!gst_pad_query_duration (peer, &format, &size)) {
if (!gst_pad_query_duration (peer, GST_FORMAT_BYTES, &size)) {
GST_WARNING_OBJECT (typefind, "Could not query upstream length!");
gst_object_unref (peer);
gst_pad_activate_pull (pad, FALSE);