2023-02-08 18:12:00 +01:00
|
|
|
/* PipeWire */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2020 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
2021-06-18 22:56:49 +02:00
|
|
|
|
|
|
|
|
#ifndef PULSE_SERVER_MESSAGE_H
|
|
|
|
|
#define PULSE_SERVER_MESSAGE_H
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include <spa/utils/list.h>
|
|
|
|
|
#include <spa/support/log.h>
|
|
|
|
|
|
|
|
|
|
struct impl;
|
|
|
|
|
|
2024-05-14 16:32:19 +02:00
|
|
|
enum message_type {
|
|
|
|
|
MESSAGE_TYPE_UNSPECIFIED,
|
|
|
|
|
MESSAGE_TYPE_SUBSCRIPTION_EVENT,
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-18 22:56:49 +02:00
|
|
|
struct message {
|
|
|
|
|
struct spa_list link;
|
2022-06-16 19:54:13 +02:00
|
|
|
struct impl *impl;
|
2021-06-18 22:56:49 +02:00
|
|
|
uint32_t channel;
|
|
|
|
|
uint32_t allocated;
|
|
|
|
|
uint32_t length;
|
|
|
|
|
uint32_t offset;
|
|
|
|
|
uint8_t *data;
|
2024-05-14 16:32:19 +02:00
|
|
|
|
|
|
|
|
enum message_type type;
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t event;
|
|
|
|
|
uint32_t index;
|
|
|
|
|
} subscription_event;
|
|
|
|
|
} u;
|
2021-06-18 22:56:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
TAG_INVALID = 0,
|
|
|
|
|
TAG_STRING = 't',
|
|
|
|
|
TAG_STRING_NULL = 'N',
|
|
|
|
|
TAG_U32 = 'L',
|
|
|
|
|
TAG_U8 = 'B',
|
|
|
|
|
TAG_U64 = 'R',
|
|
|
|
|
TAG_S64 = 'r',
|
|
|
|
|
TAG_SAMPLE_SPEC = 'a',
|
|
|
|
|
TAG_ARBITRARY = 'x',
|
|
|
|
|
TAG_BOOLEAN_TRUE = '1',
|
|
|
|
|
TAG_BOOLEAN_FALSE = '0',
|
|
|
|
|
TAG_BOOLEAN = TAG_BOOLEAN_TRUE,
|
|
|
|
|
TAG_TIMEVAL = 'T',
|
|
|
|
|
TAG_USEC = 'U' /* 64bit unsigned */,
|
|
|
|
|
TAG_CHANNEL_MAP = 'm',
|
|
|
|
|
TAG_CVOLUME = 'v',
|
|
|
|
|
TAG_PROPLIST = 'P',
|
|
|
|
|
TAG_VOLUME = 'V',
|
|
|
|
|
TAG_FORMAT_INFO = 'f',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct message *message_alloc(struct impl *impl, uint32_t channel, uint32_t size);
|
2022-06-16 19:54:13 +02:00
|
|
|
void message_free(struct message *msg, bool dequeue, bool destroy);
|
2021-06-18 22:56:49 +02:00
|
|
|
int message_get(struct message *m, ...);
|
|
|
|
|
int message_put(struct message *m, ...);
|
2024-01-11 12:05:29 +01:00
|
|
|
int message_dump(enum spa_log_level level, const char *prefix, struct message *m);
|
2021-06-18 22:56:49 +02:00
|
|
|
|
|
|
|
|
#endif /* PULSE_SERVER_MESSAGE_H */
|