Improve debug

This commit is contained in:
Wim Taymans 2019-10-22 13:06:20 +02:00
parent eb1d675cb0
commit ff96165035
7 changed files with 37 additions and 17 deletions

View file

@ -96,8 +96,11 @@ static void alsa_update_node(struct alsa_object *obj, struct alsa_node *node,
const struct spa_device_object_info *info)
{
pw_log_debug("update node %u", node->id);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(node->props, info->props);
spa_debug_dict(0, info->props);
}
static struct alsa_node *alsa_create_node(struct alsa_object *obj, uint32_t id,
@ -222,12 +225,13 @@ static void alsa_device_info(void *data, const struct spa_device_info *info)
struct alsa_object *obj = data;
const char *str;
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(obj->props, info->props);
if ((str = pw_properties_get(obj->props, PW_KEY_DEVICE_ID)) != NULL)
obj->device_id = pw_properties_parse_int(str);
spa_debug_dict(0, info->props);
}
static void alsa_device_object_info(void *data, uint32_t id,
@ -272,7 +276,10 @@ static void alsa_update_object(struct monitor *monitor, struct alsa_object *obj,
const struct spa_device_object_info *info)
{
pw_log_debug("update object %u", obj->id);
spa_debug_dict(0, info->props);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(obj->props, info->props);
}

View file

@ -84,7 +84,9 @@ static void bluez5_update_node(struct bluez5_object *obj, struct bluez5_node *no
const struct spa_device_object_info *info)
{
pw_log_debug("update node %u", node->id);
spa_debug_dict(0, info->props);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
}
static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_t id,
@ -215,7 +217,9 @@ static void bluez5_update_object(struct monitor *monitor, struct bluez5_object *
const struct spa_device_object_info *info)
{
pw_log_debug("update object %u", obj->id);
spa_debug_dict(0, info->props);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
}
static struct bluez5_object *bluez5_create_object(struct monitor *monitor, uint32_t id,

View file

@ -345,7 +345,8 @@ static void node_event_param(void *object, int seq,
return;
spa_pod_object_fixate((struct spa_pod_object*)param);
spa_debug_pod(2, NULL, param);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_pod(2, NULL, param);
if (spa_format_audio_raw_parse(param, &info) < 0)
goto error;
@ -356,7 +357,8 @@ static void node_event_param(void *object, int seq,
error:
pw_log_warn("unhandled param:");
spa_debug_pod(2, NULL, param);
if (pw_log_level_enabled(SPA_LOG_LEVEL_WARN))
spa_debug_pod(2, NULL, param);
return;
}

View file

@ -83,8 +83,11 @@ static void v4l2_update_node(struct v4l2_object *obj, struct v4l2_node *node,
const struct spa_device_object_info *info)
{
pw_log_debug("update node %u", node->id);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(node->props, info->props);
spa_debug_dict(0, info->props);
}
static struct v4l2_node *v4l2_create_node(struct v4l2_object *obj, uint32_t id,
@ -163,8 +166,11 @@ static void v4l2_remove_node(struct v4l2_object *obj, struct v4l2_node *node)
static void v4l2_device_info(void *data, const struct spa_device_info *info)
{
struct v4l2_object *obj = data;
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(obj->props, info->props);
spa_debug_dict(0, info->props);
}
static void v4l2_device_object_info(void *data, uint32_t id,
@ -209,7 +215,10 @@ static void v4l2_update_object(struct monitor *monitor, struct v4l2_object *obj,
const struct spa_device_object_info *info)
{
pw_log_debug("update object %u", obj->id);
spa_debug_dict(0, info->props);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_dict(0, info->props);
pw_properties_update(obj->props, info->props);
}