debug: allow custom type root

This commit is contained in:
Wim Taymans 2018-08-30 12:01:52 +02:00
parent 05d3502c84
commit 7cdb980b1a
32 changed files with 102 additions and 83 deletions

View file

@ -122,6 +122,9 @@ static inline int spa_debug_format(int indent,
[SPA_TYPE_Pod] = "pod" [SPA_TYPE_Pod] = "pod"
}; };
if (info == NULL)
info = spa_type_format;
if (format == NULL || SPA_POD_TYPE(format) != SPA_TYPE_Object) if (format == NULL || SPA_POD_TYPE(format) != SPA_TYPE_Object)
return -EINVAL; return -EINVAL;
@ -135,8 +138,6 @@ static inline int spa_debug_format(int indent,
media_type ? rindex(media_type, ':') + 1 : "unknown", media_type ? rindex(media_type, ':') + 1 : "unknown",
media_subtype ? rindex(media_subtype, ':') + 1 : "unknown"); media_subtype ? rindex(media_subtype, ':') + 1 : "unknown");
info = spa_type_format;
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) { SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) {
struct spa_pod_prop *prop; struct spa_pod_prop *prop;
const char *key; const char *key;

View file

@ -67,7 +67,7 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info,
{ {
struct spa_pod_pointer_body *b = body; struct spa_pod_pointer_body *b = body;
spa_debug("%*s" "Pointer %s %p", indent, "", 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; break;
} }
case SPA_TYPE_Rectangle: case SPA_TYPE_Rectangle:
@ -140,9 +140,9 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info,
ti ? ti->name : "unknown"); ti ? ti->name : "unknown");
SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) { 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"); c->offset, ii ? ii->name : "unknown");
spa_debug_pod_value(indent + 2, info, 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, static inline int spa_debug_pod(int indent,
const struct spa_type_info *info, const struct spa_pod *pod) 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_TYPE(pod),
SPA_POD_BODY(pod), SPA_POD_BODY(pod),
SPA_POD_BODY_SIZE(pod)); SPA_POD_BODY_SIZE(pod));

View file

@ -26,21 +26,19 @@ extern "C" {
#include <spa/utils/type-info.h> #include <spa/utils/type-info.h>
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) 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; const struct spa_type_info *res;
if (info == NULL)
info = SPA_TYPE_ROOT;
while (info && info->name) { while (info && info->name) {
if (info->type == SPA_ID_INVALID) if (info->type == SPA_ID_INVALID) {
if ((res = spa_debug_type_find(info->values, type))) if (info->values && (res = spa_debug_type_find(info->values, type)))
return res; return res;
if (info->type == type) }
else if (info->type == type)
return info; return info;
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) 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) { while (info && info->name) {
uint32_t res; uint32_t res;
if (strcmp(info->name, name) == 0) if (strcmp(info->name, name) == 0)
return info->type; 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; return res;
info++; info++;
} }

View file

@ -30,6 +30,20 @@ extern "C" {
#include <spa/node/event.h> #include <spa/node/event.h>
#include <spa/node/io.h> #include <spa/node/io.h>
#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__NodeEvent SPA_TYPE_EVENT_BASE "Node"
#define SPA_TYPE_NODE_EVENT_BASE SPA_TYPE__NodeEvent ":" #define SPA_TYPE_NODE_EVENT_BASE SPA_TYPE__NodeEvent ":"

View file

@ -28,6 +28,7 @@ extern "C" {
#include <spa/utils/type-info.h> #include <spa/utils/type-info.h>
#include <spa/param/props.h> #include <spa/param/props.h>
#include <spa/param/format.h> #include <spa/param/format.h>
#include <spa/node/io.h>
/* base for parameter object enumerations */ /* base for parameter object enumerations */
#define SPA_TYPE__ParamId SPA_TYPE_ENUM_BASE "ParamId" #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[] = { 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_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, }, { SPA_PARAM_IO_size, SPA_TYPE_PARAM_IO_BASE "size", SPA_TYPE_Int, },
{ 0, NULL, }, { 0, NULL, },
}; };

View file

@ -26,6 +26,10 @@ extern "C" {
#include <spa/utils/defs.h> #include <spa/utils/defs.h>
#ifndef SPA_TYPE_ROOT
#define SPA_TYPE_ROOT spa_types
#endif
static inline bool spa_type_is_a(const char *type, const char *parent) static inline bool spa_type_is_a(const char *type, const char *parent)
{ {
@ -71,6 +75,7 @@ struct spa_type_info {
#include <spa/monitor/type-info.h> #include <spa/monitor/type-info.h>
#include <spa/node/type-info.h> #include <spa/node/type-info.h>
#include <spa/param/type-info.h> #include <spa/param/type-info.h>
#include <spa/control/type-info.h>
static const struct spa_type_info spa_types[] = { static const struct spa_type_info spa_types[] = {
/* Basic types */ /* Basic types */

View file

@ -163,12 +163,12 @@ static int debug_params(struct impl *this, struct spa_node *node,
if (res <= 0) if (res <= 0)
break; break;
spa_debug_pod(2, spa_debug_types, param); spa_debug_pod(2, NULL, param);
} }
spa_log_error(this->log, "failed filter:"); spa_log_error(this->log, "failed filter:");
if (filter) if (filter)
spa_debug_pod(2, spa_debug_types, filter); spa_debug_pod(2, NULL, filter);
return 0; return 0;
} }

View file

@ -91,7 +91,7 @@ struct data {
static void inspect_item(struct data *data, struct spa_pod *item) 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) static void monitor_event(void *_data, struct spa_event *event)

View file

@ -208,7 +208,7 @@ static void update_props(struct data *data)
#endif #endif
#if 0 #if 0
spa_pod_builder_push_sequence(&b, 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_object(&b, SPA_TYPE_OBJECT_Props, 0);
spa_pod_builder_push_prop(&b, SPA_PROP_frequency, 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); 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 #endif
#if 0 #if 0
spa_pod_builder_push_sequence(&b, 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_pod_builder_object(&b,
SPA_TYPE_OBJECT_Props, 0, SPA_TYPE_OBJECT_Props, 0,
":", SPA_PROP_frequency, "d", ((sin(data->freq_accum) + 1.0) * 200.0) + 440.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); pod = spa_pod_builder_pop(&b);
#endif #endif
spa_debug_pod(0, spa_types, pod); spa_debug_pod(0, NULL, pod);
data->freq_accum += M_PI_M2 / 880.0; data->freq_accum += M_PI_M2 / 880.0;
if (data->freq_accum >= M_PI_M2) 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_device, "s", device ? device : "hw:0",
":", SPA_PROP_minLatency, "i", MIN_LATENCY); ":", 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) if ((res = spa_node_set_param(data->sink, SPA_PARAM_Props, 0, props)) < 0)
printf("got set_props error %d\n", res); printf("got set_props error %d\n", res);
@ -386,7 +386,7 @@ static int negotiate_formats(struct data *data)
.rate = 44100, .rate = 44100,
.channels = 2 )); .channels = 2 ));
spa_debug_pod(0, spa_debug_types, filter); spa_debug_pod(0, NULL, filter);
spa_log_debug(&default_log.log, "enum_params"); spa_log_debug(&default_log.log, "enum_params");
if ((res = spa_node_port_enum_params(data->sink, if ((res = spa_node_port_enum_params(data->sink,
@ -395,7 +395,7 @@ static int negotiate_formats(struct data *data)
filter, &format, &b)) <= 0) filter, &format, &b)) <= 0)
return -EBADF; 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"); spa_log_debug(&default_log.log, "sink set_param");
if ((res = spa_node_port_set_param(data->sink, if ((res = spa_node_port_set_param(data->sink,

View file

@ -267,7 +267,7 @@ static int negotiate_buffers(struct data *data)
NULL, &param, &b)) <= 0) NULL, &param, &b)) <= 0)
return -EBADF; 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); init_buffer(data, data->in_buffers, data->in_buffer, 1, BUFFER_SIZE, 1);
if ((res = if ((res =
@ -284,7 +284,7 @@ static int negotiate_buffers(struct data *data)
NULL, &param, &b)) <= 0) NULL, &param, &b)) <= 0)
return -EBADF; 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); init_buffer(data, data->out_buffers, data->out_buffer, 1, BUFFER_SIZE, 2);
if ((res = if ((res =

View file

@ -320,7 +320,7 @@ static int negotiate_link_buffers(struct data *data, struct link *link)
} }
spa_pod_fixate(param); spa_pod_fixate(param);
spa_debug_pod(0, spa_debug_types, param); spa_debug_pod(0, NULL, param);
if (link->in_info) if (link->in_info)
in_alloc = SPA_FLAG_CHECK(link->in_info->flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS); in_alloc = SPA_FLAG_CHECK(link->in_info->flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);

View file

@ -261,7 +261,7 @@ static int make_nodes(struct data *data, const char *device)
":", SPA_PROP_device, "s", device ? device : "hw:0", ":", SPA_PROP_device, "s", device ? device : "hw:0",
":", SPA_PROP_minLatency, "i", MIN_LATENCY); ":", 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) if ((res = spa_node_set_param(data->sink, SPA_PARAM_Props, 0, props)) < 0)
printf("got set_props error %d\n", res); printf("got set_props error %d\n", res);
@ -353,7 +353,7 @@ static int negotiate_formats(struct data *data)
.rate = 44100, .rate = 44100,
.channels = 2 )); .channels = 2 ));
spa_debug_pod(0, spa_debug_types, filter); spa_debug_pod(0, NULL, filter);
spa_log_debug(&default_log.log, "enum_params"); spa_log_debug(&default_log.log, "enum_params");
if ((res = spa_node_port_enum_params(data->sink, if ((res = spa_node_port_enum_params(data->sink,
@ -362,7 +362,7 @@ static int negotiate_formats(struct data *data)
filter, &format, &b)) <= 0) filter, &format, &b)) <= 0)
return -EBADF; 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"); spa_log_debug(&default_log.log, "sink set_param");
if ((res = spa_node_port_set_param(data->sink, if ((res = spa_node_port_set_param(data->sink,

View file

@ -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); 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); 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)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
@ -312,7 +312,7 @@ int main(int argc, char *argv[])
2, &SPA_FRACTION(0,1), 2, &SPA_FRACTION(0,1),
&SPA_FRACTION(INT32_MAX,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_debug_format(0, NULL, &fmt->pod);
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
@ -342,7 +342,7 @@ int main(int argc, char *argv[])
&SPA_FRACTION(INT32_MAX,1), &SPA_FRACTION(INT32_MAX,1),
"}", NULL); "}", NULL);
spa_debug_pod(0, spa_debug_types, &fmt->pod); spa_debug_pod(0, NULL, &fmt->pod);
spa_debug_format(0, NULL, &fmt->pod); spa_debug_format(0, NULL, &fmt->pod);
do_static_struct(); do_static_struct();

View file

@ -81,11 +81,11 @@ int main(int argc, char *argv[])
spa_pod_builder_pop(&b); spa_pod_builder_pop(&b);
obj = 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); struct spa_pod_prop *p = spa_pod_find_prop(obj, 4);
printf("%d %d\n", p->body.key, p->body.flags); 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); obj = spa_pod_builder_deref(&b, ref);

View file

@ -69,7 +69,7 @@ inspect_node_params(struct data *data, struct spa_node *node)
":", SPA_PARAM_LIST_id, "I", &id, ":", SPA_PARAM_LIST_id, "I", &id,
NULL); 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;;) { for (idx2 = 0;;) {
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
if ((res = spa_node_enum_params(node, 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); error(0, -res, "enum_params %d", id);
break; 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, ":", SPA_PARAM_LIST_id, "I", &id,
NULL); 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;;) { for (idx2 = 0;;) {
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
if ((res = spa_node_port_enum_params(node, 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)) if (spa_pod_is_object_id(param, SPA_TYPE_OBJECT_Format))
spa_debug_format(0, NULL, param); spa_debug_format(0, NULL, param);
else else
spa_debug_pod(0, spa_debug_types, param); spa_debug_pod(0, NULL, param);
} }
} }
} }

View file

@ -53,7 +53,7 @@ struct data {
static void inspect_item(struct data *data, struct spa_pod *item) 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) static void on_monitor_event(void *_data, struct spa_event *event)

View file

@ -944,7 +944,7 @@ impl_node_port_send_command(struct spa_node *node,
return 0; return 0;
spa_log_trace(this->log, "send command %s", 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, pw_client_node_resource_port_command(this->resource,
direction, port_id, direction, port_id,

View file

@ -333,7 +333,7 @@ static int debug_params(struct impl *impl, struct spa_node *node,
struct spa_pod *param; struct spa_pod *param;
int res; 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; state = 0;
while (true) { 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)); spa_log_error(this->log, " error: %s", spa_strerror(res));
break; break;
} }
spa_debug_pod(2, spa_debug_types, param); spa_debug_pod(2, NULL, param);
} }
spa_log_error(this->log, "failed filter:"); spa_log_error(this->log, "failed filter:");
if (filter) if (filter)
spa_debug_pod(2, spa_debug_types, filter); spa_debug_pod(2, NULL, filter);
return 0; return 0;
} }
@ -896,8 +896,8 @@ static void client_node_initialized(void *data)
return; return;
pw_log_debug("client-stream %p: %s/%s", &impl->this, 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_type_media_type, media_type),
spa_debug_type_find_name(spa_debug_types, media_subtype)); spa_debug_type_find_name(spa_type_media_subtype, media_subtype));
if (!exclusive && if (!exclusive &&

View file

@ -165,7 +165,7 @@ process_messages(struct client_data *data)
if (debug_messages) { if (debug_messages) {
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size); 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) if (demarshal[opcode].func(resource, message, size) < 0)
goto invalid_message; goto invalid_message;
@ -491,7 +491,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
if (debug_messages) { if (debug_messages) {
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size); 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) { if (demarshal[opcode].func(proxy, message, size) < 0) {
pw_log_error ("protocol-native %p: invalid message received %u for %u", this, pw_log_error ("protocol-native %p: invalid message received %u for %u", this,

View file

@ -405,7 +405,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
if (debug_messages) { if (debug_messages) {
fprintf(stderr, ">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size); 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, spa_hook_list_call(&conn->listener_list,
struct pw_protocol_native_connection_events, need_flush, 0); struct pw_protocol_native_connection_events, need_flush, 0);

View file

@ -172,12 +172,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
struct spa_pod_prop *prop; struct spa_pod_prop *prop;
uint32_t type = 0; uint32_t type = 0;
#if 0 type = spa_debug_type_find_type(NULL, key);
if (!spa_type_is_a(key, SPA_TYPE_PROPS_BASE))
continue;
#endif
type = spa_debug_type_find_type(spa_debug_types, key);
if (type == SPA_TYPE_None) if (type == SPA_TYPE_None)
continue; continue;
@ -193,7 +188,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
break; break;
case SPA_TYPE_Enum: case SPA_TYPE_Enum:
SPA_POD_VALUE(struct spa_pod_enum, &prop->body.value) = 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; break;
case SPA_TYPE_Int: case SPA_TYPE_Int:
SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) = SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) =

View file

@ -65,7 +65,7 @@ pw_control_new(struct pw_core *core,
this->size = size; this->size = size;
pw_log_debug("control %p: new %s %d", this, 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->core = core;
this->port = port; 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); impl = SPA_CONTAINER_OF(control, struct impl, this);
pw_log_debug("control %p: link to %p %s", control, other, 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); size = SPA_MAX(control->size, other->size);

View file

@ -67,7 +67,7 @@ static void registry_bind(void *object, uint32_t id,
goto wrong_interface; goto wrong_interface;
pw_log_debug("global %p: bind global id %d, iface %s to %d", global, id, 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) if (pw_global_bind(global, client, permissions, version, new_id) < 0)
goto exit; goto exit;

View file

@ -149,7 +149,7 @@ int pw_factory_register(struct pw_factory *factory,
pw_properties_set(properties, "factory.name", factory->info.name); pw_properties_set(properties, "factory.name", factory->info.name);
pw_properties_setf(properties, "factory.type.name", "%s", 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); pw_properties_setf(properties, "factory.type.version", "%d", factory->info.version);
spa_list_append(&core->factory_list, &factory->link); spa_list_append(&core->factory_list, &factory->link);

View file

@ -84,7 +84,7 @@ pw_global_new(struct pw_core *core,
spa_hook_list_init(&this->listener_list); spa_hook_list_init(&this->listener_list);
pw_log_debug("global %p: new %s %d", this, 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); this->id);
return this; return this;

View file

@ -500,7 +500,7 @@ param_filter(struct pw_link *this,
} }
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG) && iparam != NULL) 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;;) { for (oidx = 0;;) {
pw_log_debug("oparam %d", oidx); 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)) if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_pod(2, spa_debug_types, oparam); spa_debug_pod(2, NULL, oparam);
num++; 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]); spa_pod_fixate(params[i]);
pw_log_debug("fixated param %d:", i); pw_log_debug("fixated param %d:", i);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) 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); offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
} }

