mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gst/playback/gstqueue2.c: Include extra buffering stats in the buffering message.
Original commit message from CVS: * gst/playback/gstqueue2.c: (update_buffering), (gst_queue_close_temp_location_file), (gst_queue_handle_src_query), (gst_queue_src_checkgetrange_function): Include extra buffering stats in the buffering message. Implement BUFFERING query. * gst/playback/gsturidecodebin.c: (do_async_start), (do_async_done), (type_found), (setup_streaming), (setup_source), (gst_uri_decode_bin_change_state): Only add decodebin2 when the type is found in streaming mode. Make uridecodebin async to PAUSED even when we don't have decodebin2 added yet.
This commit is contained in:
parent
99fa2d2e86
commit
e5bdd95038
4 changed files with 119 additions and 14 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2008-04-09 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst/playback/gstqueue2.c: (update_buffering),
|
||||||
|
(gst_queue_close_temp_location_file), (gst_queue_handle_src_query),
|
||||||
|
(gst_queue_src_checkgetrange_function):
|
||||||
|
Include extra buffering stats in the buffering message.
|
||||||
|
Implement BUFFERING query.
|
||||||
|
|
||||||
|
* gst/playback/gsturidecodebin.c: (do_async_start),
|
||||||
|
(do_async_done), (type_found), (setup_streaming), (setup_source),
|
||||||
|
(gst_uri_decode_bin_change_state):
|
||||||
|
Only add decodebin2 when the type is found in streaming mode.
|
||||||
|
Make uridecodebin async to PAUSED even when we don't have decodebin2
|
||||||
|
added yet.
|
||||||
|
|
||||||
2008-04-09 Sebastian Dröge <slomo@circular-chaos.org>
|
2008-04-09 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* ext/gio/gstgio.c: (gst_gio_get_supported_protocols):
|
* ext/gio/gstgio.c: (gst_gio_get_supported_protocols):
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit fda6da5f2b9b000f7e1df8ffb44a6185ffd9799b
|
Subproject commit d3ace35f57dd196a3e83a0a48f1350ca32db8e39
|
|
@ -689,6 +689,8 @@ update_buffering (GstQueue * queue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (post) {
|
if (post) {
|
||||||
|
GstMessage *message;
|
||||||
|
|
||||||
/* scale to high percent so that it becomes the 100% mark */
|
/* scale to high percent so that it becomes the 100% mark */
|
||||||
percent = percent * 100 / queue->high_percent;
|
percent = percent * 100 / queue->high_percent;
|
||||||
/* clip */
|
/* clip */
|
||||||
|
@ -696,8 +698,12 @@ update_buffering (GstQueue * queue)
|
||||||
percent = 100;
|
percent = 100;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (queue, "buffering %d percent", percent);
|
GST_DEBUG_OBJECT (queue, "buffering %d percent", percent);
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (queue),
|
message = gst_message_new_buffering (GST_OBJECT_CAST (queue), percent);
|
||||||
gst_message_new_buffering (GST_OBJECT_CAST (queue), percent));
|
gst_message_set_buffering_stats (message, GST_BUFFERING_STREAM,
|
||||||
|
queue->byte_in_rate, queue->byte_out_rate, -1);
|
||||||
|
|
||||||
|
gst_element_post_message (GST_ELEMENT_CAST (queue), message);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (queue, "filled %d percent", percent);
|
GST_DEBUG_OBJECT (queue, "filled %d percent", percent);
|
||||||
}
|
}
|
||||||
|
@ -994,6 +1000,7 @@ gst_queue_close_temp_location_file (GstQueue * queue)
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
if (queue->temp_file == NULL)
|
if (queue->temp_file == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (queue, "closing temp file");
|
GST_DEBUG_OBJECT (queue, "closing temp file");
|
||||||
|
|
||||||
/* we don't remove the file so that the application can use it as a cache
|
/* we don't remove the file so that the application can use it as a cache
|
||||||
|
@ -1630,6 +1637,58 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
|
||||||
GST_DEBUG_OBJECT (queue, "peer query success");
|
GST_DEBUG_OBJECT (queue, "peer query success");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_QUERY_BUFFERING:
|
||||||
|
{
|
||||||
|
GstFormat format;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (queue, "query buffering");
|
||||||
|
|
||||||
|
if (!QUEUE_IS_USING_TEMP_FILE (queue)) {
|
||||||
|
/* no temp file, just forward to the peer */
|
||||||
|
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
|
||||||
|
goto peer_failed;
|
||||||
|
GST_DEBUG_OBJECT (queue, "buffering forwarded to peer");
|
||||||
|
} else {
|
||||||
|
gint64 start, stop;
|
||||||
|
|
||||||
|
gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case GST_FORMAT_PERCENT:
|
||||||
|
{
|
||||||
|
gint64 duration;
|
||||||
|
GstFormat peer_fmt;
|
||||||
|
|
||||||
|
peer_fmt = GST_FORMAT_BYTES;
|
||||||
|
|
||||||
|
if (!gst_pad_query_peer_duration (queue->sinkpad, &peer_fmt,
|
||||||
|
&duration))
|
||||||
|
goto peer_failed;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (queue, "duration %" G_GINT64_FORMAT ", writing %"
|
||||||
|
G_GINT64_FORMAT, duration, queue->writing_pos);
|
||||||
|
|
||||||
|
start = 0;
|
||||||
|
/* get our available data relative to the duration */
|
||||||
|
if (duration != -1)
|
||||||
|
stop = GST_FORMAT_PERCENT_MAX * queue->writing_pos / duration;
|
||||||
|
else
|
||||||
|
stop = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GST_FORMAT_BYTES:
|
||||||
|
start = 0;
|
||||||
|
stop = queue->writing_pos;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
start = -1;
|
||||||
|
stop = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gst_query_set_buffering_range (query, format, start, stop, -1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
/* peer handled other queries */
|
/* peer handled other queries */
|
||||||
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
|
if (!gst_queue_peer_query (queue, queue->sinkpad, query))
|
||||||
|
@ -1684,8 +1743,10 @@ gst_queue_src_checkgetrange_function (GstPad * pad)
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
queue = GST_QUEUE (gst_pad_get_parent (pad));
|
queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
/* we can operate in pull mode when we are using a tempfile */
|
/* we can operate in pull mode when we are using a tempfile */
|
||||||
ret = QUEUE_IS_USING_TEMP_FILE (queue);
|
ret = QUEUE_IS_USING_TEMP_FILE (queue);
|
||||||
|
|
||||||
gst_object_unref (GST_OBJECT (queue));
|
gst_object_unref (GST_OBJECT (queue));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -81,6 +81,8 @@ struct _GstURIDecodeBin
|
||||||
guint src_np_sig_id; /* new-pad signal id */
|
guint src_np_sig_id; /* new-pad signal id */
|
||||||
guint src_nmp_sig_id; /* no-more-pads signal id */
|
guint src_nmp_sig_id; /* no-more-pads signal id */
|
||||||
gint pending;
|
gint pending;
|
||||||
|
|
||||||
|
gboolean async_pending; /* async-start has been emited */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstURIDecodeBinClass
|
struct _GstURIDecodeBinClass
|
||||||
|
@ -502,6 +504,30 @@ gst_uri_decode_bin_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_async_start (GstURIDecodeBin * dbin)
|
||||||
|
{
|
||||||
|
GstMessage *message;
|
||||||
|
|
||||||
|
dbin->async_pending = TRUE;
|
||||||
|
|
||||||
|
message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
|
||||||
|
parent_class->handle_message (GST_BIN_CAST (dbin), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_async_done (GstURIDecodeBin * dbin)
|
||||||
|
{
|
||||||
|
GstMessage *message;
|
||||||
|
|
||||||
|
if (dbin->async_pending) {
|
||||||
|
message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
|
||||||
|
parent_class->handle_message (GST_BIN_CAST (dbin), message);
|
||||||
|
|
||||||
|
dbin->async_pending = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
|
#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
|
||||||
#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
|
#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
|
||||||
#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100)
|
#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100)
|
||||||
|
@ -1060,7 +1086,7 @@ type_found (GstElement * typefind, guint probability,
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (decoder, "typefind found caps %" GST_PTR_FORMAT, caps);
|
GST_DEBUG_OBJECT (decoder, "typefind found caps %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
dec_elem = g_object_get_data (G_OBJECT (typefind), "decodebin2");
|
dec_elem = make_decoder (decoder);
|
||||||
if (!dec_elem)
|
if (!dec_elem)
|
||||||
goto no_decodebin;
|
goto no_decodebin;
|
||||||
|
|
||||||
|
@ -1081,8 +1107,10 @@ type_found (GstElement * typefind, guint probability,
|
||||||
if (!gst_element_link (queue, dec_elem))
|
if (!gst_element_link (queue, dec_elem))
|
||||||
goto could_not_link;
|
goto could_not_link;
|
||||||
|
|
||||||
gst_element_set_state (queue, GST_STATE_PLAYING);
|
|
||||||
gst_element_set_state (dec_elem, GST_STATE_PLAYING);
|
gst_element_set_state (dec_elem, GST_STATE_PLAYING);
|
||||||
|
gst_element_set_state (queue, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
do_async_done (decoder);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1110,7 +1138,7 @@ no_queue2:
|
||||||
* source. After we find the type, we decide to plug a queue2 and continue to
|
* source. After we find the type, we decide to plug a queue2 and continue to
|
||||||
* plug a decodebin2 starting from the found caps */
|
* plug a decodebin2 starting from the found caps */
|
||||||
static gboolean
|
static gboolean
|
||||||
setup_streaming (GstURIDecodeBin * decoder, GstElement * dec_elem)
|
setup_streaming (GstURIDecodeBin * decoder)
|
||||||
{
|
{
|
||||||
GstElement *typefind;
|
GstElement *typefind;
|
||||||
|
|
||||||
|
@ -1132,7 +1160,7 @@ setup_streaming (GstURIDecodeBin * decoder, GstElement * dec_elem)
|
||||||
g_signal_connect (G_OBJECT (decoder->typefind), "have-type",
|
g_signal_connect (G_OBJECT (decoder->typefind), "have-type",
|
||||||
G_CALLBACK (type_found), decoder);
|
G_CALLBACK (type_found), decoder);
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (typefind), "decodebin2", dec_elem);
|
do_async_start (decoder);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -1284,21 +1312,21 @@ setup_source (GstURIDecodeBin * decoder)
|
||||||
g_object_set_data (G_OBJECT (decoder->source), "pending", "1");
|
g_object_set_data (G_OBJECT (decoder->source), "pending", "1");
|
||||||
decoder->pending++;
|
decoder->pending++;
|
||||||
} else {
|
} else {
|
||||||
GstElement *dec_elem;
|
|
||||||
|
|
||||||
dec_elem = make_decoder (decoder);
|
|
||||||
if (!dec_elem)
|
|
||||||
goto no_decoder;
|
|
||||||
|
|
||||||
if (decoder->is_stream) {
|
if (decoder->is_stream) {
|
||||||
GST_DEBUG_OBJECT (decoder, "Setting up streaming");
|
GST_DEBUG_OBJECT (decoder, "Setting up streaming");
|
||||||
/* do the stream things here */
|
/* do the stream things here */
|
||||||
if (!setup_streaming (decoder, dec_elem))
|
if (!setup_streaming (decoder))
|
||||||
goto streaming_failed;
|
goto streaming_failed;
|
||||||
} else {
|
} else {
|
||||||
|
GstElement *dec_elem;
|
||||||
|
|
||||||
/* no streaming source, we can link now */
|
/* no streaming source, we can link now */
|
||||||
GST_DEBUG_OBJECT (decoder, "Plugging decodebin to source");
|
GST_DEBUG_OBJECT (decoder, "Plugging decodebin to source");
|
||||||
|
|
||||||
|
dec_elem = make_decoder (decoder);
|
||||||
|
if (!dec_elem)
|
||||||
|
goto no_decoder;
|
||||||
|
|
||||||
if (!gst_element_link (decoder->source, dec_elem))
|
if (!gst_element_link (decoder->source, dec_elem))
|
||||||
goto could_not_link;
|
goto could_not_link;
|
||||||
}
|
}
|
||||||
|
@ -1732,6 +1760,7 @@ gst_uri_decode_bin_change_state (GstElement * element,
|
||||||
remove_decoders (decoder);
|
remove_decoders (decoder);
|
||||||
remove_pads (decoder);
|
remove_pads (decoder);
|
||||||
remove_source (decoder);
|
remove_source (decoder);
|
||||||
|
do_async_done (decoder);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue