mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
harness: misc bugfixes
1. Get a list of pad templates from the element class, not the factory. This allows us to interact with test-elements that does not have a factory. 2. Use the pad_template_caps in caps-queries when caps is not set explicitly on the pad. Not doing so is simply wrong, and prohibits interactions with special templates used for testing. https://bugzilla.gnome.org/show_bug.cgi?id=754193
This commit is contained in:
parent
8a1f05865f
commit
b2ce23074e
1 changed files with 15 additions and 11 deletions
|
@ -344,9 +344,11 @@ gst_harness_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
{
|
||||
GstCaps *caps, *filter = NULL;
|
||||
|
||||
caps =
|
||||
priv->
|
||||
sink_caps ? gst_caps_ref (priv->sink_caps) : gst_caps_new_any ();
|
||||
if (priv->sink_caps) {
|
||||
caps = gst_caps_ref (priv->sink_caps);
|
||||
} else {
|
||||
caps = gst_pad_get_pad_template_caps (pad);
|
||||
}
|
||||
|
||||
gst_query_parse_caps (query, &filter);
|
||||
if (filter != NULL) {
|
||||
|
@ -406,8 +408,11 @@ gst_harness_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
{
|
||||
GstCaps *caps, *filter = NULL;
|
||||
|
||||
caps =
|
||||
priv->src_caps ? gst_caps_ref (priv->src_caps) : gst_caps_new_any ();
|
||||
if (priv->src_caps) {
|
||||
caps = gst_caps_ref (priv->src_caps);
|
||||
} else {
|
||||
caps = gst_pad_get_pad_template_caps (pad);
|
||||
}
|
||||
|
||||
gst_query_parse_caps (query, &filter);
|
||||
if (filter != NULL) {
|
||||
|
@ -542,21 +547,20 @@ static void
|
|||
check_element_type (GstElement * element, gboolean * has_sinkpad,
|
||||
gboolean * has_srcpad)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstElementClass *element_class = GST_ELEMENT_GET_CLASS (element);
|
||||
const GList *tmpl_list;
|
||||
|
||||
*has_srcpad = element->numsrcpads > 0;
|
||||
*has_sinkpad = element->numsinkpads > 0;
|
||||
|
||||
factory = gst_element_get_factory (element);
|
||||
tmpl_list = gst_element_factory_get_static_pad_templates (factory);
|
||||
tmpl_list = gst_element_class_get_pad_template_list (element_class);
|
||||
|
||||
while (tmpl_list) {
|
||||
GstStaticPadTemplate *pad_tmpl = (GstStaticPadTemplate *) tmpl_list->data;
|
||||
GstPadTemplate *pad_tmpl = (GstPadTemplate *) tmpl_list->data;
|
||||
tmpl_list = g_list_next (tmpl_list);
|
||||
if (pad_tmpl->direction == GST_PAD_SRC)
|
||||
if (GST_PAD_TEMPLATE_DIRECTION (pad_tmpl) == GST_PAD_SRC)
|
||||
*has_srcpad |= TRUE;
|
||||
if (pad_tmpl->direction == GST_PAD_SINK)
|
||||
if (GST_PAD_TEMPLATE_DIRECTION (pad_tmpl) == GST_PAD_SINK)
|
||||
*has_sinkpad |= TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue