static gboolean element_filter (GstPluginFeature * feature, FilterData * data) { gboolean res; /* we only care about element factories */ if (G_UNLIKELY (!GST_IS_ELEMENT_FACTORY (feature))) return FALSE; res = (gst_plugin_feature_get_rank (feature) >= data->minrank) && gst_element_factory_list_is_type (GST_ELEMENT_FACTORY_CAST (feature), data->type); return res; }
static GstAutoplugSelectResult on_autoplug_select (GstElement * uridecodebin, GstPad * pad, GstCaps * caps, GstElementFactory * factory, GstElement * pipeline) { /* if decodebin is about to plug a decoder, * stop it right there and expose the pad; * the slave's decodebin will take it from there... */ if (gst_element_factory_list_is_type (factory, GST_ELEMENT_FACTORY_TYPE_DECODER)) { gchar *capsstr = gst_caps_to_string (caps); g_print (" exposing to slave: %s\n", capsstr); g_free (capsstr); return GST_AUTOPLUG_SELECT_EXPOSE; } return GST_AUTOPLUG_SELECT_TRY; }
gboolean sink_factory_filter(GstPluginFeature* feature, gpointer data) { GstCaps* caps = (GstCaps*)data; if (!GST_IS_ELEMENT_FACTORY(feature)) return FALSE; const GList* static_pads = gst_element_factory_get_static_pad_templates(GST_ELEMENT_FACTORY(feature)); int not_any_number = 0; for (GList* item = (GList*)static_pads; item; item = item->next) { GstStaticPadTemplate* padTemplate = (GstStaticPadTemplate*)item->data; GstPadTemplate* pad = gst_static_pad_template_get(padTemplate); GstCaps* padCaps = gst_pad_template_get_caps(pad); if (!gst_caps_is_any(padCaps)) not_any_number++; } if (not_any_number == 0) return FALSE; if (!gst_element_factory_list_is_type(GST_ELEMENT_FACTORY(feature), GST_ELEMENT_FACTORY_TYPE_DECODABLE)) return FALSE; if (!gst_element_factory_can_sink_all_caps(GST_ELEMENT_FACTORY(feature), caps)) return FALSE; return TRUE; }