Type changes

Only allow properties inside objects, this makes it easier to
iterate the object, which is needed for efficiently processing
control streams.
Add a choice type to mark variable properties.
SPA_TYPE_Enum -> SPA_TYPE_Id to avoid confusion with choice enum
Make it easier to allocate and initialize properties on the stack
Make more efficient methods to make objects.
This commit is contained in:
Wim Taymans 2018-09-05 16:41:07 +02:00
parent 03fdabd155
commit cc842cbdc8
63 changed files with 2253 additions and 1880 deletions

View file

@ -31,6 +31,7 @@
#include <spa/node/node.h>
#include <spa/monitor/monitor.h>
#include <spa/pod/parser.h>
#include <spa/debug/pod.h>
#include <pipewire/log.h>
#include <pipewire/type.h>
@ -80,8 +81,11 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
":", SPA_MONITOR_ITEM_name, "s", &name,
":", SPA_MONITOR_ITEM_class, "s", &klass,
":", SPA_MONITOR_ITEM_factory, "p", &factory,
":", SPA_MONITOR_ITEM_info, "T", &info, NULL) < 0)
":", SPA_MONITOR_ITEM_info, "T", &info, NULL) < 0) {
pw_log_warn("monitor %p: could not parse item", this);
spa_debug_pod(0, NULL, item);
return NULL;
}
pw_log_debug("monitor %p: add: \"%s\" (%s)", this, name, id);

View file

@ -181,29 +181,29 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
pw_log_info("configure prop %s", key);
switch(prop->body.value.type) {
switch(prop->value.type) {
case SPA_TYPE_Bool:
SPA_POD_VALUE(struct spa_pod_bool, &prop->body.value) =
SPA_POD_VALUE(struct spa_pod_bool, &prop->value) =
pw_properties_parse_bool(value);
break;
case SPA_TYPE_Enum:
SPA_POD_VALUE(struct spa_pod_enum, &prop->body.value) =
case SPA_TYPE_Id:
SPA_POD_VALUE(struct spa_pod_id, &prop->value) =
spa_debug_type_find_type(NULL, value);
break;
case SPA_TYPE_Int:
SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) =
SPA_POD_VALUE(struct spa_pod_int, &prop->value) =
pw_properties_parse_int(value);
break;
case SPA_TYPE_Long:
SPA_POD_VALUE(struct spa_pod_long, &prop->body.value) =
SPA_POD_VALUE(struct spa_pod_long, &prop->value) =
pw_properties_parse_int64(value);
break;
case SPA_TYPE_Float:
SPA_POD_VALUE(struct spa_pod_float, &prop->body.value) =
SPA_POD_VALUE(struct spa_pod_float, &prop->value) =
pw_properties_parse_float(value);
break;
case SPA_TYPE_Double:
SPA_POD_VALUE(struct spa_pod_double, &prop->body.value) =
SPA_POD_VALUE(struct spa_pod_double, &prop->value) =
pw_properties_parse_double(value);
break;
case SPA_TYPE_String: