mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
playbin/uridecodebin: Emit source-setup signal early before doing the scheduling query
Some elements will require the source to be set up properly before the scheduling query returns useful results, e.g. appsrc and giostreamsrc. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1241>
This commit is contained in:
parent
297b1e68e2
commit
52bca104e4
2 changed files with 34 additions and 20 deletions
|
@ -332,6 +332,7 @@ struct _GstSourceGroup
|
|||
gulong pad_removed_id;
|
||||
gulong no_more_pads_id;
|
||||
gulong notify_source_id;
|
||||
gulong source_setup_id;
|
||||
gulong drained_id;
|
||||
gulong autoplug_factories_id;
|
||||
gulong autoplug_select_id;
|
||||
|
@ -5254,9 +5255,17 @@ notify_source_cb (GstElement * uridecodebin, GParamSpec * pspec,
|
|||
GST_OBJECT_UNLOCK (playbin);
|
||||
|
||||
g_object_notify (G_OBJECT (playbin), "source");
|
||||
}
|
||||
|
||||
g_signal_emit (playbin, gst_play_bin_signals[SIGNAL_SOURCE_SETUP],
|
||||
0, playbin->source);
|
||||
static void
|
||||
source_setup_cb (GstElement * uridecodebin, GstElement * source,
|
||||
GstSourceGroup * group)
|
||||
{
|
||||
GstPlayBin *playbin;
|
||||
|
||||
playbin = group->playbin;
|
||||
|
||||
g_signal_emit (playbin, gst_play_bin_signals[SIGNAL_SOURCE_SETUP], 0, source);
|
||||
}
|
||||
|
||||
/* must be called with the group lock */
|
||||
|
@ -5394,6 +5403,8 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
|
|||
G_CALLBACK (no_more_pads_cb), group);
|
||||
group->notify_source_id = g_signal_connect (uridecodebin, "notify::source",
|
||||
G_CALLBACK (notify_source_cb), group);
|
||||
group->source_setup_id = g_signal_connect (uridecodebin, "source-setup",
|
||||
G_CALLBACK (source_setup_cb), group);
|
||||
|
||||
/* we have 1 pending no-more-pads */
|
||||
group->pending = 1;
|
||||
|
@ -5573,6 +5584,7 @@ error_cleanup:
|
|||
REMOVE_SIGNAL (group->uridecodebin, group->pad_removed_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->no_more_pads_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->notify_source_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->source_setup_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->drained_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->autoplug_factories_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->autoplug_select_id);
|
||||
|
@ -5661,6 +5673,7 @@ deactivate_group (GstPlayBin * playbin, GstSourceGroup * group)
|
|||
REMOVE_SIGNAL (group->uridecodebin, group->pad_removed_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->no_more_pads_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->notify_source_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->source_setup_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->drained_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->autoplug_factories_id);
|
||||
REMOVE_SIGNAL (group->uridecodebin, group->autoplug_select_id);
|
||||
|
|
|
@ -1350,21 +1350,6 @@ gen_source_element (GstURIDecodeBin * decoder)
|
|||
|
||||
GST_LOG_OBJECT (decoder, "found source type %s", G_OBJECT_TYPE_NAME (source));
|
||||
|
||||
decoder->is_stream = IS_STREAM_URI (decoder->uri);
|
||||
|
||||
query = gst_query_new_scheduling ();
|
||||
if (gst_element_query (source, query)) {
|
||||
gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL);
|
||||
if ((flags & GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED))
|
||||
decoder->is_stream = TRUE;
|
||||
}
|
||||
gst_query_unref (query);
|
||||
|
||||
GST_LOG_OBJECT (decoder, "source is stream: %d", decoder->is_stream);
|
||||
|
||||
decoder->need_queue = IS_QUEUE_URI (decoder->uri);
|
||||
GST_LOG_OBJECT (decoder, "source needs queue: %d", decoder->need_queue);
|
||||
|
||||
source_class = G_OBJECT_GET_CLASS (source);
|
||||
|
||||
pspec = g_object_class_find_property (source_class, "connection-speed");
|
||||
|
@ -1411,6 +1396,25 @@ gen_source_element (GstURIDecodeBin * decoder)
|
|||
"setting subtitle-encoding=%s to source element", decoder->encoding);
|
||||
g_object_set (source, "subtitle-encoding", decoder->encoding, NULL);
|
||||
}
|
||||
|
||||
g_signal_emit (decoder, gst_uri_decode_bin_signals[SIGNAL_SOURCE_SETUP],
|
||||
0, source);
|
||||
|
||||
decoder->is_stream = IS_STREAM_URI (decoder->uri);
|
||||
|
||||
query = gst_query_new_scheduling ();
|
||||
if (gst_element_query (source, query)) {
|
||||
gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL);
|
||||
if ((flags & GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED))
|
||||
decoder->is_stream = TRUE;
|
||||
}
|
||||
gst_query_unref (query);
|
||||
|
||||
GST_LOG_OBJECT (decoder, "source is stream: %d", decoder->is_stream);
|
||||
|
||||
decoder->need_queue = IS_QUEUE_URI (decoder->uri);
|
||||
GST_LOG_OBJECT (decoder, "source needs queue: %d", decoder->need_queue);
|
||||
|
||||
return source;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -2262,9 +2266,6 @@ setup_source (GstURIDecodeBin * decoder)
|
|||
/* notify of the new source used */
|
||||
g_object_notify (G_OBJECT (decoder), "source");
|
||||
|
||||
g_signal_emit (decoder, gst_uri_decode_bin_signals[SIGNAL_SOURCE_SETUP],
|
||||
0, decoder->source);
|
||||
|
||||
if (is_live_source (decoder->source))
|
||||
decoder->is_stream = FALSE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue