From 968e28a8188fa9341ef1799e937ff35ac5db45ed Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 6 Apr 2014 22:26:20 +1000 Subject: [PATCH] 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. --- gst/playback/gstsubtitleoverlay.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index 476f113..7741688 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -225,8 +225,9 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated) { GstPad *peer = gst_pad_get_peer (pad); GstCaps *caps; - gboolean ret; + gboolean ret = FALSE; const gchar *name; + guint i; if (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); } - name = gst_structure_get_name (gst_caps_get_structure (caps, 0)); - if (g_str_equal (name, "video/x-raw")) { - ret = TRUE; - if (hw_accelerated) - *hw_accelerated = FALSE; + for (i = 0; i < gst_caps_get_size (caps) && ret == FALSE; i++) { + name = gst_structure_get_name (gst_caps_get_structure (caps, i)); + if (g_str_equal (name, "video/x-raw")) { + ret = TRUE; + if (hw_accelerated) + *hw_accelerated = FALSE; - } else if (g_str_has_prefix (name, "video/x-surface")) { - ret = TRUE; - if (hw_accelerated) - *hw_accelerated = TRUE; - } else { + } else if (g_str_has_prefix (name, "video/x-surface")) { + ret = TRUE; + if (hw_accelerated) + *hw_accelerated = TRUE; + } else { - ret = FALSE; - if (hw_accelerated) - *hw_accelerated = FALSE; + ret = FALSE; + if (hw_accelerated) + *hw_accelerated = FALSE; + } } gst_caps_unref (caps); -- 2.7.4