mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
plugins: update for query API changes
This commit is contained in:
parent
913e5e310c
commit
99742dc57e
2 changed files with 9 additions and 11 deletions
|
@ -811,7 +811,6 @@ update_buffering (GstQueue2 * queue)
|
||||||
queue->buffering_percent = percent;
|
queue->buffering_percent = percent;
|
||||||
|
|
||||||
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
|
|
||||||
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
||||||
|
@ -820,10 +819,12 @@ update_buffering (GstQueue2 * queue)
|
||||||
mode = GST_BUFFERING_DOWNLOAD;
|
mode = GST_BUFFERING_DOWNLOAD;
|
||||||
|
|
||||||
if (queue->byte_in_rate > 0) {
|
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 =
|
buffering_left =
|
||||||
(gdouble) ((duration -
|
(gdouble) ((duration -
|
||||||
queue->current->writing_pos) * 1000) / queue->byte_in_rate;
|
queue->current->writing_pos) * 1000) / queue->byte_in_rate;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buffering_left = G_MAXINT64;
|
buffering_left = G_MAXINT64;
|
||||||
}
|
}
|
||||||
|
@ -2489,7 +2490,6 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
|
||||||
guint64 writing_pos;
|
guint64 writing_pos;
|
||||||
gint percent;
|
gint percent;
|
||||||
gint64 estimated_total, buffering_left;
|
gint64 estimated_total, buffering_left;
|
||||||
GstFormat peer_fmt;
|
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
gboolean peer_res, is_buffering, is_eos;
|
gboolean peer_res, is_buffering, is_eos;
|
||||||
gdouble byte_in_rate, byte_out_rate;
|
gdouble byte_in_rate, byte_out_rate;
|
||||||
|
@ -2512,9 +2512,8 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
|
||||||
duration = writing_pos;
|
duration = writing_pos;
|
||||||
} else {
|
} else {
|
||||||
/* get duration of upstream in bytes */
|
/* get duration of upstream in bytes */
|
||||||
peer_fmt = GST_FORMAT_BYTES;
|
peer_res = gst_pad_query_peer_duration (queue->sinkpad,
|
||||||
peer_res = gst_pad_query_peer_duration (queue->sinkpad, &peer_fmt,
|
GST_FORMAT_BYTES, &duration);
|
||||||
&duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate remaining and total download time */
|
/* calculate remaining and total download time */
|
||||||
|
@ -2634,10 +2633,10 @@ gst_queue2_handle_query (GstElement * element, GstQuery * query)
|
||||||
static void
|
static void
|
||||||
gst_queue2_update_upstream_size (GstQueue2 * queue)
|
gst_queue2_update_upstream_size (GstQueue2 * queue)
|
||||||
{
|
{
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
gint64 upstream_size = -1;
|
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);
|
GST_INFO_OBJECT (queue, "upstream size: %" G_GINT64_FORMAT, upstream_size);
|
||||||
queue->upstream_size = upstream_size;
|
queue->upstream_size = upstream_size;
|
||||||
}
|
}
|
||||||
|
@ -2793,7 +2792,7 @@ gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
|
||||||
result = gst_queue2_open_temp_location_file (queue);
|
result = gst_queue2_open_temp_location_file (queue);
|
||||||
} else if (!queue->ring_buffer) {
|
} else if (!queue->ring_buffer) {
|
||||||
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
|
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
|
||||||
result = !!queue->ring_buffer;
|
result = ! !queue->ring_buffer;
|
||||||
} else {
|
} else {
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,10 +940,9 @@ gst_type_find_element_activate (GstPad * pad)
|
||||||
peer = gst_pad_get_peer (pad);
|
peer = gst_pad_get_peer (pad);
|
||||||
if (peer) {
|
if (peer) {
|
||||||
gint64 size;
|
gint64 size;
|
||||||
GstFormat format = GST_FORMAT_BYTES;
|
|
||||||
gchar *ext;
|
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_WARNING_OBJECT (typefind, "Could not query upstream length!");
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
gst_pad_activate_pull (pad, FALSE);
|
gst_pad_activate_pull (pad, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue