PipeWire  0.3.45
protocol-native.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef PIPEWIRE_EXT_PROTOCOL_NATIVE_H
26 #define PIPEWIRE_EXT_PROTOCOL_NATIVE_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/defs.h>
33 
34 #include <pipewire/proxy.h>
35 #include <pipewire/resource.h>
36 
45 #define PW_TYPE_INFO_PROTOCOL_Native PW_TYPE_INFO_PROTOCOL_BASE "Native"
46 
48  uint32_t id;
49  uint32_t opcode;
50  void *data;
51  uint32_t size;
52  uint32_t n_fds;
53  int *fds;
54  int seq;
55 };
56 
58  int (*func) (void *object, const struct pw_protocol_native_message *msg);
59  uint32_t permissions;
60  uint32_t flags;
61 };
62 
65 #define PW_VERSION_PROTOCOL_NATIVE_EXT 0
66  uint32_t version;
67 
68  struct spa_pod_builder * (*begin_proxy) (struct pw_proxy *proxy,
69  uint8_t opcode, struct pw_protocol_native_message **msg);
70 
71  uint32_t (*add_proxy_fd) (struct pw_proxy *proxy, int fd);
72  int (*get_proxy_fd) (struct pw_proxy *proxy, uint32_t index);
73 
74  int (*end_proxy) (struct pw_proxy *proxy,
75  struct spa_pod_builder *builder);
76 
77  struct spa_pod_builder * (*begin_resource) (struct pw_resource *resource,
78  uint8_t opcode, struct pw_protocol_native_message **msg);
79 
80  uint32_t (*add_resource_fd) (struct pw_resource *resource, int fd);
81  int (*get_resource_fd) (struct pw_resource *resource, uint32_t index);
82 
83  int (*end_resource) (struct pw_resource *resource,
84  struct spa_pod_builder *builder);
85 };
86 
87 #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__)
88 #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__)
89 #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__)
90 #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__)
91 
92 #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__)
93 #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__)
94 #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__)
95 #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__)
96 
101 #ifdef __cplusplus
102 } /* extern "C" */
103 #endif
104 
105 #endif /* PIPEWIRE_EXT_PROTOCOL_NATIVE_H */
spa/utils/defs.h
pipewire/proxy.h
pipewire/resource.h
Definition: protocol-native.h:62
uint32_t flags
Definition: protocol-native.h:65
uint32_t permissions
Definition: protocol-native.h:64
int(* func)(void *object, const struct pw_protocol_native_message *msg)
Definition: protocol-native.h:63
pw_protocol_native_ext methods
Definition: protocol-native.h:69
int(* get_proxy_fd)(struct pw_proxy *proxy, uint32_t index)
Definition: protocol-native.h:78
int(* end_resource)(struct pw_resource *resource, struct spa_pod_builder *builder)
Definition: protocol-native.h:89
uint32_t(* add_proxy_fd)(struct pw_proxy *proxy, int fd)
Definition: protocol-native.h:77
uint32_t version
Definition: protocol-native.h:72
int(* end_proxy)(struct pw_proxy *proxy, struct spa_pod_builder *builder)
Definition: protocol-native.h:80
uint32_t(* add_resource_fd)(struct pw_resource *resource, int fd)
Definition: protocol-native.h:86
int(* get_resource_fd)(struct pw_resource *resource, uint32_t index)
Definition: protocol-native.h:87
Definition: protocol-native.h:52
uint32_t id
Definition: protocol-native.h:53
int seq
Definition: protocol-native.h:59
void * data
Definition: protocol-native.h:55
uint32_t n_fds
Definition: protocol-native.h:57
int * fds
Definition: protocol-native.h:58
uint32_t size
Definition: protocol-native.h:56
uint32_t opcode
Definition: protocol-native.h:54
Definition: impl.h:49
Definition: builder.h:73