summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2016-01-11 18:24:48 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2016-01-11 18:35:29 -0300
commit20f6af651b61010cf1eef89bdf8f5347fcd4e9df (patch)
tree44cdf82ba3c37873c8919ace72db2577585d7c95
parent2f7cd8608ac9b680aae4f5312c9cd003aafe805e (diff)
subtitleoverlay: replace accept-caps with caps query
Those accept caps are actually checking if downstream supports some particular caps to check if it need to negotiate a different format. Checking only the next element with accept-caps is not enough to guarantee that it is supported. Using a caps query makes it obtain the supported caps for downstream as a whole instead of only the next element.
-rw-r--r--gst/playback/gstsubtitleoverlay.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c
index 719eebb50..4b4b0aa09 100644
--- a/gst/playback/gstsubtitleoverlay.c
+++ b/gst/playback/gstsubtitleoverlay.c
@@ -157,6 +157,20 @@ unblock_subtitle (GstSubtitleOverlay * self)
}
}
+static gboolean
+pad_supports_caps (GstPad * pad, GstCaps * caps)
+{
+ GstCaps *pad_caps;
+ gboolean ret = FALSE;
+
+ pad_caps = gst_pad_query_caps (pad, NULL);
+ if (gst_caps_can_intersect (caps, pad_caps))
+ ret = TRUE;
+ gst_caps_unref (pad_caps);
+
+ return ret;
+}
+
static void
gst_subtitle_overlay_finalize (GObject * object)
{
@@ -1063,7 +1077,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
GstPad *target =
gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad));
- if (target && gst_pad_query_accept_caps (target, subcaps)) {
+ if (target && pad_supports_caps (target, subcaps)) {
GST_DEBUG_OBJECT (pad, "Target accepts caps");
gst_object_unref (target);
@@ -1673,7 +1687,7 @@ gst_subtitle_overlay_video_sink_setcaps (GstSubtitleOverlay * self,
GST_SUBTITLE_OVERLAY_LOCK (self);
- if (!target || !gst_pad_query_accept_caps (target, caps)) {
+ if (!target || !pad_supports_caps (target, caps)) {
GST_DEBUG_OBJECT (target, "Target did not accept caps -- reconfiguring");
block_subtitle (self);
@@ -1809,7 +1823,7 @@ gst_subtitle_overlay_subtitle_sink_setcaps (GstSubtitleOverlay * self,
GST_SUBTITLE_OVERLAY_LOCK (self);
gst_caps_replace (&self->subcaps, caps);
- if (target && gst_pad_query_accept_caps (target, caps)) {
+ if (target && pad_supports_caps (target, caps)) {
GST_DEBUG_OBJECT (self, "Target accepts caps");
GST_SUBTITLE_OVERLAY_UNLOCK (self);
goto out;