mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
modules: switch protocol-native to the new logging system
This is more complicated than a normal module because we have two logging topics: mod.protocol-native and conn.protocol-native for wire messages. Because the latter use spa_debug (through spa_debug_pod) we need to #define our way around so those too use the right topics. Note that this removes the previous "connection" category, it is now "conn.protocol-native" instead.
This commit is contained in:
parent
14112fd168
commit
96f8a7597e
6 changed files with 58 additions and 32 deletions
|
|
@ -36,7 +36,12 @@
|
|||
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
#define spa_debug pw_log_debug
|
||||
PW_LOG_TOPIC_EXTERN(mod_topic);
|
||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
PW_LOG_TOPIC_EXTERN(mod_topic_connection);
|
||||
|
||||
#undef spa_debug
|
||||
#define spa_debug(...) pw_logt_debug(mod_topic_connection, __VA_ARGS__)
|
||||
#include <spa/debug/pod.h>
|
||||
|
||||
#include "connection.h"
|
||||
|
|
@ -48,8 +53,6 @@
|
|||
#define HDR_SIZE_V0 8
|
||||
#define HDR_SIZE 16
|
||||
|
||||
static bool debug_messages = 0;
|
||||
|
||||
struct buffer {
|
||||
uint8_t *buffer_data;
|
||||
size_t buffer_size;
|
||||
|
|
@ -367,7 +370,6 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct p
|
|||
if (impl == NULL)
|
||||
return NULL;
|
||||
|
||||
debug_messages = pw_debug_is_category_enabled("connection");
|
||||
impl->context = context;
|
||||
|
||||
this = &impl->this;
|
||||
|
|
@ -633,7 +635,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
|
|||
else
|
||||
buf->n_fds = buf->msg.n_fds;
|
||||
|
||||
if (debug_messages) {
|
||||
if (mod_topic_connection->level >= SPA_LOG_LEVEL_DEBUG) {
|
||||
pw_log_debug(">>>>>>>>> out: id:%d op:%d size:%d seq:%d",
|
||||
buf->msg.id, buf->msg.opcode, size, buf->msg.seq);
|
||||
spa_debug_pod(0, NULL, SPA_PTROFF(p, impl->hdr_size, struct spa_pod));
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
|
||||
#define DEFAULT_SYSTEM_RUNTIME_DIR "/run/pipewire"
|
||||
|
||||
PW_LOG_TOPIC_EXTERN(mod_topic);
|
||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
|
||||
static const char *
|
||||
get_remote(const struct spa_dict *props)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
#include "connection.h"
|
||||
|
||||
PW_LOG_TOPIC_EXTERN(mod_topic);
|
||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
|
||||
static int core_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_events *events,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
|
||||
#include "connection.h"
|
||||
|
||||
#define NAME "protocol-native"
|
||||
PW_LOG_TOPIC(mod_topic, "mod." NAME);
|
||||
PW_LOG_TOPIC(mod_topic_connection, "conn." NAME);
|
||||
|
||||
static void test_create(struct pw_protocol_native_connection *conn)
|
||||
{
|
||||
const struct pw_protocol_native_message *msg;
|
||||
|
|
@ -190,6 +194,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
pw_init(&argc, &argv);
|
||||
|
||||
PW_LOG_TOPIC_INIT(mod_topic);
|
||||
PW_LOG_TOPIC_INIT(mod_topic_connection);
|
||||
|
||||
loop = pw_main_loop_new(NULL);
|
||||
spa_assert_se(loop != NULL);
|
||||
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 0);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@
|
|||
|
||||
#include "../connection.h"
|
||||
|
||||
PW_LOG_TOPIC_EXTERN(mod_topic);
|
||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
|
||||
#define PW_PROTOCOL_NATIVE_FLAG_REMAP (1<<0)
|
||||
|
||||
SPA_EXPORT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue