PipeWire: spa/node/io.h Source File

PipeWire 1.2.0

Loading...
Searching...
No Matches
io.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_IO_H
6#define SPA_IO_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
17#include <spa/utils/defs.h>
18#include <spa/pod/pod.h>
19
31enum spa_io_type {
32 SPA_IO_Invalid,
33 SPA_IO_Buffers,
34 SPA_IO_Range,
35 SPA_IO_Clock,
36 SPA_IO_Latency,
38 SPA_IO_Control,
39 SPA_IO_Notify,
40 SPA_IO_Position,
41 SPA_IO_RateMatch,
42 SPA_IO_Memory,
43 SPA_IO_AsyncBuffers,
44};
45
75struct spa_io_buffers {
76#define SPA_STATUS_OK 0
77#define SPA_STATUS_NEED_DATA (1<<0)
78#define SPA_STATUS_HAVE_DATA (1<<1)
79#define SPA_STATUS_STOPPED (1<<2)
80#define SPA_STATUS_DRAINED (1<<3)
81 int32_t status;
82 uint32_t buffer_id;
83};
84
85#define SPA_IO_BUFFERS_INIT ((struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, })
86
90 struct spa_io_memory {
91 int32_t status;
92 uint32_t size;
93 void *data;
94};
95#define SPA_IO_MEMORY_INIT ((struct spa_io_memory) { SPA_STATUS_OK, 0, NULL, })
96
98struct spa_io_range {
99 uint64_t offset;
100 uint32_t min_size;
101 uint32_t max_size;
102};
103
127struct spa_io_clock {
128#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0)
129 uint32_t flags;
130 uint32_t id;
131 char name[64];
134 uint64_t nsec;
137 struct spa_fraction rate;
138 uint64_t position;
139 uint64_t duration;
140 int64_t delay;
141 double rate_diff;
143 uint64_t next_nsec;
148 struct spa_fraction target_rate;
149 uint64_t target_duration;
150 uint32_t target_seq;
152 uint32_t cycle;
153 uint64_t xrun;
154};
155
156/* the size of the video in this cycle */
157struct spa_io_video_size {
158#define SPA_IO_VIDEO_SIZE_VALID (1<<0)
159 uint32_t flags;
160 uint32_t stride;
161 struct spa_rectangle size;
162 struct spa_fraction framerate;
165 uint32_t padding[4];
166};
167
173 struct spa_io_latency {
174 struct spa_fraction rate;
175 uint64_t min;
176 uint64_t max;
177};
178
180struct spa_io_sequence {
181 struct spa_pod_sequence sequence;
182};
183
185struct spa_io_segment_bar {
186#define SPA_IO_SEGMENT_BAR_FLAG_VALID (1<<0)
187 uint32_t flags;
188 uint32_t offset;
189 float signature_num;
190 float signature_denom;
191 double bpm;
192 double beat;
193 uint32_t padding[8];
194};
195
197struct spa_io_segment_video {
198#define SPA_IO_SEGMENT_VIDEO_FLAG_VALID (1<<0)
199#define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME (1<<1)
200#define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN (1<<2)
201#define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED (1<<3)
202 uint32_t flags;
203 uint32_t offset;
204 struct spa_fraction framerate;
205 uint32_t hours;
206 uint32_t minutes;
207 uint32_t seconds;
208 uint32_t frames;
209 uint32_t field_count;
210 uint32_t padding[11];
211};
212
233struct spa_io_segment {
234 uint32_t version;
235#define SPA_IO_SEGMENT_FLAG_LOOPING (1<<0)
236#define SPA_IO_SEGMENT_FLAG_NO_POSITION (1<<1)
240 uint32_t flags;
241 uint64_t start;
245 uint64_t duration;
250 double rate;
252 uint64_t position;
256 struct spa_io_segment_bar bar;
257 struct spa_io_segment_video video;
258};
259
260enum spa_io_position_state {
261 SPA_IO_POSITION_STATE_STOPPED,
262 SPA_IO_POSITION_STATE_STARTING,
263 SPA_IO_POSITION_STATE_RUNNING,
264};
265
267#define SPA_IO_POSITION_MAX_SEGMENTS 8
268
286struct spa_io_position {
287 struct spa_io_clock clock;
289 struct spa_io_video_size video;
290 int64_t offset;
295 uint32_t state;
297 uint32_t n_segments;
298 struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS];
299};
300
302struct spa_io_rate_match {
303 uint32_t delay;
304 uint32_t size;
305 double rate;
306#define SPA_IO_RATE_MATCH_FLAG_ACTIVE (1 << 0)
307 uint32_t flags;
308 uint32_t padding[7];
309};
310
312 struct spa_io_async_buffers {
313 struct spa_io_buffers buffers[2];
315};
316
321#ifdef __cplusplus
322} /* extern "C" */
323#endif
324
325#endif /* SPA_IO_H */
defs.h
spa/utils/defs.h
spa_io_position_state
spa_io_position_state
Definition io.h:281
spa_io_type
spa_io_type
IO areas.
Definition io.h:36
SPA_IO_POSITION_MAX_SEGMENTS
#define SPA_IO_POSITION_MAX_SEGMENTS
the maximum number of segments visible in the future
Definition io.h:289
SPA_IO_POSITION_STATE_RUNNING
@ SPA_IO_POSITION_STATE_RUNNING
Definition io.h:284
SPA_IO_POSITION_STATE_STOPPED
@ SPA_IO_POSITION_STATE_STOPPED
Definition io.h:282
SPA_IO_POSITION_STATE_STARTING
@ SPA_IO_POSITION_STATE_STARTING
Definition io.h:283
SPA_IO_AsyncBuffers
@ SPA_IO_AsyncBuffers
async area to exchange buffers, struct spa_io_async_buffers
Definition io.h:48
SPA_IO_Notify
@ SPA_IO_Notify
area for notify messages, struct spa_io_sequence
Definition io.h:44
SPA_IO_Memory
@ SPA_IO_Memory
memory pointer, struct spa_io_memory (currently not used in PipeWire)
Definition io.h:47
SPA_IO_Clock
@ SPA_IO_Clock
area to update clock information, struct spa_io_clock
Definition io.h:40
SPA_IO_Control
@ SPA_IO_Control
area for control messages, struct spa_io_sequence
Definition io.h:43
SPA_IO_Latency
@ SPA_IO_Latency
latency reporting, struct spa_io_latency (currently not used in PipeWire).
Definition io.h:41
SPA_IO_Range
@ SPA_IO_Range
expected byte range, struct spa_io_range (currently not used in PipeWire)
Definition io.h:39
SPA_IO_Invalid
@ SPA_IO_Invalid
Definition io.h:37
SPA_IO_Position
@ SPA_IO_Position
position information in the graph, struct spa_io_position
Definition io.h:45
SPA_IO_Buffers
@ SPA_IO_Buffers
area to exchange buffers, struct spa_io_buffers
Definition io.h:38
SPA_IO_RateMatch
@ SPA_IO_RateMatch
rate matching between nodes, struct spa_io_rate_match
Definition io.h:46
pod.h
spa/pod/pod.h
spa_fraction
Definition defs.h:137
spa_io_async_buffers
async buffers
Definition io.h:335
spa_io_async_buffers::buffers
struct spa_io_buffers buffers[2]
async buffers, writers write to current (cycle+1)&1, readers read from (cycle)&1
Definition io.h:336
spa_io_buffers
IO area to exchange buffers.
Definition io.h:80
spa_io_buffers::status
int32_t status
the status code
Definition io.h:91
spa_io_buffers::buffer_id
uint32_t buffer_id
a buffer id
Definition io.h:92
spa_io_clock
Absolute time reporting.
Definition io.h:139
spa_io_clock::target_rate
struct spa_fraction target_rate
Target rate of next cycle.
Definition io.h:161
spa_io_clock::next_nsec
uint64_t next_nsec
Estimated next wakeup time in nanoseconds.
Definition io.h:156
spa_io_clock::xrun
uint64_t xrun
Estimated accumulated xrun duration.
Definition io.h:166
spa_io_clock::position
uint64_t position
Current position, in samples @ rate.
Definition io.h:151
spa_io_clock::cycle
uint32_t cycle
incremented each time the graph is started
Definition io.h:165
spa_io_clock::nsec
uint64_t nsec
Time in nanoseconds against monotonic clock (CLOCK_MONOTONIC).
Definition io.h:147
spa_io_clock::rate
struct spa_fraction rate
Rate for position/duration/delay/xrun.
Definition io.h:150
spa_io_clock::rate_diff
double rate_diff
Rate difference between clock and monotonic time, as a ratio of clock speeds.
Definition io.h:154
spa_io_clock::flags
uint32_t flags
Clock flags.
Definition io.h:142
spa_io_clock::id
uint32_t id
Unique clock id, set by host application.
Definition io.h:143
spa_io_clock::target_duration
uint64_t target_duration
Target duration of next cycle.
Definition io.h:162
spa_io_clock::duration
uint64_t duration
Duration of current cycle, in samples @ rate.
Definition io.h:152
spa_io_clock::delay
int64_t delay
Delay between position and hardware, in samples @ rate.
Definition io.h:153
spa_io_clock::target_seq
uint32_t target_seq
Seq counter.
Definition io.h:163
spa_io_latency
Latency reporting.
Definition io.h:187
spa_io_latency::min
uint64_t min
min latency
Definition io.h:189
spa_io_latency::max
uint64_t max
max latency
Definition io.h:190
spa_io_latency::rate
struct spa_fraction rate
rate for min/max
Definition io.h:188
spa_io_memory
IO area to exchange a memory region.
Definition io.h:101
spa_io_memory::data
void * data
a memory pointer
Definition io.h:104
spa_io_memory::size
uint32_t size
the size of data
Definition io.h:103
spa_io_position
The position information adds extra meaning to the raw clock times.
Definition io.h:308
spa_io_position::clock
struct spa_io_clock clock
clock position of driver, always valid and read only
Definition io.h:309
spa_io_position::video
struct spa_io_video_size video
size of the video in the current cycle
Definition io.h:311
spa_io_position::state
uint32_t state
one of enum spa_io_position_state
Definition io.h:317
spa_io_position::n_segments
uint32_t n_segments
number of segments
Definition io.h:319
spa_io_position::segments
struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS]
segments
Definition io.h:320
spa_io_position::offset
int64_t offset
an offset to subtract from the clock position to get a running time.
Definition io.h:312
spa_io_range
A range, suitable for input ports that can suggest a range to output ports.
Definition io.h:110
spa_io_range::offset
uint64_t offset
offset in range
Definition io.h:111
spa_io_range::max_size
uint32_t max_size
maximum size of data
Definition io.h:113
spa_io_range::min_size
uint32_t min_size
minimum size of data
Definition io.h:112
spa_io_rate_match
rate matching
Definition io.h:324
spa_io_rate_match::padding
uint32_t padding[7]
Definition io.h:331
spa_io_rate_match::flags
uint32_t flags
extra flags
Definition io.h:330
spa_io_rate_match::rate
double rate
rate for resampler
Definition io.h:327
spa_io_rate_match::delay
uint32_t delay
extra delay in samples for resampler
Definition io.h:325
spa_io_rate_match::size
uint32_t size
requested input size for resampler
Definition io.h:326
spa_io_segment_bar
bar and beat segment
Definition io.h:199
spa_io_segment_bar::beat
double beat
current beat in segment
Definition io.h:207
spa_io_segment_bar::padding
uint32_t padding[8]
Definition io.h:208
spa_io_segment_bar::bpm
double bpm
beats per minute
Definition io.h:206
spa_io_segment_bar::signature_denom
float signature_denom
time signature denominator
Definition io.h:205
spa_io_segment_bar::offset
uint32_t offset
offset in segment of this beat
Definition io.h:203
spa_io_segment_bar::signature_num
float signature_num
time signature numerator
Definition io.h:204
spa_io_segment_bar::flags
uint32_t flags
extra flags
Definition io.h:202
spa_io_segment_video
video frame segment
Definition io.h:212
spa_io_segment_video::seconds
uint32_t seconds
Definition io.h:226
spa_io_segment_video::framerate
struct spa_fraction framerate
Definition io.h:223
spa_io_segment_video::field_count
uint32_t field_count
0 for progressive, 1 and 2 for interlaced
Definition io.h:228
spa_io_segment_video::hours
uint32_t hours
Definition io.h:224
spa_io_segment_video::minutes
uint32_t minutes
Definition io.h:225
spa_io_segment_video::padding
uint32_t padding[11]
Definition io.h:229
spa_io_segment_video::frames
uint32_t frames
Definition io.h:227
spa_io_segment
A segment converts a running time to a segment (stream) position.
Definition io.h:252
spa_io_segment::duration
uint64_t duration
duration when this info becomes invalid expressed in running time.
Definition io.h:266
spa_io_segment::flags
uint32_t flags
extra flags
Definition io.h:261
spa_io_segment::position
uint64_t position
The position when the running time == start.
Definition io.h:273
spa_io_segment::rate
double rate
overall rate of the segment, can be negative for backwards time reporting.
Definition io.h:271
spa_io_segment::video
struct spa_io_segment_video video
Definition io.h:278
spa_io_segment::bar
struct spa_io_segment_bar bar
Definition io.h:277
spa_io_segment::version
uint32_t version
Definition io.h:253
spa_io_sequence
control stream, io area for SPA_IO_Control and SPA_IO_Notify
Definition io.h:194
spa_io_sequence::sequence
struct spa_pod_sequence sequence
sequence of timed events
Definition io.h:195
spa_io_video_size
Definition io.h:170
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:176
spa_io_video_size::padding
uint32_t padding[4]
Definition io.h:179
spa_io_video_size::stride
uint32_t stride
video stride in bytes
Definition io.h:174
spa_io_video_size::flags
uint32_t flags
optional flags
Definition io.h:173
spa_io_video_size::size
struct spa_rectangle size
the video size
Definition io.h:175
spa_pod_sequence
a sequence of timed controls
Definition pod.h:248
spa_rectangle
Definition defs.h:116