subtitleoverlay: Consider all caps for overlays, not just the first.

Check all supported caps on the overlay video pad, not just the
first of (possibly) many.
This commit is contained in:
Jan Schmidt 2014-04-06 22:26:20 +10:00
parent b04675a1dc
commit 968e28a818

View file

@ -225,8 +225,9 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated)
{ {
GstPad *peer = gst_pad_get_peer (pad); GstPad *peer = gst_pad_get_peer (pad);
GstCaps *caps; GstCaps *caps;
gboolean ret; gboolean ret = FALSE;
const gchar *name; const gchar *name;
guint i;
if (peer) { if (peer) {
caps = gst_pad_get_current_caps (peer); caps = gst_pad_get_current_caps (peer);
@ -238,21 +239,23 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated)
caps = gst_pad_query_caps (pad, NULL); caps = gst_pad_query_caps (pad, NULL);
} }
name = gst_structure_get_name (gst_caps_get_structure (caps, 0)); for (i = 0; i < gst_caps_get_size (caps) && ret == FALSE; i++) {
if (g_str_equal (name, "video/x-raw")) { name = gst_structure_get_name (gst_caps_get_structure (caps, i));
ret = TRUE; if (g_str_equal (name, "video/x-raw")) {
if (hw_accelerated) ret = TRUE;
*hw_accelerated = FALSE; if (hw_accelerated)
*hw_accelerated = FALSE;
} else if (g_str_has_prefix (name, "video/x-surface")) { } else if (g_str_has_prefix (name, "video/x-surface")) {
ret = TRUE; ret = TRUE;
if (hw_accelerated) if (hw_accelerated)
*hw_accelerated = TRUE; *hw_accelerated = TRUE;
} else { } else {
ret = FALSE; ret = FALSE;
if (hw_accelerated) if (hw_accelerated)
*hw_accelerated = FALSE; *hw_accelerated = FALSE;
}
} }
gst_caps_unref (caps); gst_caps_unref (caps);