diff --git a/spa/include/spa/debug/format.h b/spa/include/spa/debug/format.h index 53af841b0..9a8371c59 100644 --- a/spa/include/spa/debug/format.h +++ b/spa/include/spa/debug/format.h @@ -122,6 +122,9 @@ static inline int spa_debug_format(int indent, [SPA_TYPE_Pod] = "pod" }; + if (info == NULL) + info = spa_type_format; + if (format == NULL || SPA_POD_TYPE(format) != SPA_TYPE_Object) return -EINVAL; @@ -135,8 +138,6 @@ static inline int spa_debug_format(int indent, media_type ? rindex(media_type, ':') + 1 : "unknown", media_subtype ? rindex(media_subtype, ':') + 1 : "unknown"); - info = spa_type_format; - SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) { struct spa_pod_prop *prop; const char *key; diff --git a/spa/include/spa/debug/pod.h b/spa/include/spa/debug/pod.h index 2c5b14b93..e14b5ad66 100644 --- a/spa/include/spa/debug/pod.h +++ b/spa/include/spa/debug/pod.h @@ -67,7 +67,7 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info, { struct spa_pod_pointer_body *b = body; spa_debug("%*s" "Pointer %s %p", indent, "", - spa_debug_type_find_name(spa_types, b->type), b->value); + spa_debug_type_find_name(SPA_TYPE_ROOT, b->type), b->value); break; } case SPA_TYPE_Rectangle: @@ -140,9 +140,9 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info, ti ? ti->name : "unknown"); SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) { - ii = spa_debug_type_find(info, c->type); + ii = spa_debug_type_find(spa_type_control, c->type); - spa_debug("%*s" "Event: offset %d, type %s", indent+2, "", + spa_debug("%*s" "Control: offset %d, type %s", indent+2, "", c->offset, ii ? ii->name : "unknown"); spa_debug_pod_value(indent + 2, info, @@ -234,7 +234,7 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info, static inline int spa_debug_pod(int indent, const struct spa_type_info *info, const struct spa_pod *pod) { - return spa_debug_pod_value(indent, info, + return spa_debug_pod_value(indent, info ? info : SPA_TYPE_ROOT, SPA_POD_TYPE(pod), SPA_POD_BODY(pod), SPA_POD_BODY_SIZE(pod)); diff --git a/spa/include/spa/debug/types.h b/spa/include/spa/debug/types.h index 5e983864e..502b760b1 100644 --- a/spa/include/spa/debug/types.h +++ b/spa/include/spa/debug/types.h @@ -26,21 +26,19 @@ extern "C" { #include -static const struct spa_type_info spa_debug_types[] = -{ - { SPA_ID_INVALID, "", SPA_TYPE_Enum, spa_types }, - { 0, NULL, }, -}; - static inline const struct spa_type_info *spa_debug_type_find(const struct spa_type_info *info, uint32_t type) { const struct spa_type_info *res; + if (info == NULL) + info = SPA_TYPE_ROOT; + while (info && info->name) { - if (info->type == SPA_ID_INVALID) - if ((res = spa_debug_type_find(info->values, type))) + if (info->type == SPA_ID_INVALID) { + if (info->values && (res = spa_debug_type_find(info->values, type))) return res; - if (info->type == type) + } + else if (info->type == type) return info; info++; } @@ -56,11 +54,14 @@ static inline const char *spa_debug_type_find_name(const struct spa_type_info *i static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info, const char *name) { + if (info == NULL) + info = SPA_TYPE_ROOT; + while (info && info->name) { uint32_t res; if (strcmp(info->name, name) == 0) return info->type; - if ((res = spa_debug_type_find_type(info->values, name)) != SPA_ID_INVALID) + if (info->values && (res = spa_debug_type_find_type(info->values, name)) != SPA_ID_INVALID) return res; info++; } diff --git a/spa/include/spa/node/type-info.h b/spa/include/spa/node/type-info.h index e61865c86..a5a253055 100644 --- a/spa/include/spa/node/type-info.h +++ b/spa/include/spa/node/type-info.h @@ -30,6 +30,20 @@ extern "C" { #include #include +#define SPA_TYPE__IO SPA_TYPE_ENUM_BASE "IO" +#define SPA_TYPE_IO_BASE SPA_TYPE__IO ":" + +static const struct spa_type_info spa_type_io[] = { + { SPA_IO_Invalid, SPA_TYPE_IO_BASE "Invalid", SPA_TYPE_Int, }, + { SPA_IO_Buffers, SPA_TYPE_IO_BASE "Buffers", SPA_TYPE_Int, }, + { SPA_IO_Range, SPA_TYPE_IO_BASE "Range", SPA_TYPE_Int, }, + { SPA_IO_Clock, SPA_TYPE_IO_BASE "Clock", SPA_TYPE_Int, }, + { SPA_IO_Latency, SPA_TYPE_IO_BASE "Latency", SPA_TYPE_Int, }, + { SPA_IO_Control, SPA_TYPE_IO_BASE "Control", SPA_TYPE_Int, }, + { SPA_IO_Notify, SPA_TYPE_IO_BASE "Notify", SPA_TYPE_Int, }, + { 0, NULL, }, +}; + #define SPA_TYPE__NodeEvent SPA_TYPE_EVENT_BASE "Node" #define SPA_TYPE_NODE_EVENT_BASE SPA_TYPE__NodeEvent ":" diff --git a/spa/include/spa/param/type-info.h b/spa/include/spa/param/type-info.h index 528a246ef..9e5f33091 100644 --- a/spa/include/spa/param/type-info.h +++ b/spa/include/spa/param/type-info.h @@ -28,6 +28,7 @@ extern "C" { #include #include #include +#include /* base for parameter object enumerations */ #define SPA_TYPE__ParamId SPA_TYPE_ENUM_BASE "ParamId" @@ -126,7 +127,7 @@ static const struct spa_type_info spa_type_param_meta[] = { static const struct spa_type_info spa_type_param_io[] = { { SPA_PARAM_IO_START, SPA_TYPE_PARAM_IO_BASE, SPA_TYPE_Enum, spa_type_param, }, - { SPA_PARAM_IO_id, SPA_TYPE_PARAM_IO_BASE "id", SPA_TYPE_Enum, }, + { SPA_PARAM_IO_id, SPA_TYPE_PARAM_IO_BASE "id", SPA_TYPE_Enum, spa_type_io }, { SPA_PARAM_IO_size, SPA_TYPE_PARAM_IO_BASE "size", SPA_TYPE_Int, }, { 0, NULL, }, }; diff --git a/spa/include/spa/utils/type-info.h b/spa/include/spa/utils/type-info.h index f1c3cb92d..541ebfeee 100644 --- a/spa/include/spa/utils/type-info.h +++ b/spa/include/spa/utils/type-info.h @@ -26,6 +26,10 @@ extern "C" { #include +#ifndef SPA_TYPE_ROOT +#define SPA_TYPE_ROOT spa_types +#endif + static inline bool spa_type_is_a(const char *type, const char *parent) { @@ -71,6 +75,7 @@ struct spa_type_info { #include #include #include +#include static const struct spa_type_info spa_types[] = { /* Basic types */ diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 4fa3d6904..c85c7f9fb 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -163,12 +163,12 @@ static int debug_params(struct impl *this, struct spa_node *node, if (res <= 0) break; - spa_debug_pod(2, spa_debug_types, param); + spa_debug_pod(2, NULL, param); } spa_log_error(this->log, "failed filter:"); if (filter) - spa_debug_pod(2, spa_debug_types, filter); + spa_debug_pod(2, NULL, filter); return 0; } diff --git a/spa/tests/test-bluez5.c b/spa/tests/test-bluez5.c index 80f73da79..2fdaf70dd 100644 --- a/spa/tests/test-bluez5.c +++ b/spa/tests/test-bluez5.c @@ -91,7 +91,7 @@ struct data { static void inspect_item(struct data *data, struct spa_pod *item) { - spa_debug_pod(0, spa_debug_types, item); + spa_debug_pod(0, NULL, item); } static void monitor_event(void *_data, struct spa_event *event) diff --git a/spa/tests/test-control.c b/spa/tests/test-control.c index e96aeec11..df8b2971b 100644 --- a/spa/tests/test-control.c +++ b/spa/tests/test-control.c @@ -208,7 +208,7 @@ static void update_props(struct data *data) #endif #if 0 spa_pod_builder_push_sequence(&b, 0); - spa_pod_builder_event_header(&b, 0, SPA_CONTROL_properties); + spa_pod_builder_control_header(&b, 0, SPA_CONTROL_Properties); spa_pod_builder_push_object(&b, SPA_TYPE_OBJECT_Props, 0); spa_pod_builder_push_prop(&b, SPA_PROP_frequency, 0); spa_pod_builder_double(&b, ((sin(data->freq_accum) + 1.0) * 200.0) + 440.0); @@ -221,7 +221,7 @@ static void update_props(struct data *data) #endif #if 0 spa_pod_builder_push_sequence(&b, 0); - spa_pod_builder_event_header(&b, 0, SPA_CONTROL_properties); + spa_pod_builder_control_header(&b, 0, SPA_CONTROL_Properties); spa_pod_builder_object(&b, SPA_TYPE_OBJECT_Props, 0, ":", SPA_PROP_frequency, "d", ((sin(data->freq_accum) + 1.0) * 200.0) + 440.0, @@ -229,7 +229,7 @@ static void update_props(struct data *data) pod = spa_pod_builder_pop(&b); #endif - spa_debug_pod(0, spa_types, pod); + spa_debug_pod(0, NULL, pod); data->freq_accum += M_PI_M2 / 880.0; if (data->freq_accum >= M_PI_M2) @@ -314,7 +314,7 @@ static int make_nodes(struct data *data, const char *device) ":", SPA_PROP_device, "s", device ? device : "hw:0", ":", SPA_PROP_minLatency, "i", MIN_LATENCY); - spa_debug_pod(0, spa_debug_types, props); + spa_debug_pod(0, NULL, props); if ((res = spa_node_set_param(data->sink, SPA_PARAM_Props, 0, props)) < 0) printf("got set_props error %d\n", res); @@ -386,7 +386,7 @@ static int negotiate_formats(struct data *data) .rate = 44100, .channels = 2 )); - spa_debug_pod(0, spa_debug_types, filter); + spa_debug_pod(0, NULL, filter); spa_log_debug(&default_log.log, "enum_params"); if ((res = spa_node_port_enum_params(data->sink, @@ -395,7 +395,7 @@ static int negotiate_formats(struct data *data) filter, &format, &b)) <= 0) return -EBADF; - spa_debug_pod(0, spa_debug_types, format); + spa_debug_pod(0, NULL, format); spa_log_debug(&default_log.log, "sink set_param"); if ((res = spa_node_port_set_param(data->sink, diff --git a/spa/tests/test-convert.c b/spa/tests/test-convert.c index 52e2f39c1..66de30e7b 100644 --- a/spa/tests/test-convert.c +++ b/spa/tests/test-convert.c @@ -267,7 +267,7 @@ static int negotiate_buffers(struct data *data) NULL, ¶m, &b)) <= 0) return -EBADF; - spa_debug_pod(0, spa_debug_types, param); + spa_debug_pod(0, NULL, param); init_buffer(data, data->in_buffers, data->in_buffer, 1, BUFFER_SIZE, 1); if ((res = @@ -284,7 +284,7 @@ static int negotiate_buffers(struct data *data) NULL, ¶m, &b)) <= 0) return -EBADF; - spa_debug_pod(0, spa_debug_types, param); + spa_debug_pod(0, NULL, param); init_buffer(data, data->out_buffers, data->out_buffer, 1, BUFFER_SIZE, 2); if ((res = diff --git a/spa/tests/test-convert2.c b/spa/tests/test-convert2.c index 3d07c2cee..7af8458cd 100644 --- a/spa/tests/test-convert2.c +++ b/spa/tests/test-convert2.c @@ -320,7 +320,7 @@ static int negotiate_link_buffers(struct data *data, struct link *link) } spa_pod_fixate(param); - spa_debug_pod(0, spa_debug_types, param); + spa_debug_pod(0, NULL, param); if (link->in_info) in_alloc = SPA_FLAG_CHECK(link->in_info->flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS); diff --git a/spa/tests/test-graph.c b/spa/tests/test-graph.c index 4ddd72e3a..30e6bcb7a 100644 --- a/spa/tests/test-graph.c +++ b/spa/tests/test-graph.c @@ -261,7 +261,7 @@ static int make_nodes(struct data *data, const char *device) ":", SPA_PROP_device, "s", device ? device : "hw:0", ":", SPA_PROP_minLatency, "i", MIN_LATENCY); - spa_debug_pod(0, spa_debug_types, props); + spa_debug_pod(0, NULL, props); if ((res = spa_node_set_param(data->sink, SPA_PARAM_Props, 0, props)) < 0) printf("got set_props error %d\n", res); @@ -353,7 +353,7 @@ static int negotiate_formats(struct data *data) .rate = 44100, .channels = 2 )); - spa_debug_pod(0, spa_debug_types, filter); + spa_debug_pod(0, NULL, filter); spa_log_debug(&default_log.log, "enum_params"); if ((res = spa_node_port_enum_params(data->sink, @@ -362,7 +362,7 @@ static int negotiate_formats(struct data *data) filter, &format, &b)) <= 0) return -EBADF; - spa_debug_pod(0, spa_debug_types, format); + spa_debug_pod(0, NULL, format); spa_log_debug(&default_log.log, "sink set_param"); if ((res = spa_node_port_set_param(data->sink, diff --git a/spa/tests/test-props.c b/spa/tests/test-props.c index a645f78fb..c87b061b9 100644 --- a/spa/tests/test-props.c +++ b/spa/tests/test-props.c @@ -231,7 +231,7 @@ static void do_static_struct(void) } }; - spa_debug_pod(0, spa_debug_types, &test_format.fmt.pod); + spa_debug_pod(0, NULL, &test_format.fmt.pod); spa_debug_format(0, NULL, &test_format.fmt.pod); { @@ -294,7 +294,7 @@ int main(int argc, char *argv[]) fmt = spa_pod_builder_pop(&b); - spa_debug_pod(0, spa_debug_types, &fmt->pod); + spa_debug_pod(0, NULL, &fmt->pod); spa_pod_builder_init(&b, buffer, sizeof(buffer)); @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) 2, &SPA_FRACTION(0,1), &SPA_FRACTION(INT32_MAX,1)); - spa_debug_pod(0, spa_debug_types, &fmt->pod); + spa_debug_pod(0, NULL, &fmt->pod); spa_debug_format(0, NULL, &fmt->pod); spa_pod_builder_init(&b, buffer, sizeof(buffer)); @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) &SPA_FRACTION(INT32_MAX,1), "}", NULL); - spa_debug_pod(0, spa_debug_types, &fmt->pod); + spa_debug_pod(0, NULL, &fmt->pod); spa_debug_format(0, NULL, &fmt->pod); do_static_struct(); diff --git a/spa/tests/test-props2.c b/spa/tests/test-props2.c index 1236437a7..e74c2ea13 100644 --- a/spa/tests/test-props2.c +++ b/spa/tests/test-props2.c @@ -81,11 +81,11 @@ int main(int argc, char *argv[]) spa_pod_builder_pop(&b); obj = spa_pod_builder_pop(&b); - spa_debug_pod(0, spa_debug_types, obj); + spa_debug_pod(0, NULL, obj); struct spa_pod_prop *p = spa_pod_find_prop(obj, 4); printf("%d %d\n", p->body.key, p->body.flags); - spa_debug_pod(0, spa_debug_types, &p->body.value); + spa_debug_pod(0, NULL, &p->body.value); obj = spa_pod_builder_deref(&b, ref); diff --git a/spa/tools/spa-inspect.c b/spa/tools/spa-inspect.c index 8a4659679..0af0ce613 100644 --- a/spa/tools/spa-inspect.c +++ b/spa/tools/spa-inspect.c @@ -69,7 +69,7 @@ inspect_node_params(struct data *data, struct spa_node *node) ":", SPA_PARAM_LIST_id, "I", &id, NULL); - printf("enumerating: %s:\n", spa_debug_type_find_name(spa_debug_types, id)); + printf("enumerating: %s:\n", spa_debug_type_find_name(NULL, id)); for (idx2 = 0;;) { spa_pod_builder_init(&b, buffer, sizeof(buffer)); if ((res = spa_node_enum_params(node, @@ -79,7 +79,7 @@ inspect_node_params(struct data *data, struct spa_node *node) error(0, -res, "enum_params %d", id); break; } - spa_debug_pod(0, spa_debug_types, param); + spa_debug_pod(0, NULL, param); } } } @@ -110,7 +110,7 @@ inspect_port_params(struct data *data, struct spa_node *node, ":", SPA_PARAM_LIST_id, "I", &id, NULL); - printf("enumerating: %s:\n", spa_debug_type_find_name(spa_debug_types, id)); + printf("enumerating: %s:\n", spa_debug_type_find_name(NULL, id)); for (idx2 = 0;;) { spa_pod_builder_init(&b, buffer, sizeof(buffer)); if ((res = spa_node_port_enum_params(node, @@ -125,7 +125,7 @@ inspect_port_params(struct data *data, struct spa_node *node, if (spa_pod_is_object_id(param, SPA_TYPE_OBJECT_Format)) spa_debug_format(0, NULL, param); else - spa_debug_pod(0, spa_debug_types, param); + spa_debug_pod(0, NULL, param); } } } diff --git a/spa/tools/spa-monitor.c b/spa/tools/spa-monitor.c index 0f1e211cc..0c2bcad95 100644 --- a/spa/tools/spa-monitor.c +++ b/spa/tools/spa-monitor.c @@ -53,7 +53,7 @@ struct data { static void inspect_item(struct data *data, struct spa_pod *item) { - spa_debug_pod(0, spa_types, item); + spa_debug_pod(0, NULL, item); } static void on_monitor_event(void *_data, struct spa_event *event) diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index b78bae7c5..659e6f5a6 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -944,7 +944,7 @@ impl_node_port_send_command(struct spa_node *node, return 0; spa_log_trace(this->log, "send command %s", - spa_debug_type_find_name(spa_debug_types, SPA_NODE_COMMAND_ID(command))); + spa_debug_type_find_name(spa_type_node_command_id, SPA_NODE_COMMAND_ID(command))); pw_client_node_resource_port_command(this->resource, direction, port_id, diff --git a/src/modules/module-client-node/client-stream.c b/src/modules/module-client-node/client-stream.c index 8a7edc068..beb88bcc3 100644 --- a/src/modules/module-client-node/client-stream.c +++ b/src/modules/module-client-node/client-stream.c @@ -333,7 +333,7 @@ static int debug_params(struct impl *impl, struct spa_node *node, struct spa_pod *param; int res; - spa_log_error(this->log, "params %s:", spa_debug_type_find_name(spa_debug_types, id)); + spa_log_error(this->log, "params %s:", spa_debug_type_find_name(spa_type_param, id)); state = 0; while (true) { @@ -347,12 +347,12 @@ static int debug_params(struct impl *impl, struct spa_node *node, spa_log_error(this->log, " error: %s", spa_strerror(res)); break; } - spa_debug_pod(2, spa_debug_types, param); + spa_debug_pod(2, NULL, param); } spa_log_error(this->log, "failed filter:"); if (filter) - spa_debug_pod(2, spa_debug_types, filter); + spa_debug_pod(2, NULL, filter); return 0; } @@ -896,8 +896,8 @@ static void client_node_initialized(void *data) return; pw_log_debug("client-stream %p: %s/%s", &impl->this, - spa_debug_type_find_name(spa_debug_types, media_type), - spa_debug_type_find_name(spa_debug_types, media_subtype)); + spa_debug_type_find_name(spa_type_media_type, media_type), + spa_debug_type_find_name(spa_type_media_subtype, media_subtype)); if (!exclusive && diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index a83fc4d31..ed97d8667 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -165,7 +165,7 @@ process_messages(struct client_data *data) if (debug_messages) { fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size); - spa_debug_pod(0, spa_debug_types, (struct spa_pod *)message); + spa_debug_pod(0, NULL, (struct spa_pod *)message); } if (demarshal[opcode].func(resource, message, size) < 0) goto invalid_message; @@ -491,7 +491,7 @@ on_remote_data(void *data, int fd, enum spa_io mask) if (debug_messages) { fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size); - spa_debug_pod(0, spa_debug_types, (struct spa_pod *)message); + spa_debug_pod(0, NULL, (struct spa_pod *)message); } if (demarshal[opcode].func(proxy, message, size) < 0) { pw_log_error ("protocol-native %p: invalid message received %u for %u", this, diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c index 8c0b564f4..b8b3185e8 100644 --- a/src/modules/module-protocol-native/connection.c +++ b/src/modules/module-protocol-native/connection.c @@ -405,7 +405,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn, if (debug_messages) { fprintf(stderr, ">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size); - spa_debug_pod(0, spa_debug_types, (struct spa_pod *)p); + spa_debug_pod(0, NULL, (struct spa_pod *)p); } spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush, 0); diff --git a/src/modules/spa/spa-node.c b/src/modules/spa/spa-node.c index b18ace81a..dcb41c13b 100644 --- a/src/modules/spa/spa-node.c +++ b/src/modules/spa/spa-node.c @@ -172,12 +172,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie struct spa_pod_prop *prop; uint32_t type = 0; -#if 0 - if (!spa_type_is_a(key, SPA_TYPE_PROPS_BASE)) - continue; - -#endif - type = spa_debug_type_find_type(spa_debug_types, key); + type = spa_debug_type_find_type(NULL, key); if (type == SPA_TYPE_None) continue; @@ -193,7 +188,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie break; case SPA_TYPE_Enum: SPA_POD_VALUE(struct spa_pod_enum, &prop->body.value) = - spa_debug_type_find_type(spa_debug_types, value); + spa_debug_type_find_type(NULL, value); break; case SPA_TYPE_Int: SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) = diff --git a/src/pipewire/control.c b/src/pipewire/control.c index c94d31407..81de148cf 100644 --- a/src/pipewire/control.c +++ b/src/pipewire/control.c @@ -65,7 +65,7 @@ pw_control_new(struct pw_core *core, this->size = size; pw_log_debug("control %p: new %s %d", this, - spa_debug_type_find_name(spa_types, this->id), direction); + spa_debug_type_find_name(spa_type_io, this->id), direction); this->core = core; this->port = port; @@ -164,7 +164,7 @@ int pw_control_link(struct pw_control *control, struct pw_control *other) impl = SPA_CONTAINER_OF(control, struct impl, this); pw_log_debug("control %p: link to %p %s", control, other, - spa_debug_type_find_name(spa_debug_types, control->id)); + spa_debug_type_find_name(spa_type_io, control->id)); size = SPA_MAX(control->size, other->size); diff --git a/src/pipewire/core.c b/src/pipewire/core.c index be13d8d45..5ed3a5491 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -67,7 +67,7 @@ static void registry_bind(void *object, uint32_t id, goto wrong_interface; pw_log_debug("global %p: bind global id %d, iface %s to %d", global, id, - spa_debug_type_find_name(spa_debug_types, type), new_id); + spa_debug_type_find_name(NULL, type), new_id); if (pw_global_bind(global, client, permissions, version, new_id) < 0) goto exit; diff --git a/src/pipewire/factory.c b/src/pipewire/factory.c index 9e5dcef3b..e23093737 100644 --- a/src/pipewire/factory.c +++ b/src/pipewire/factory.c @@ -149,7 +149,7 @@ int pw_factory_register(struct pw_factory *factory, pw_properties_set(properties, "factory.name", factory->info.name); pw_properties_setf(properties, "factory.type.name", "%s", - spa_debug_type_find_name(spa_debug_types, factory->info.type)); + spa_debug_type_find_name(NULL, factory->info.type)); pw_properties_setf(properties, "factory.type.version", "%d", factory->info.version); spa_list_append(&core->factory_list, &factory->link); diff --git a/src/pipewire/global.c b/src/pipewire/global.c index e03326886..591dfa8c2 100644 --- a/src/pipewire/global.c +++ b/src/pipewire/global.c @@ -84,7 +84,7 @@ pw_global_new(struct pw_core *core, spa_hook_list_init(&this->listener_list); pw_log_debug("global %p: new %s %d", this, - spa_debug_type_find_name(spa_debug_types, this->type), + spa_debug_type_find_name(NULL, this->type), this->id); return this; diff --git a/src/pipewire/link.c b/src/pipewire/link.c index fdbe2a6e6..914f74745 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -500,7 +500,7 @@ param_filter(struct pw_link *this, } if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG) && iparam != NULL) - spa_debug_pod(2, spa_debug_types, iparam); + spa_debug_pod(2, NULL, iparam); for (oidx = 0;;) { pw_log_debug("oparam %d", oidx); @@ -511,7 +511,7 @@ param_filter(struct pw_link *this, } if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) - spa_debug_pod(2, spa_debug_types, oparam); + spa_debug_pod(2, NULL, oparam); num++; } @@ -651,7 +651,7 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s spa_pod_fixate(params[i]); pw_log_debug("fixated param %d:", i); if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) - spa_debug_pod(2, spa_debug_types, params[i]); + spa_debug_pod(2, NULL, params[i]); offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8); } diff --git a/src/pipewire/port.c b/src/pipewire/port.c index 3da4c66f3..ebdfa516d 100644 --- a/src/pipewire/port.c +++ b/src/pipewire/port.c @@ -792,7 +792,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32 pw_log_debug("port %p: %d set param on mix %d:%d.%d %s: %d (%s)", port, port->state, port->direction, port->port_id, p->port_id, - spa_debug_type_find_name(spa_debug_types, id), res, spa_strerror(res)); + spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res)); if (port->state == PW_PORT_STATE_CONFIGURE) { spa_node_port_set_param(port->mix, @@ -804,7 +804,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32 res = spa_node_port_set_param(node->node, port->direction, port->port_id, id, flags, param); pw_log_debug("port %p: %d set param on node %d:%d %s: %d (%s)", port, port->state, port->direction, port->port_id, - spa_debug_type_find_name(spa_debug_types, id), res, spa_strerror(res)); + spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res)); } diff --git a/src/pipewire/protocol.c b/src/pipewire/protocol.c index de72f7637..0ce745c57 100644 --- a/src/pipewire/protocol.c +++ b/src/pipewire/protocol.c @@ -129,7 +129,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol, spa_list_append(&protocol->marshal_list, &impl->link); pw_log_debug("Add marshal %d/%s:%d to protocol %s", marshal->type, - spa_debug_type_find_name(spa_debug_types, marshal->type), marshal->version, + spa_debug_type_find_name(NULL, marshal->type), marshal->version, protocol->name); return 0; diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 88979d396..3448c1fee 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -853,7 +853,7 @@ client_node_set_io(void *object, } pw_log_debug("node %p: set io %s %p", proxy, - spa_debug_type_find_name(spa_debug_types, id), ptr); + spa_debug_type_find_name(spa_type_io, id), ptr); if (id == PW_IO_ClientNodePosition) { if (ptr == NULL && data->position) { @@ -1200,7 +1200,7 @@ client_node_port_set_io(void *object, } pw_log_debug("port %p: set io %s %p", mix->port, - spa_debug_type_find_name(spa_debug_types, id), ptr); + spa_debug_type_find_name(spa_type_io, id), ptr); if (id == SPA_IO_Buffers) { if (ptr == NULL && mix->mix.io) { diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 94de68267..7fae3b72b 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -28,8 +28,10 @@ #include #include #include +#include #include #include +#include #include "pipewire/pipewire.h" #include "pipewire/stream.h" @@ -327,7 +329,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node); pw_log_debug("stream %p: set io %s %p %zd", impl, - spa_debug_type_find_name(spa_debug_types, id), data, size); + spa_debug_type_find_name(spa_type_io, id), data, size); switch (id) { case SPA_IO_Buffers: diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c index d0bc8e701..b619f1f9f 100644 --- a/src/tools/pipewire-cli.c +++ b/src/tools/pipewire-cli.c @@ -266,7 +266,7 @@ static int print_global(void *obj, void *data) return 0; fprintf(stdout, "\tid %d, parent %d, type %s/%d\n", global->id, global->parent_id, - spa_debug_type_find_name(spa_debug_types, global->type), + spa_debug_type_find_name(NULL, global->type), global->version); if (global->properties) print_properties(&global->properties->dict, ' ', false); @@ -501,7 +501,7 @@ static void info_global(struct proxy_data *pd) fprintf(stdout, "\tpermissions: %c%c%c\n", global->permissions & PW_PERM_R ? 'r' : '-', global->permissions & PW_PERM_W ? 'w' : '-', global->permissions & PW_PERM_X ? 'x' : '-'); - fprintf(stdout, "\ttype: %s/%d\n", spa_debug_type_find_name(spa_debug_types, global->type), pd->global->version); + fprintf(stdout, "\ttype: %s/%d\n", spa_debug_type_find_name(NULL, global->type), pd->global->version); } static void info_core(struct proxy_data *pd) @@ -567,7 +567,7 @@ static void info_factory(struct proxy_data *pd) info_global(pd); fprintf(stdout, "\tname: \"%s\"\n", info->name); - fprintf(stdout, "\tobject-type: %s/%d\n", spa_debug_type_find_name(spa_debug_types, info->type), info->version); + fprintf(stdout, "\tobject-type: %s/%d\n", spa_debug_type_find_name(NULL, info->type), info->version); print_properties(info->props, MARK_CHANGE(0), true); info->change_mask = 0; } @@ -668,7 +668,7 @@ static void node_event_param(void *object, uint32_t id, uint32_t index, uint32_t if (spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Format)) spa_debug_format(2, NULL, param); else - spa_debug_pod(2, spa_debug_types, param); + spa_debug_pod(2, NULL, param); } static const struct pw_node_proxy_events node_events = { @@ -705,7 +705,7 @@ static void port_event_param(void *object, uint32_t id, uint32_t index, uint32_t if (spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Format)) spa_debug_format(2, NULL, param); else - spa_debug_pod(2, spa_debug_types, param); + spa_debug_pod(2, NULL, param); } static const struct pw_port_proxy_events port_events = { @@ -855,7 +855,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er info_func = info_link; break; default: - asprintf(error, "unsupported type %s", spa_debug_type_find_name(spa_debug_types, global->type)); + asprintf(error, "unsupported type %s", spa_debug_type_find_name(NULL, global->type)); return false; } diff --git a/src/tools/pipewire-monitor.c b/src/tools/pipewire-monitor.c index 91f9bf07a..a64cfd786 100644 --- a/src/tools/pipewire-monitor.c +++ b/src/tools/pipewire-monitor.c @@ -220,7 +220,7 @@ static void print_node(struct proxy_data *data) if (spa_pod_is_object_type(data->params[i], SPA_TYPE_OBJECT_Format)) spa_debug_format(10, NULL, data->params[i]); else - spa_debug_pod(10, spa_debug_types, data->params[i]); + spa_debug_pod(10, NULL, data->params[i]); } printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(1), info->n_input_ports, info->max_input_ports); @@ -295,7 +295,7 @@ static void print_port(struct proxy_data *data) if (spa_pod_is_object_type(data->params[i], SPA_TYPE_OBJECT_Format)) spa_debug_format(12, NULL, data->params[i]); else - spa_debug_pod(12, spa_debug_types, data->params[i]); + spa_debug_pod(12, NULL, data->params[i]); } print_properties(info->props, MARK_CHANGE(1)); } @@ -354,7 +354,7 @@ static void factory_event_info(void *object, struct pw_factory_info *info) data->permissions & PW_PERM_X ? 'x' : '-'); printf("\ttype: %s (version %d)\n", PW_TYPE_INTERFACE__Factory, data->version); printf("\tname: \"%s\"\n", info->name); - printf("\tobject-type: %s/%d\n", spa_debug_type_find_name(spa_debug_types, info->type), info->version); + printf("\tobject-type: %s/%d\n", spa_debug_type_find_name(NULL, info->type), info->version); if (print_all) { print_properties(info->props, MARK_CHANGE(0)); } @@ -512,7 +512,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id, printf("\tpermissions: %c%c%c\n", permissions & PW_PERM_R ? 'r' : '-', permissions & PW_PERM_W ? 'w' : '-', permissions & PW_PERM_X ? 'x' : '-'); - printf("\ttype: %s (version %d)\n", spa_debug_type_find_name(spa_debug_types, type), version); + printf("\ttype: %s (version %d)\n", spa_debug_type_find_name(NULL, type), version); print_properties(props, ' '); return; }