PipeWire 1.2.7
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 {
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};
85#define SPA_IO_BUFFERS_INIT ((struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, })
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, })
98struct spa_io_range {
99 uint64_t offset;
100 uint32_t min_size;
101 uint32_t max_size;
127struct spa_io_clock {
128#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0) /* graph is freewheeling */
129#define SPA_IO_CLOCK_FLAG_XRUN_RECOVER (1u<<1) /* recovering from xrun */
130#define SPA_IO_CLOCK_FLAG_LAZY (1u<<2) /* lazy scheduling */
131 uint32_t flags;
132 uint32_t id;
133 char name[64];
136 uint64_t nsec;
140 uint64_t position;
141 uint64_t duration;
142 int64_t delay;
143 double rate_diff;
145 uint64_t next_nsec;
152 uint32_t target_seq;
154 uint32_t cycle;
155 uint64_t xrun;
158/* the size of the video in this cycle */
159struct spa_io_video_size {
160#define SPA_IO_VIDEO_SIZE_VALID (1<<0)
161 uint32_t flags;
162 uint32_t stride;
163 struct spa_rectangle size;
164 struct spa_fraction framerate;
167 uint32_t padding[4];
168};
175struct spa_io_latency {
177 uint64_t min;
178 uint64_t max;
182struct spa_io_sequence {
184};
185
187struct spa_io_segment_bar {
188#define SPA_IO_SEGMENT_BAR_FLAG_VALID (1<<0)
189 uint32_t flags;
190 uint32_t offset;
193 double bpm;
194 double beat;
195 double bar_start_tick;
196 double ticks_per_beat;
197 uint32_t padding[4];
202#define SPA_IO_SEGMENT_VIDEO_FLAG_VALID (1<<0)
203#define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME (1<<1)
204#define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN (1<<2)
205#define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED (1<<3)
206 uint32_t flags;
207 uint32_t offset;
209 uint32_t hours;
210 uint32_t minutes;
211 uint32_t seconds;
212 uint32_t frames;
213 uint32_t field_count;
214 uint32_t padding[11];
215};
216
237struct spa_io_segment {
238 uint32_t version;
239#define SPA_IO_SEGMENT_FLAG_LOOPING (1<<0)
240#define SPA_IO_SEGMENT_FLAG_NO_POSITION (1<<1)
244 uint32_t flags;
245 uint64_t start;
249 uint64_t duration;
254 double rate;
256 uint64_t position;
260 struct spa_io_segment_bar bar;
262};
268};
269
271#define SPA_IO_POSITION_MAX_SEGMENTS 8
291 struct spa_io_clock clock;
293 struct spa_io_video_size video;
294 int64_t offset;
299 uint32_t state;
301 uint32_t n_segments;
303};
304
306struct spa_io_rate_match {
307 uint32_t delay;
308 uint32_t size;
309 double rate;
310#define SPA_IO_RATE_MATCH_FLAG_ACTIVE (1 << 0)
311 uint32_t flags;
312 uint32_t padding[7];
313};
319};
320
325#ifdef __cplusplus
326} /* extern "C" */
327#endif
328
329#endif /* SPA_IO_H */
spa/utils/defs.h
spa_io_position_state
Definition io.h:287
spa_io_type
IO areas.
Definition io.h:36
#define SPA_IO_POSITION_MAX_SEGMENTS
the maximum number of segments visible in the future
Definition io.h:295
@ SPA_IO_POSITION_STATE_RUNNING
Definition io.h:290
@ SPA_IO_POSITION_STATE_STOPPED
Definition io.h:288
@ SPA_IO_POSITION_STATE_STARTING
Definition io.h:289
@ SPA_IO_AsyncBuffers
async area to exchange buffers, struct spa_io_async_buffers
Definition io.h:48
@ SPA_IO_Notify
area for notify messages, struct spa_io_sequence
Definition io.h:44
@ SPA_IO_Memory
memory pointer, struct spa_io_memory (currently not used in PipeWire)
Definition io.h:47
@ SPA_IO_Clock
area to update clock information, struct spa_io_clock
Definition io.h:40
@ SPA_IO_Control
area for control messages, struct spa_io_sequence
Definition io.h:43
@ SPA_IO_Latency
latency reporting, struct spa_io_latency (currently not used in PipeWire).
Definition io.h:41
@ SPA_IO_Range
expected byte range, struct spa_io_range (currently not used in PipeWire)
Definition io.h:39
@ SPA_IO_Invalid
Definition io.h:37
@ SPA_IO_Position
position information in the graph, struct spa_io_position
Definition io.h:45
@ SPA_IO_Buffers
area to exchange buffers, struct spa_io_buffers
Definition io.h:38
@ SPA_IO_RateMatch
rate matching between nodes, struct spa_io_rate_match
Definition io.h:46
spa/pod/pod.h
Definition defs.h:137
async buffers
Definition io.h:341
struct spa_io_buffers buffers[2]
async buffers, writers write to current (cycle+1)&1, readers read from (cycle)&1
Definition io.h:342
IO area to exchange buffers.
Definition io.h:80
int32_t status
the status code
Definition io.h:91
uint32_t buffer_id
a buffer id
Definition io.h:92
Absolute time reporting.
Definition io.h:139
struct spa_fraction target_rate
Target rate of next cycle.
Definition io.h:165
uint64_t next_nsec
Estimated next wakeup time in nanoseconds.
Definition io.h:160
uint64_t xrun
Estimated accumulated xrun duration.
Definition io.h:170
uint64_t position
Current position, in samples @ rate.
Definition io.h:155
uint32_t cycle
incremented each time the graph is started
Definition io.h:169
uint64_t nsec
Time in nanoseconds against monotonic clock (CLOCK_MONOTONIC).
Definition io.h:151
struct spa_fraction rate
Rate for position/duration/delay/xrun.
Definition io.h:154
double rate_diff
Rate difference between clock and monotonic time, as a ratio of clock speeds.
Definition io.h:158
uint32_t flags
Clock flags.
Definition io.h:146
uint32_t id
Unique clock id, set by host application.
Definition io.h:147
uint64_t target_duration
Target duration of next cycle.
Definition io.h:166
uint64_t duration
Duration of current cycle, in samples @ rate.
Definition io.h:156
int64_t delay
Delay between position and hardware, in samples @ rate.
Definition io.h:157
uint32_t target_seq
Seq counter.
Definition io.h:167
Latency reporting.
Definition io.h:191
uint64_t min
min latency
Definition io.h:193
uint64_t max
max latency
Definition io.h:194
struct spa_fraction rate
rate for min/max
Definition io.h:192
IO area to exchange a memory region.
Definition io.h:101
void * data
a memory pointer
Definition io.h:104
uint32_t size
the size of data
Definition io.h:103
The position information adds extra meaning to the raw clock times.
Definition io.h:314
struct spa_io_clock clock
clock position of driver, always valid and read only
Definition io.h:315
struct spa_io_video_size video
size of the video in the current cycle
Definition io.h:317
uint32_t state
one of enum spa_io_position_state
Definition io.h:323
uint32_t n_segments
number of segments
Definition io.h:325
struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS]
segments
Definition io.h:326
int64_t offset
an offset to subtract from the clock position to get a running time.
Definition io.h:318
A range, suitable for input ports that can suggest a range to output ports.
Definition io.h:110
uint64_t offset
offset in range
Definition io.h:111
uint32_t max_size
maximum size of data
Definition io.h:113
uint32_t min_size
minimum size of data
Definition io.h:112
rate matching
Definition io.h:330
uint32_t padding[7]
Definition io.h:337
uint32_t flags
extra flags
Definition io.h:336
double rate
rate for resampler
Definition io.h:333
uint32_t delay
extra delay in samples for resampler
Definition io.h:331
uint32_t size
requested input size for resampler
Definition io.h:332
bar and beat segment
Definition io.h:203
double beat
current beat in segment
Definition io.h:211
uint32_t padding[4]
Definition io.h:214
double bpm
beats per minute
Definition io.h:210
float signature_denom
time signature denominator
Definition io.h:209
double ticks_per_beat
Definition io.h:213
double bar_start_tick
Definition io.h:212
uint32_t offset
offset in segment of this beat
Definition io.h:207
float signature_num
time signature numerator
Definition io.h:208
uint32_t flags
extra flags
Definition io.h:206
video frame segment
Definition io.h:218
uint32_t seconds
Definition io.h:232
struct spa_fraction framerate
Definition io.h:229
uint32_t field_count
0 for progressive, 1 and 2 for interlaced
Definition io.h:234
uint32_t hours
Definition io.h:230
uint32_t minutes
Definition io.h:231
uint32_t padding[11]
Definition io.h:235
uint32_t frames
Definition io.h:233
A segment converts a running time to a segment (stream) position.
Definition io.h:258
uint64_t duration
duration when this info becomes invalid expressed in running time.
Definition io.h:272
uint32_t flags
extra flags
Definition io.h:267
uint64_t position
The position when the running time == start.
Definition io.h:279
double rate
overall rate of the segment, can be negative for backwards time reporting.
Definition io.h:277
struct spa_io_segment_video video
Definition io.h:284
struct spa_io_segment_bar bar
Definition io.h:283
uint32_t version
Definition io.h:259
control stream, io area for SPA_IO_Control and SPA_IO_Notify
Definition io.h:198
struct spa_pod_sequence sequence
sequence of timed events
Definition io.h:199
Definition io.h:174
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:180
uint32_t padding[4]
Definition io.h:183
uint32_t stride
video stride in bytes
Definition io.h:178
uint32_t flags
optional flags
Definition io.h:177
struct spa_rectangle size
the video size
Definition io.h:179
a sequence of timed controls
Definition pod.h:248
Definition defs.h:116