summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-08-28 09:36:15 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-08-28 09:39:48 -0300
commit04e05bff2300c7ca3455d3c2e520dc5063bc83b8 (patch)
tree3fa4c38904fc92963cb8c462f246bbdd91017cf0
parentc95d809a962ca01b8973b716b7f44817074fe73e (diff)
playsinkconvertbin: implement accept-caps handler
The default one will just go through the internal elements which might just be identity when it is in passthrough which will lead to the query being handled by the downstream sink, ignoring all that playsinkconvertbin could actually handle and convert.
-rw-r--r--gst/playback/gstplaysinkconvertbin.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c
index af2333fce..093081024 100644
--- a/gst/playback/gstplaysinkconvertbin.c
+++ b/gst/playback/gstplaysinkconvertbin.c
@@ -350,6 +350,42 @@ gst_play_sink_convert_bin_sink_setcaps (GstPlaySinkConvertBin * self,
} \
} G_STMT_END
+static gboolean
+gst_play_sink_convert_bin_acceptcaps (GstPad * pad, GstCaps * caps)
+{
+ GstPlaySinkConvertBin *self =
+ GST_PLAY_SINK_CONVERT_BIN (gst_pad_get_parent (pad));
+ gboolean ret;
+ GstPad *otherpad;
+
+ GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
+ if (pad == self->srcpad) {
+ otherpad = self->sinkpad;
+ } else if (pad == self->sinkpad) {
+ otherpad = self->srcpad;
+ } else {
+ GST_ERROR_OBJECT (pad, "Not one of our pads");
+ otherpad = NULL;
+ }
+
+ if (otherpad) {
+ ret = gst_pad_peer_query_accept_caps (otherpad, caps);
+ if (!ret && self->converter_caps) {
+ /* maybe we can convert */
+ ret = gst_caps_can_intersect (caps, self->converter_caps);
+ }
+ } else {
+ ret = TRUE;
+ }
+ GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
+
+ gst_object_unref (self);
+
+ GST_DEBUG_OBJECT (pad, "Accept caps: '%" GST_PTR_FORMAT "' %d", caps, ret);
+
+ return ret;
+}
+
static GstCaps *
gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter)
{
@@ -474,6 +510,17 @@ gst_play_sink_convert_bin_query (GstPad * pad, GstObject * parent,
res = TRUE;
break;
}
+ case GST_QUERY_ACCEPT_CAPS:
+ {
+ gboolean ret;
+ GstCaps *caps;
+
+ gst_query_parse_accept_caps (query, &caps);
+ ret = gst_play_sink_convert_bin_acceptcaps (pad, caps);
+ gst_query_set_accept_caps_result (query, ret);
+ res = TRUE;
+ break;
+ }
default:
res = gst_pad_query_default (pad, parent, query);
break;