gst-plugins-base: playbin2: fix mismatch between video/ and video/ x-dvd-subpicture
Sebastian Dröge
slomo at kemper.freedesktop.org
Thu Oct 6 11:42:09 PDT 2011
Module: gst-plugins-base
Branch: master
Commit: 76b29367e7b13cc1751724cb2678ebd9039678e1
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=76b29367e7b13cc1751724cb2678ebd9039678e1
Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date: Thu Oct 6 11:53:26 2011 +0100
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
---
gst/playback/gstplaybin2.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
index c32a87f..7c53864 100644
--- a/gst/playback/gstplaybin2.c
+++ b/gst/playback/gstplaybin2.c
@@ -2442,12 +2442,14 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
/* helper function to lookup stuff in lists */
static gboolean
-array_has_value (const gchar * values[], const gchar * value)
+array_has_value (const gchar * values[], const gchar * value, gboolean exact)
{
gint 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 FALSE;
@@ -2505,7 +2507,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
GstPad *sinkpad;
GstPadLinkReturn res;
GstSourceSelect *select = NULL;
- gint i;
+ gint i, pass;
gboolean changed = FALSE;
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",
GST_DEBUG_PAD_NAME (pad), caps, group);
- /* major type of the pad, this determines the selector to use */
- for (i = 0; i < PLAYBIN_STREAM_LAST; i++) {
- if (array_has_value (group->selector[i].media_list, name)) {
- select = &group->selector[i];
- 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)) {
+ /* major type of the pad, this determines the selector to use,
+ try exact match first so we don't prematurely match video/
+ for video/x-dvd-subpicture */
+ for (pass = 0; !select && pass < 2; pass++) {
+ for (i = 0; i < PLAYBIN_STREAM_LAST; i++) {
+ if (array_has_value (group->selector[i].media_list, name, pass == 0)) {
select = &group->selector[i];
- gst_caps_unref (media_caps);
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
More information about the gstreamer-commits
mailing list