spa: add method to check if an object is fixated

See #1732
This commit is contained in:
Wim Taymans 2021-10-20 11:56:03 +02:00
parent 2cddd4a775
commit eea6e7a1fb

View file

@ -446,6 +446,24 @@ static inline int spa_pod_fixate(struct spa_pod *pod)
return spa_pod_object_fixate((struct spa_pod_object *)pod);
}
static inline int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
{
struct spa_pod_prop *res;
SPA_POD_OBJECT_FOREACH(pod, res) {
if (res->value.type == SPA_TYPE_Choice &&
((struct spa_pod_choice*)&res->value)->body.type != SPA_CHOICE_None)
return 0;
}
return 1;
}
static inline int spa_pod_is_fixated(const struct spa_pod *pod)
{
if (!spa_pod_is_object(pod))
return -EINVAL;
return spa_pod_object_is_fixated((const struct spa_pod_object *)pod);
}
/**
* \}
*/