View file

@ -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, 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, 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) { if (port->state == PW_PORT_STATE_CONFIGURE) {
spa_node_port_set_param(port->mix, 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); 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, pw_log_debug("port %p: %d set param on node %d:%d %s: %d (%s)", port, port->state,
port->direction, port->port_id, 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));
} }

View file

@ -129,7 +129,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol,
spa_list_append(&protocol->marshal_list, &impl->link); spa_list_append(&protocol->marshal_list, &impl->link);
pw_log_debug("Add marshal %d/%s:%d to protocol %s", marshal->type, 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); protocol->name);
return 0; return 0;

View file

@ -853,7 +853,7 @@ client_node_set_io(void *object,
} }
pw_log_debug("node %p: set io %s %p", proxy, 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 (id == PW_IO_ClientNodePosition) {
if (ptr == NULL && data->position) { 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, 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 (id == SPA_IO_Buffers) {
if (ptr == NULL && mix->mix.io) { if (ptr == NULL && mix->mix.io) {

View file

@ -28,8 +28,10 @@
#include <spa/node/io.h> #include <spa/node/io.h>
#include <spa/utils/ringbuffer.h> #include <spa/utils/ringbuffer.h>
#include <spa/pod/filter.h> #include <spa/pod/filter.h>
#include <spa/control/control.h>
#include <spa/debug/format.h> #include <spa/debug/format.h>
#include <spa/debug/types.h> #include <spa/debug/types.h>
#include <spa/debug/pod.h>
#include "pipewire/pipewire.h" #include "pipewire/pipewire.h"
#include "pipewire/stream.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); struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
pw_log_debug("stream %p: set io %s %p %zd", impl, 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) { switch (id) {
case SPA_IO_Buffers: case SPA_IO_Buffers:

View file

@ -266,7 +266,7 @@ static int print_global(void *obj, void *data)
return 0; return 0;
fprintf(stdout, "\tid %d, parent %d, type %s/%d\n", global->id, global->parent_id, 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); global->version);
if (global->properties) if (global->properties)
print_properties(&global->properties->dict, ' ', false); 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' : '-', fprintf(stdout, "\tpermissions: %c%c%c\n", global->permissions & PW_PERM_R ? 'r' : '-',
global->permissions & PW_PERM_W ? 'w' : '-', global->permissions & PW_PERM_W ? 'w' : '-',
global->permissions & PW_PERM_X ? 'x' : '-'); 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) static void info_core(struct proxy_data *pd)
@ -567,7 +567,7 @@ static void info_factory(struct proxy_data *pd)
info_global(pd); info_global(pd);
fprintf(stdout, "\tname: \"%s\"\n", info->name); 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); print_properties(info->props, MARK_CHANGE(0), true);
info->change_mask = 0; 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)) if (spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Format))
spa_debug_format(2, NULL, param); spa_debug_format(2, NULL, param);
else else
spa_debug_pod(2, spa_debug_types, param); spa_debug_pod(2, NULL, param);
} }
static const struct pw_node_proxy_events node_events = { 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)) if (spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Format))
spa_debug_format(2, NULL, param); spa_debug_format(2, NULL, param);
else else
spa_debug_pod(2, spa_debug_types, param); spa_debug_pod(2, NULL, param);
} }
static const struct pw_port_proxy_events port_events = { 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; info_func = info_link;
break; break;
default: 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; return false;
} }

View file

@ -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)) if (spa_pod_is_object_type(data->params[i], SPA_TYPE_OBJECT_Format))
spa_debug_format(10, NULL, data->params[i]); spa_debug_format(10, NULL, data->params[i]);
else 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), printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(1),
info->n_input_ports, info->max_input_ports); 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)) if (spa_pod_is_object_type(data->params[i], SPA_TYPE_OBJECT_Format))
spa_debug_format(12, NULL, data->params[i]); spa_debug_format(12, NULL, data->params[i]);
else 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)); 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' : '-'); data->permissions & PW_PERM_X ? 'x' : '-');
printf("\ttype: %s (version %d)\n", PW_TYPE_INTERFACE__Factory, data->version); printf("\ttype: %s (version %d)\n", PW_TYPE_INTERFACE__Factory, data->version);
printf("\tname: \"%s\"\n", info->name); 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) { if (print_all) {
print_properties(info->props, MARK_CHANGE(0)); 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' : '-', printf("\tpermissions: %c%c%c\n", permissions & PW_PERM_R ? 'r' : '-',
permissions & PW_PERM_W ? 'w' : '-', permissions & PW_PERM_W ? 'w' : '-',
permissions & PW_PERM_X ? 'x' : '-'); 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, ' '); print_properties(props, ' ');
return; return;
} }