
static gint filter_test_linked( gconstpointer pad_value, gconstpointer unused )
{
    return !gst_pad_is_linked( GST_PAD( g_value_get_object( pad_value ) ) );
}

static gint filter_test_caps( gconstpointer pad_value, gconstpointer unused )
{
    GstCaps *caps = gst_pad_query_caps( GST_PAD( g_value_get_object( pad_value ) ), NULL );
    const GstStructure *caps_struct = gst_caps_get_structure( caps, 0 );
    const gchar *pad_type = gst_structure_get_name( caps_struct );
    bool matches = g_str_has_prefix( pad_type, "audio/" );
    gst_caps_unref( caps );
    return matches ? 0 : 1;
}

void make_iterator( GstElement *element )
{
  GstIterator *it;
  it = gst_element_iterate_src_pads( element );
  it = gst_iterator_filter( it, filter_test_caps, NULL );
  it = gst_iterator_filter( it, filter_test_linked, NULL );
  return it;
}
