diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2016-01-14 17:35:28 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2016-01-14 17:35:28 -0300 |
commit | 3303fc4fb5c80b36fb787da60e280b775a3250d9 (patch) | |
tree | c8d91eb1d59ad82e9d217e54c518931323cf8789 | |
parent | 00208896490d1a4a30b08123289b1a2ad55ca1f7 (diff) |
basetransform: add recursive-accept-caps handlerrecursive-accept-caps
The handler will do an accept-caps to check if the caps is accepted
by the element and, if successful, create new query with the output
caps and send it to its peer.
-rw-r--r-- | libs/gst/base/gstbasetransform.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 4155a51a6..a9122270e 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1590,6 +1590,56 @@ gst_base_transform_default_query (GstBaseTransform * trans, } break; } + case GST_QUERY_RECURSIVE_ACCEPT_CAPS: + { + GstCaps *caps; + GstQuery *accept_caps_query; + gboolean accept_caps_result; + + gst_query_parse_recursive_accept_caps (query, &caps); + + /* check if we accept it */ + accept_caps_query = gst_query_new_accept_caps (gst_caps_ref (caps)); + if (!gst_pad_query (pad, query)) { + GST_DEBUG_OBJECT (pad, "Accept-caps query got no answer, can't " + "proceed with recursive-accept-caps"); + break; + } + + gst_query_parse_accept_caps_result (accept_caps_query, + &accept_caps_result); + gst_query_unref (accept_caps_query); + if (accept_caps_result) { + GstCaps *othercaps; + GstQuery *peer_query; + gboolean peer_query_result; + + /* convert our caps to the output caps and proceed with the query */ + othercaps = gst_base_transform_find_transform (trans, pad, caps); + if (!othercaps || gst_caps_is_empty (othercaps)) { + GST_DEBUG_OBJECT (pad, "Could not generate othercaps from caps %" + GST_PTR_FORMAT, caps); + gst_query_set_recursive_accept_caps_result (query, FALSE); + gst_caps_unref (othercaps); + ret = TRUE; + } else { + peer_query = gst_query_new_recursive_accept_caps (othercaps); + if (gst_pad_peer_query (otherpad, peer_query)) { + ret = TRUE; + gst_query_parse_recursive_accept_caps_result (peer_query, + &peer_query_result); + gst_query_set_recursive_accept_caps_result (query, + peer_query_result); + } + gst_query_unref (peer_query); + } + + } else { + ret = TRUE; + gst_query_set_recursive_accept_caps_result (query, FALSE); + } + break; + } case GST_QUERY_CAPS: { GstCaps *filter, *caps; |