PipeWire  0.3.15
buffers.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2019 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_BUFFERS_H
26 #define PIPEWIRE_BUFFERS_H
27 
28 #include <spa/node/node.h>
29 
30 #include <pipewire/context.h>
31 #include <pipewire/mem.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define PW_BUFFERS_FLAG_NONE 0
38 #define PW_BUFFERS_FLAG_NO_MEM (1<<0)
39 #define PW_BUFFERS_FLAG_SHARED (1<<1)
40 #define PW_BUFFERS_FLAG_DYNAMIC (1<<2)
42 struct pw_buffers {
43  struct pw_memblock *mem;
44  struct spa_buffer **buffers;
45  uint32_t n_buffers;
46  uint32_t flags;
47 };
48 
49 int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
50  struct spa_node *outnode, uint32_t out_port_id,
51  struct spa_node *innode, uint32_t in_port_id,
52  struct pw_buffers *result);
53 
54 void pw_buffers_clear(struct pw_buffers *buffers);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* PIPEWIRE_BUFFERS_H */
PW_MEMBLOCK_FLAG_READWRITE
@ PW_MEMBLOCK_FLAG_READWRITE
Definition: mem.h:44
res
static uint32_t int int res
Definition: core.h:326
pw_mempool
Definition: mem.h:62
port::params
struct spa_param_info params[5]
Definition: filter.c:99
pw_buffers::mem
struct pw_memblock * mem
allocated buffer memory
Definition: buffers.h:43
pw_buffers
Definition: buffers.h:42
pw_log::pw_log_error
#define pw_log_error(...)
MAX_ALIGN
#define MAX_ALIGN
Definition: buffers.c:41
keys.h
PW_MEMBLOCK_FLAG_MAP
@ PW_MEMBLOCK_FLAG_MAP
mmap the fd
Definition: mem.h:40
MAX_BLOCKS
#define MAX_BLOCKS
Definition: buffers.c:42
data
Definition: filter.c:71
PW_BUFFERS_FLAG_DYNAMIC
#define PW_BUFFERS_FLAG_DYNAMIC
buffers have dynamic data
Definition: buffers.h:40
PW_KEY_CPU_MAX_ALIGN
#define PW_KEY_CPU_MAX_ALIGN
maximum alignment needed to support all CPU optimizations
Definition: keys.h:78
pw_memblock::pw_mempool_alloc
SPA_EXPORT struct pw_memblock * pw_mempool_alloc(struct pw_mempool *pool, enum pw_memblock_flags flags, uint32_t type, size_t size)
Create a new memblock.
Definition: mem.c:460
pw_buffers_negotiate
int pw_buffers_negotiate(struct pw_context *context, uint32_t flags, struct spa_node *outnode, uint32_t out_port_id, struct spa_node *innode, uint32_t in_port_id, struct pw_buffers *result)
Definition: buffers.c:237
pw_memmap::ptr
void * ptr
mapped pointer
Definition: mem.h:82
port::node
struct spa_node * node
Definition: buffers.c:45
NAME
#define NAME
Definition: buffers.c:39
PW_MEMBLOCK_FLAG_SEAL
@ PW_MEMBLOCK_FLAG_SEAL
seal the fd
Definition: mem.h:39
port
Definition: buffers.c:44
pw_buffers::n_buffers
uint32_t n_buffers
number of port buffers
Definition: buffers.h:45
pw_log::pw_log_debug
#define pw_log_debug(...)
pw_log::pw_log_warn
#define pw_log_warn(...)
PW_BUFFERS_FLAG_SHARED
#define PW_BUFFERS_FLAG_SHARED
buffers can be shared
Definition: buffers.h:39
buffer
Definition: filter.c:55
buffers.h
pw_memblock::map
struct pw_memmap * map
optional map when PW_MEMBLOCK_FLAG_MAP was given
Definition: mem.h:76
param_filter
Definition: impl-port.c:1096
pw_buffers::flags
uint32_t flags
flags
Definition: buffers.h:46
port::port_id
uint32_t port_id
Definition: buffers.c:47
pw_buffers_clear
void pw_buffers_clear(struct pw_buffers *buffers)
Definition: buffers.c:355
pw_properties::pw_properties_get
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:456
pw_context
the PipeWire context
port::flags
uint32_t flags
Definition: filter.c:91
pw_memblock
Definition: mem.h:68
param
Definition: filter.c:76
PW_BUFFERS_FLAG_NO_MEM
#define PW_BUFFERS_FLAG_NO_MEM
don't allocate buffer memory
Definition: buffers.h:38
pw_buffers_negotiate
SPA_EXPORT int pw_buffers_negotiate(struct pw_context *context, uint32_t flags, struct spa_node *outnode, uint32_t out_port_id, struct spa_node *innode, uint32_t in_port_id, struct pw_buffers *result)
Definition: buffers.c:237
context.h
pw_buffers_clear
SPA_EXPORT void pw_buffers_clear(struct pw_buffers *buffers)
Definition: buffers.c:355
mem.h
pw_buffers::buffers
struct spa_buffer ** buffers
port buffers
Definition: buffers.h:44
port::buffers
struct buffer buffers[MAX_BUFFERS]
Definition: filter.c:103
port::direction
enum spa_direction direction
Definition: buffers.c:46