mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
decodebin3: Avoid overriding explicit user selection
In case the user set a list of streams to select or answer explicitly to all 'select-stream' event, we should respect his choice and not try to add a stream per type. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/666>
This commit is contained in:
parent
78444fc622
commit
b41b87522f
1 changed files with 16 additions and 10 deletions
|
@ -1106,6 +1106,7 @@ update_requested_selection (GstDecodebin3 * dbin)
|
||||||
{
|
{
|
||||||
guint i, nb;
|
guint i, nb;
|
||||||
GList *tmp = NULL;
|
GList *tmp = NULL;
|
||||||
|
gboolean all_user_selected = TRUE;
|
||||||
GstStreamType used_types = 0;
|
GstStreamType used_types = 0;
|
||||||
GstStreamCollection *collection;
|
GstStreamCollection *collection;
|
||||||
|
|
||||||
|
@ -1140,6 +1141,9 @@ update_requested_selection (GstDecodebin3 * dbin)
|
||||||
gst_decodebin3_signals[SIGNAL_SELECT_STREAM], 0, collection, stream,
|
gst_decodebin3_signals[SIGNAL_SELECT_STREAM], 0, collection, stream,
|
||||||
&request);
|
&request);
|
||||||
GST_DEBUG_OBJECT (dbin, "stream %s , request:%d", sid, request);
|
GST_DEBUG_OBJECT (dbin, "stream %s , request:%d", sid, request);
|
||||||
|
|
||||||
|
if (request == -1)
|
||||||
|
all_user_selected = FALSE;
|
||||||
if (request == 1 || (request == -1
|
if (request == 1 || (request == -1
|
||||||
&& (stream_in_list (dbin->requested_selection, sid)
|
&& (stream_in_list (dbin->requested_selection, sid)
|
||||||
|| stream_in_list (dbin->active_selection, sid)))) {
|
|| stream_in_list (dbin->active_selection, sid)))) {
|
||||||
|
@ -1156,16 +1160,18 @@ update_requested_selection (GstDecodebin3 * dbin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 4. If not, match one stream of each type */
|
/* 4. If the user didn't explicitly selected all streams, match one stream of each type */
|
||||||
for (i = 0; i < nb; i++) {
|
if (!all_user_selected && !dbin->requested_selection) {
|
||||||
GstStream *stream = gst_stream_collection_get_stream (collection, i);
|
for (i = 0; i < nb; i++) {
|
||||||
GstStreamType curtype = gst_stream_get_stream_type (stream);
|
GstStream *stream = gst_stream_collection_get_stream (collection, i);
|
||||||
if (!(used_types & curtype)) {
|
GstStreamType curtype = gst_stream_get_stream_type (stream);
|
||||||
const gchar *sid = gst_stream_get_stream_id (stream);
|
if (!(used_types & curtype)) {
|
||||||
GST_DEBUG_OBJECT (dbin, "Selecting stream '%s' of type %s",
|
const gchar *sid = gst_stream_get_stream_id (stream);
|
||||||
sid, gst_stream_type_get_name (curtype));
|
GST_ERROR_OBJECT (dbin, "Selecting stream '%s' of type %s",
|
||||||
tmp = g_list_append (tmp, (gchar *) sid);
|
sid, gst_stream_type_get_name (curtype));
|
||||||
used_types |= curtype;
|
tmp = g_list_append (tmp, (gchar *) sid);
|
||||||
|
used_types |= curtype;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue