spa: add context to debug functions

Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.

Use this to let some plugins log the pod and format to the log without
using the global logger.

Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.
This commit is contained in:
Wim Taymans 2023-01-18 13:09:00 +01:00
parent f472fd736d
commit 3c67821c4a
14 changed files with 158 additions and 268 deletions

View file

@ -46,6 +46,9 @@
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#include <spa/pod/parser.h>
#undef spa_debugc
#define spa_debugc(l,...) spa_log_debug(l, __VA_ARGS__)
#include <spa/debug/pod.h>
#include "alsa.h"
@ -736,7 +739,7 @@ static int impl_set_param(void *object,
SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx),
SPA_PARAM_PROFILE_save, SPA_POD_OPT_Bool(&save))) < 0) {
spa_log_warn(this->log, "can't parse profile");
spa_debug_pod(0, NULL, param);
spa_debugc_pod(this->log, 0, NULL, param);
return res;
}
@ -761,7 +764,7 @@ static int impl_set_param(void *object,
SPA_PARAM_ROUTE_props, SPA_POD_OPT_Pod(&props),
SPA_PARAM_ROUTE_save, SPA_POD_OPT_Bool(&save))) < 0) {
spa_log_warn(this->log, "can't parse route");
spa_debug_pod(0, NULL, param);
spa_debugc_pod(this->log, 0, NULL, param);
return res;
}
if (device >= this->card->n_devices)