mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
playbin2: fix mismatch between video/ and video/x-dvd-subpicture
The new code was checking for a prefix, and would find video/ first. Check in two passes, first checking for a perfect match, and falling back to a prefix check if nothing was found. https://bugzilla.gnome.org/show_bug.cgi?id=657261
This commit is contained in:
parent
59f0b29c3f
commit
76b29367e7
1 changed files with 20 additions and 14 deletions
|
@ -2442,12 +2442,14 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
|
||||||
|
|
||||||
/* helper function to lookup stuff in lists */
|
/* helper function to lookup stuff in lists */
|
||||||
static gboolean
|
static gboolean
|
||||||
array_has_value (const gchar * values[], const gchar * value)
|
array_has_value (const gchar * values[], const gchar * value, gboolean exact)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; values[i]; i++) {
|
for (i = 0; values[i]; i++) {
|
||||||
if (values[i] && g_str_has_prefix (value, values[i]))
|
if (exact && !strcmp (value, values[i]))
|
||||||
|
return TRUE;
|
||||||
|
if (!exact && g_str_has_prefix (value, values[i]))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2505,7 +2507,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
GstPadLinkReturn res;
|
GstPadLinkReturn res;
|
||||||
GstSourceSelect *select = NULL;
|
GstSourceSelect *select = NULL;
|
||||||
gint i;
|
gint i, pass;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
playbin = group->playbin;
|
playbin = group->playbin;
|
||||||
|
@ -2518,20 +2520,24 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
|
||||||
"pad %s:%s with caps %" GST_PTR_FORMAT " added in group %p",
|
"pad %s:%s with caps %" GST_PTR_FORMAT " added in group %p",
|
||||||
GST_DEBUG_PAD_NAME (pad), caps, group);
|
GST_DEBUG_PAD_NAME (pad), caps, group);
|
||||||
|
|
||||||
/* major type of the pad, this determines the selector to use */
|
/* major type of the pad, this determines the selector to use,
|
||||||
for (i = 0; i < PLAYBIN_STREAM_LAST; i++) {
|
try exact match first so we don't prematurely match video/
|
||||||
if (array_has_value (group->selector[i].media_list, name)) {
|
for video/x-dvd-subpicture */
|
||||||
select = &group->selector[i];
|
for (pass = 0; !select && pass < 2; pass++) {
|
||||||
break;
|
for (i = 0; i < PLAYBIN_STREAM_LAST; i++) {
|
||||||
} else if (group->selector[i].get_media_caps) {
|
if (array_has_value (group->selector[i].media_list, name, pass == 0)) {
|
||||||
GstCaps *media_caps = group->selector[i].get_media_caps ();
|
|
||||||
|
|
||||||
if (media_caps && gst_caps_can_intersect (media_caps, caps)) {
|
|
||||||
select = &group->selector[i];
|
select = &group->selector[i];
|
||||||
gst_caps_unref (media_caps);
|
|
||||||
break;
|
break;
|
||||||
|
} else if (group->selector[i].get_media_caps) {
|
||||||
|
GstCaps *media_caps = group->selector[i].get_media_caps ();
|
||||||
|
|
||||||
|
if (media_caps && gst_caps_can_intersect (media_caps, caps)) {
|
||||||
|
select = &group->selector[i];
|
||||||
|
gst_caps_unref (media_caps);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gst_caps_unref (media_caps);
|
||||||
}
|
}
|
||||||
gst_caps_unref (media_caps);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* no selector found for the media type, don't bother linking it to a
|
/* no selector found for the media type, don't bother linking it to a
|
||||||
|
|
Loading…
Reference in a new issue