PipeWire 1.4.10

Loading...
Searching...
No Matches
protocol-native.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_EXT_PROTOCOL_NATIVE_H
6#define PIPEWIRE_EXT_PROTOCOL_NATIVE_H
7
8#ifdef __cplusplus
9 extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13
14#include <pipewire/proxy.h>
15#include <pipewire/resource.h>
16
20
25#define PW_TYPE_INFO_PROTOCOL_Native PW_TYPE_INFO_PROTOCOL_BASE "Native"
26
27 struct pw_protocol_native_message {
28 uint32_t id;
29 uint32_t opcode;
30 void *data;
31 uint32_t size;
32 uint32_t n_fds;
33 int *fds;
34 int seq;
35};
36
37 struct pw_protocol_native_demarshal {
38 int (*func) (void *object, const struct pw_protocol_native_message *msg);
39 uint32_t permissions;
40 uint32_t flags;
41};
42
44 struct pw_protocol_native_ext {
45#define PW_VERSION_PROTOCOL_NATIVE_EXT 0
46 uint32_t version;
47
48 struct spa_pod_builder * (*begin_proxy) (struct pw_proxy *proxy,
49 uint8_t opcode, struct pw_protocol_native_message **msg);
50
51 uint32_t (*add_proxy_fd) (struct pw_proxy *proxy, int fd);
52 int (*get_proxy_fd) (struct pw_proxy *proxy, uint32_t index);
53
54 int (*end_proxy) (struct pw_proxy *proxy,
55 struct spa_pod_builder *builder);
56
57 struct spa_pod_builder * (*begin_resource) (struct pw_resource *resource,
58 uint8_t opcode, struct pw_protocol_native_message **msg);
59
60 uint32_t (*add_resource_fd) (struct pw_resource *resource, int fd);
61 int (*get_resource_fd) (struct pw_resource *resource, uint32_t index);
62
63 int (*end_resource) (struct pw_resource *resource,
64 struct spa_pod_builder *builder);
65};
66
67#define pw_protocol_native_begin_proxy(p,...) pw_protocol_ext(pw_proxy_get_protocol(p),struct pw_protocol_native_ext,begin_proxy,p,__VA_ARGS__)
68#define pw_protocol_native_add_proxy_fd(p,...) pw_protocol_ext(pw_proxy_get_protocol(p),struct pw_protocol_native_ext,add_proxy_fd,p,__VA_ARGS__)
69#define pw_protocol_native_get_proxy_fd(p,...) pw_protocol_ext(pw_proxy_get_protocol(p),struct pw_protocol_native_ext,get_proxy_fd,p,__VA_ARGS__)
70#define pw_protocol_native_end_proxy(p,...) pw_protocol_ext(pw_proxy_get_protocol(p),struct pw_protocol_native_ext,end_proxy,p,__VA_ARGS__)
71
72#define pw_protocol_native_begin_resource(r,...) pw_protocol_ext(pw_resource_get_protocol(r),struct pw_protocol_native_ext,begin_resource,r,__VA_ARGS__)
73#define pw_protocol_native_add_resource_fd(r,...) pw_protocol_ext(pw_resource_get_protocol(r),struct pw_protocol_native_ext,add_resource_fd,r,__VA_ARGS__)
74#define pw_protocol_native_get_resource_fd(r,...) pw_protocol_ext(pw_resource_get_protocol(r),struct pw_protocol_native_ext,get_resource_fd,r,__VA_ARGS__)
75#define pw_protocol_native_end_resource(r,...) pw_protocol_ext(pw_resource_get_protocol(r),struct pw_protocol_native_ext,end_resource,r,__VA_ARGS__)
76
80
81#ifdef __cplusplus
82} /* extern "C" */
83#endif
84
85#endif /* PIPEWIRE_EXT_PROTOCOL_NATIVE_H */
defs.h
spa/utils/defs.h
proxy.h
pipewire/proxy.h
resource.h
pipewire/resource.h
pw_protocol_native_demarshal
Definition protocol-native.h:42
pw_protocol_native_demarshal::flags
uint32_t flags
Definition protocol-native.h:45
pw_protocol_native_demarshal::permissions
uint32_t permissions
Definition protocol-native.h:44
pw_protocol_native_demarshal::func
int(* func)(void *object, const struct pw_protocol_native_message *msg)
Definition protocol-native.h:43
pw_protocol_native_ext
pw_protocol_native_ext methods
Definition protocol-native.h:49
pw_protocol_native_ext::get_proxy_fd
int(* get_proxy_fd)(struct pw_proxy *proxy, uint32_t index)
Definition protocol-native.h:58
pw_protocol_native_ext::end_resource
int(* end_resource)(struct pw_resource *resource, struct spa_pod_builder *builder)
Definition protocol-native.h:69
pw_protocol_native_ext::add_proxy_fd
uint32_t(* add_proxy_fd)(struct pw_proxy *proxy, int fd)
Definition protocol-native.h:57
pw_protocol_native_ext::version
uint32_t version
Definition protocol-native.h:52
pw_protocol_native_ext::end_proxy
int(* end_proxy)(struct pw_proxy *proxy, struct spa_pod_builder *builder)
Definition protocol-native.h:60
pw_protocol_native_ext::add_resource_fd
uint32_t(* add_resource_fd)(struct pw_resource *resource, int fd)
Definition protocol-native.h:66
pw_protocol_native_ext::get_resource_fd
int(* get_resource_fd)(struct pw_resource *resource, uint32_t index)
Definition protocol-native.h:67
pw_protocol_native_message
Definition protocol-native.h:32
pw_protocol_native_message::id
uint32_t id
Definition protocol-native.h:33
pw_protocol_native_message::seq
int seq
Definition protocol-native.h:39
pw_protocol_native_message::n_fds
uint32_t n_fds
Definition protocol-native.h:37
pw_protocol_native_message::fds
int * fds
Definition protocol-native.h:38
pw_protocol_native_message::size
uint32_t size
Definition protocol-native.h:36
pw_protocol_native_message::opcode
uint32_t opcode
Definition protocol-native.h:34
pw_proxy
pw_resource
spa_pod_builder
Definition builder.h:63