PipeWire: spa/node/io.h Source File

PipeWire 0.3.51

io.h
Go to the documentation of this file.
1/* Simple Plugin API
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 SPA_IO_H
26#define SPA_IO_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
37#include <spa/utils/defs.h>
38#include <spa/pod/pod.h>
39
51enum spa_io_type {
52 SPA_IO_Invalid,
53 SPA_IO_Buffers,
54 SPA_IO_Range,
55 SPA_IO_Clock,
56 SPA_IO_Latency,
57 SPA_IO_Control,
58 SPA_IO_Notify,
59 SPA_IO_Position,
60 SPA_IO_RateMatch,
61 SPA_IO_Memory,
62};
63
93struct spa_io_buffers {
94#define SPA_STATUS_OK 0
95#define SPA_STATUS_NEED_DATA (1<<0)
96#define SPA_STATUS_HAVE_DATA (1<<1)
97#define SPA_STATUS_STOPPED (1<<2)
98#define SPA_STATUS_DRAINED (1<<3)
99 int32_t status;
100 uint32_t buffer_id;
101};
102
103#define SPA_IO_BUFFERS_INIT (struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, }
104
108 struct spa_io_memory {
109 int32_t status;
110 uint32_t size;
111 void *data;
112};
113#define SPA_IO_MEMORY_INIT (struct spa_io_memory) { SPA_STATUS_OK, 0, NULL, }
114
116struct spa_io_range {
117 uint64_t offset;
118 uint32_t min_size;
119 uint32_t max_size;
120};
121
132struct spa_io_clock {
133#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0)
134 uint32_t flags;
135 uint32_t id;
136 char name[64];
139 uint64_t nsec;
140 struct spa_fraction rate;
141 uint64_t position;
142 uint64_t duration;
143 int64_t delay;
145 double rate_diff;
146 uint64_t next_nsec;
147 uint32_t padding[8];
148};
149
150/* the size of the video in this cycle */
151struct spa_io_video_size {
152#define SPA_IO_VIDEO_SIZE_VALID (1<<0)
153 uint32_t flags;
154 uint32_t stride;
155 struct spa_rectangle size;
156 struct spa_fraction framerate;
159 uint32_t padding[4];
160};
161
163struct spa_io_latency {
164 struct spa_fraction rate;
165 uint64_t min;
166 uint64_t max;
167};
168
170 struct spa_io_sequence {
171 struct spa_pod_sequence sequence;
172};
173
175struct spa_io_segment_bar {
176#define SPA_IO_SEGMENT_BAR_FLAG_VALID (1<<0)
177 uint32_t flags;
178 uint32_t offset;
179 float signature_num;
180 float signature_denom;
181 double bpm;
182 double beat;
183 uint32_t padding[8];
184};
185
187struct spa_io_segment_video {
188#define SPA_IO_SEGMENT_VIDEO_FLAG_VALID (1<<0)
189#define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME (1<<1)
190#define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN (1<<2)
191#define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED (1<<3)
192 uint32_t flags;
193 uint32_t offset;
194 struct spa_fraction framerate;
195 uint32_t hours;
196 uint32_t minutes;
197 uint32_t seconds;
198 uint32_t frames;
199 uint32_t field_count;
200 uint32_t padding[11];
201};
202
223struct spa_io_segment {
224 uint32_t version;
225#define SPA_IO_SEGMENT_FLAG_LOOPING (1<<0)
226#define SPA_IO_SEGMENT_FLAG_NO_POSITION (1<<1)
230 uint32_t flags;
231 uint64_t start;
235 uint64_t duration;
240 double rate;
242 uint64_t position;
246 struct spa_io_segment_bar bar;
247 struct spa_io_segment_video video;
248};
249
250 enum spa_io_position_state {
251 SPA_IO_POSITION_STATE_STOPPED,
252 SPA_IO_POSITION_STATE_STARTING,
253 SPA_IO_POSITION_STATE_RUNNING,
254};
255
257#define SPA_IO_POSITION_MAX_SEGMENTS 8
258
271 struct spa_io_position {
272 struct spa_io_clock clock;
274 struct spa_io_video_size video;
275 int64_t offset;
280 uint32_t state;
282 uint32_t n_segments;
283 struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS];
284};
285
287struct spa_io_rate_match {
288 uint32_t delay;
289 uint32_t size;
290 double rate;
291#define SPA_IO_RATE_MATCH_FLAG_ACTIVE (1 << 0)
292 uint32_t flags;
293 uint32_t padding[7];
294};
295
300#ifdef __cplusplus
301} /* extern "C" */
302#endif
303
304#endif /* SPA_IO_H */
defs.h
spa/utils/defs.h
spa_io_position_state
spa_io_position_state
Definition: io.h:271
spa_io_type
spa_io_type
IO areas.
Definition: io.h:56
SPA_IO_POSITION_MAX_SEGMENTS
#define SPA_IO_POSITION_MAX_SEGMENTS
the maximum number of segments visible in the future
Definition: io.h:279
SPA_IO_POSITION_STATE_RUNNING
@ SPA_IO_POSITION_STATE_RUNNING
Definition: io.h:274
SPA_IO_POSITION_STATE_STOPPED
@ SPA_IO_POSITION_STATE_STOPPED
Definition: io.h:272
SPA_IO_POSITION_STATE_STARTING
@ SPA_IO_POSITION_STATE_STARTING
Definition: io.h:273
SPA_IO_Notify
@ SPA_IO_Notify
area for notify messages, struct spa_io_sequence
Definition: io.h:63
SPA_IO_Memory
@ SPA_IO_Memory
memory pointer, struct spa_io_memory
Definition: io.h:66
SPA_IO_Clock
@ SPA_IO_Clock
area to update clock information, struct spa_io_clock
Definition: io.h:60
SPA_IO_Control
@ SPA_IO_Control
area for control messages, struct spa_io_sequence
Definition: io.h:62
SPA_IO_Latency
@ SPA_IO_Latency
latency reporting, struct spa_io_latency
Definition: io.h:61
SPA_IO_Range
@ SPA_IO_Range
expected byte range, struct spa_io_range
Definition: io.h:59
SPA_IO_Invalid
@ SPA_IO_Invalid
Definition: io.h:57
SPA_IO_Position
@ SPA_IO_Position
position information in the graph, struct spa_io_position
Definition: io.h:64
SPA_IO_Buffers
@ SPA_IO_Buffers
area to exchange buffers, struct spa_io_buffers
Definition: io.h:58
SPA_IO_RateMatch
@ SPA_IO_RateMatch
rate matching between nodes, struct spa_io_rate_match
Definition: io.h:65
pod.h
spa/pod/pod.h
spa_fraction
Definition: defs.h:121
spa_io_buffers
IO area to exchange buffers.
Definition: io.h:98
spa_io_buffers::status
int32_t status
the status code
Definition: io.h:109
spa_io_buffers::buffer_id
uint32_t buffer_id
a buffer id
Definition: io.h:110
spa_io_clock
Absolute time reporting.
Definition: io.h:144
spa_io_clock::next_nsec
uint64_t next_nsec
estimated next wakeup time in nanoseconds
Definition: io.h:159
spa_io_clock::position
uint64_t position
current position
Definition: io.h:154
spa_io_clock::nsec
uint64_t nsec
time in nanoseconds against monotonic clock
Definition: io.h:152
spa_io_clock::rate
struct spa_fraction rate
rate for position/duration/delay
Definition: io.h:153
spa_io_clock::rate_diff
double rate_diff
rate difference between clock and monotonic time
Definition: io.h:158
spa_io_clock::flags
uint32_t flags
clock flags
Definition: io.h:147
spa_io_clock::id
uint32_t id
unique clock id, set by application
Definition: io.h:148
spa_io_clock::duration
uint64_t duration
duration of current cycle
Definition: io.h:155
spa_io_clock::padding
uint32_t padding[8]
Definition: io.h:160
spa_io_clock::delay
int64_t delay
delay between position and hardware, positive for capture, negative for playback
Definition: io.h:156
spa_io_latency
latency reporting
Definition: io.h:177
spa_io_latency::min
uint64_t min
min latency
Definition: io.h:179
spa_io_latency::max
uint64_t max
max latency
Definition: io.h:180
spa_io_latency::rate
struct spa_fraction rate
rate for min/max
Definition: io.h:178
spa_io_memory
IO area to exchange a memory region.
Definition: io.h:119
spa_io_memory::data
void * data
a memory pointer
Definition: io.h:122
spa_io_memory::size
uint32_t size
the size of data
Definition: io.h:121
spa_io_position
The position information adds extra meaning to the raw clock times.
Definition: io.h:293
spa_io_position::clock
struct spa_io_clock clock
clock position of driver, always valid and read only
Definition: io.h:294
spa_io_position::video
struct spa_io_video_size video
size of the video in the current cycle
Definition: io.h:296
spa_io_position::state
uint32_t state
one of enum spa_io_position_state
Definition: io.h:302
spa_io_position::n_segments
uint32_t n_segments
number of segments
Definition: io.h:304
spa_io_position::segments
struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS]
segments
Definition: io.h:305
spa_io_position::offset
int64_t offset
an offset to subtract from the clock position to get a running time.
Definition: io.h:297
spa_io_range
A range, suitable for input ports that can suggest a range to output ports.
Definition: io.h:128
spa_io_range::offset
uint64_t offset
offset in range
Definition: io.h:129
spa_io_range::max_size
uint32_t max_size
maximum size of data
Definition: io.h:131
spa_io_range::min_size
uint32_t min_size
minimum size of data
Definition: io.h:130
spa_io_rate_match
rate matching
Definition: io.h:309
spa_io_rate_match::padding
uint32_t padding[7]
Definition: io.h:316
spa_io_rate_match::flags
uint32_t flags
extra flags
Definition: io.h:315
spa_io_rate_match::rate
double rate
rate for resampler
Definition: io.h:312
spa_io_rate_match::delay
uint32_t delay
extra delay in samples for resampler
Definition: io.h:310
spa_io_rate_match::size
uint32_t size
requested input size for resampler
Definition: io.h:311
spa_io_segment_bar
bar and beat segment
Definition: io.h:189
spa_io_segment_bar::beat
double beat
current beat in segment
Definition: io.h:197
spa_io_segment_bar::padding
uint32_t padding[8]
Definition: io.h:198
spa_io_segment_bar::bpm
double bpm
beats per minute
Definition: io.h:196
spa_io_segment_bar::signature_denom
float signature_denom
time signature denominator
Definition: io.h:195
spa_io_segment_bar::offset
uint32_t offset
offset in segment of this beat
Definition: io.h:193
spa_io_segment_bar::signature_num
float signature_num
time signature numerator
Definition: io.h:194
spa_io_segment_bar::flags
uint32_t flags
extra flags
Definition: io.h:192
spa_io_segment_video
video frame segment
Definition: io.h:202
spa_io_segment_video::seconds
uint32_t seconds
Definition: io.h:216
spa_io_segment_video::framerate
struct spa_fraction framerate
Definition: io.h:213
spa_io_segment_video::field_count
uint32_t field_count
0 for progressive, 1 and 2 for interlaced
Definition: io.h:218
spa_io_segment_video::hours
uint32_t hours
Definition: io.h:214
spa_io_segment_video::minutes
uint32_t minutes
Definition: io.h:215
spa_io_segment_video::padding
uint32_t padding[11]
Definition: io.h:219
spa_io_segment_video::frames
uint32_t frames
Definition: io.h:217
spa_io_segment
A segment converts a running time to a segment (stream) position.
Definition: io.h:242
spa_io_segment::duration
uint64_t duration
duration when this info becomes invalid expressed in running time.
Definition: io.h:256
spa_io_segment::flags
uint32_t flags
extra flags
Definition: io.h:251
spa_io_segment::position
uint64_t position
The position when the running time == start.
Definition: io.h:263
spa_io_segment::rate
double rate
overall rate of the segment, can be negative for backwards time reporting.
Definition: io.h:261
spa_io_segment::video
struct spa_io_segment_video video
Definition: io.h:268
spa_io_segment::bar
struct spa_io_segment_bar bar
Definition: io.h:267
spa_io_segment::version
uint32_t version
Definition: io.h:243
spa_io_sequence
control stream, io area for SPA_IO_Control and SPA_IO_Notify
Definition: io.h:184
spa_io_sequence::sequence
struct spa_pod_sequence sequence
sequence of timed events
Definition: io.h:185
spa_io_video_size
Definition: io.h:164
spa_io_video_size::framerate
struct spa_fraction framerate
the minimum framerate, the cycle duration is always smaller to ensure there is only one video frame p...
Definition: io.h:170
spa_io_video_size::padding
uint32_t padding[4]
Definition: io.h:173
spa_io_video_size::stride
uint32_t stride
video stride in bytes
Definition: io.h:168
spa_io_video_size::flags
uint32_t flags
optional flags
Definition: io.h:167
spa_io_video_size::size
struct spa_rectangle size
the video size
Definition: io.h:169
spa_pod_sequence
a sequence of timed controls
Definition: pod.h:268
spa_rectangle
Definition: defs.h:100