inputsFromType method
Get a list of inputs from input type.
Returns an array of maps with keys id
and name
.
Implementation
List<Map<String, String>> inputsFromType(String inputTypeId) {
final List<Map<String, String>> list = [];
final sourceProps = _lib.obs_get_source_properties(inputTypeId.int8());
if (sourceProps != ffi.nullptr) {
ffi.Pointer<ffi.Pointer<obs_property>> propertyOut = calloc();
var property = _lib.obs_properties_first(sourceProps);
while (property != ffi.nullptr) {
final type = _lib.obs_property_get_type(property);
if (type == obs_property_type.OBS_PROPERTY_LIST) {
final count = _lib.obs_property_list_item_count(property);
for (int index = 0; index < count; index++) {
final disabled = _lib.obs_property_list_item_disabled(property, index);
final name = _lib.obs_property_list_item_name(property, index).string;
final uid = _lib.obs_property_list_item_string(property, index).string;
if (disabled == 0 && name != null && uid != null && name.isNotEmpty && uid.isNotEmpty) {
list.add({"id": uid, "name": name, "type_id": inputTypeId});
}
}
}
propertyOut.value = property;
final rv = _lib.obs_property_next(propertyOut);
property = rv == 1 ? propertyOut.value : ffi.nullptr;
}
_lib.obs_properties_destroy(sourceProps);
calloc.free(propertyOut);
}
StringExtensions.freeInt8s();
return list;
}