PipeWire  0.3.66
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
9 extern "C" {
10 #endif
11 
17 #include <spa/utils/defs.h>
18 #include <spa/pod/pod.h>
19 
31 enum spa_io_type {
34  SPA_IO_Range,
35  SPA_IO_Clock,
42 };
43 
73 struct spa_io_buffers {
74 #define SPA_STATUS_OK 0
75 #define SPA_STATUS_NEED_DATA (1<<0)
76 #define SPA_STATUS_HAVE_DATA (1<<1)
77 #define SPA_STATUS_STOPPED (1<<2)
78 #define SPA_STATUS_DRAINED (1<<3)
79  int32_t status;
80  uint32_t buffer_id;
81 };
82 
83 #define SPA_IO_BUFFERS_INIT ((struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, })
84 
88 struct spa_io_memory {
89  int32_t status;
90  uint32_t size;
91  void *data;
92 };
93 #define SPA_IO_MEMORY_INIT ((struct spa_io_memory) { SPA_STATUS_OK, 0, NULL, })
94 
96 struct spa_io_range {
97  uint64_t offset;
98  uint32_t min_size;
99  uint32_t max_size;
100 };
101 
112 struct spa_io_clock {
113 #define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0)
114  uint32_t flags;
115  uint32_t id;
116  char name[64];
119  uint64_t nsec;
120  struct spa_fraction rate;
121  uint64_t position;
122  uint64_t duration;
123  int64_t delay;
125  double rate_diff;
126  uint64_t next_nsec;
127  uint32_t padding[8];
128 };
129 
130 /* the size of the video in this cycle */
131 struct spa_io_video_size {
132 #define SPA_IO_VIDEO_SIZE_VALID (1<<0)
133  uint32_t flags;
134  uint32_t stride;
139  uint32_t padding[4];
140 };
141 
143 struct spa_io_latency {
145  uint64_t min;
146  uint64_t max;
147 };
148 
150 struct spa_io_sequence {
151  struct spa_pod_sequence sequence;
152 };
153 
155 struct spa_io_segment_bar {
156 #define SPA_IO_SEGMENT_BAR_FLAG_VALID (1<<0)
157  uint32_t flags;
158  uint32_t offset;
161  double bpm;
162  double beat;
163  uint32_t padding[8];
164 };
165 
167 struct spa_io_segment_video {
168 #define SPA_IO_SEGMENT_VIDEO_FLAG_VALID (1<<0)
169 #define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME (1<<1)
170 #define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN (1<<2)
171 #define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED (1<<3)
172  uint32_t flags;
173  uint32_t offset;
175  uint32_t hours;
176  uint32_t minutes;
177  uint32_t seconds;
178  uint32_t frames;
179  uint32_t field_count;
180  uint32_t padding[11];
181 };
182 
203 struct spa_io_segment {
204  uint32_t version;
205 #define SPA_IO_SEGMENT_FLAG_LOOPING (1<<0)
206 #define SPA_IO_SEGMENT_FLAG_NO_POSITION (1<<1)
210  uint32_t flags;
211  uint64_t start;
215  uint64_t duration;
220  double rate;
222  uint64_t position;
226  struct spa_io_segment_bar bar;
228 };
229 
234 };
235 
237 #define SPA_IO_POSITION_MAX_SEGMENTS 8
238 
255  int64_t offset;
260  uint32_t state;
262  uint32_t n_segments;
264 };
265 
267 struct spa_io_rate_match {
268  uint32_t delay;
269  uint32_t size;
270  double rate;
271 #define SPA_IO_RATE_MATCH_FLAG_ACTIVE (1 << 0)
272  uint32_t flags;
273  uint32_t padding[7];
274 };
275 
280 #ifdef __cplusplus
281 } /* extern "C" */
282 #endif
283 
284 #endif /* SPA_IO_H */
spa/utils/defs.h
spa_io_position_state
Definition: io.h:251
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:259
@ SPA_IO_POSITION_STATE_RUNNING
Definition: io.h:254
@ SPA_IO_POSITION_STATE_STOPPED
Definition: io.h:252
@ SPA_IO_POSITION_STATE_STARTING
Definition: io.h:253
@ SPA_IO_Notify
area for notify messages, struct spa_io_sequence
Definition: io.h:43
@ SPA_IO_Memory
memory pointer, struct spa_io_memory
Definition: io.h:46
@ 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:42
@ SPA_IO_Latency
latency reporting, struct spa_io_latency
Definition: io.h:41
@ SPA_IO_Range
expected byte range, struct spa_io_range
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:44
@ 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:45
spa/pod/pod.h
Definition: defs.h:119
IO area to exchange buffers.
Definition: io.h:78
int32_t status
the status code
Definition: io.h:89
uint32_t buffer_id
a buffer id
Definition: io.h:90
Absolute time reporting.
Definition: io.h:124
uint64_t next_nsec
estimated next wakeup time in nanoseconds
Definition: io.h:139
uint64_t position
current position
Definition: io.h:134
uint64_t nsec
time in nanoseconds against monotonic clock
Definition: io.h:132
struct spa_fraction rate
rate for position/duration/delay
Definition: io.h:133
double rate_diff
rate difference between clock and monotonic time
Definition: io.h:138
uint32_t flags
clock flags
Definition: io.h:127
uint32_t id
unique clock id, set by application
Definition: io.h:128
uint64_t duration
duration of current cycle
Definition: io.h:135
uint32_t padding[8]
Definition: io.h:140
int64_t delay
delay between position and hardware, positive for capture, negative for playback
Definition: io.h:136
latency reporting
Definition: io.h:157
uint64_t min
min latency
Definition: io.h:159
uint64_t max
max latency
Definition: io.h:160
struct spa_fraction rate
rate for min/max
Definition: io.h:158
IO area to exchange a memory region.
Definition: io.h:99
void * data
a memory pointer
Definition: io.h:102
uint32_t size
the size of data
Definition: io.h:101
The position information adds extra meaning to the raw clock times.
Definition: io.h:273
struct spa_io_clock clock
clock position of driver, always valid and read only
Definition: io.h:274
struct spa_io_video_size video
size of the video in the current cycle
Definition: io.h:276
uint32_t state
one of enum spa_io_position_state
Definition: io.h:282
uint32_t n_segments
number of segments
Definition: io.h:284
struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS]
segments
Definition: io.h:285
int64_t offset
an offset to subtract from the clock position to get a running time.
Definition: io.h:277
A range, suitable for input ports that can suggest a range to output ports.
Definition: io.h:108
uint64_t offset
offset in range
Definition: io.h:109
uint32_t max_size
maximum size of data
Definition: io.h:111
uint32_t min_size
minimum size of data
Definition: io.h:110
rate matching
Definition: io.h:289
uint32_t padding[7]
Definition: io.h:296
uint32_t flags
extra flags
Definition: io.h:295
double rate
rate for resampler
Definition: io.h:292
uint32_t delay
extra delay in samples for resampler
Definition: io.h:290
uint32_t size
requested input size for resampler
Definition: io.h:291
bar and beat segment
Definition: io.h:169
double beat
current beat in segment
Definition: io.h:177
uint32_t padding[8]
Definition: io.h:178
double bpm
beats per minute
Definition: io.h:176
float signature_denom
time signature denominator
Definition: io.h:175
uint32_t offset
offset in segment of this beat
Definition: io.h:173
float signature_num
time signature numerator
Definition: io.h:174
uint32_t flags
extra flags
Definition: io.h:172
video frame segment
Definition: io.h:182
uint32_t seconds
Definition: io.h:196
struct spa_fraction framerate
Definition: io.h:193
uint32_t field_count
0 for progressive, 1 and 2 for interlaced
Definition: io.h:198
uint32_t hours
Definition: io.h:194
uint32_t minutes
Definition: io.h:195
uint32_t padding[11]
Definition: io.h:199
uint32_t frames
Definition: io.h:197
A segment converts a running time to a segment (stream) position.
Definition: io.h:222
uint64_t duration
duration when this info becomes invalid expressed in running time.
Definition: io.h:236
uint32_t flags
extra flags
Definition: io.h:231
uint64_t position
The position when the running time == start.
Definition: io.h:243
double rate
overall rate of the segment, can be negative for backwards time reporting.
Definition: io.h:241
struct spa_io_segment_video video
Definition: io.h:248
struct spa_io_segment_bar bar
Definition: io.h:247
uint32_t version
Definition: io.h:223
control stream, io area for SPA_IO_Control and SPA_IO_Notify
Definition: io.h:164
struct spa_pod_sequence sequence
sequence of timed events
Definition: io.h:165
Definition: io.h:144
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:150
uint32_t padding[4]
Definition: io.h:153
uint32_t stride
video stride in bytes
Definition: io.h:148
uint32_t flags
optional flags
Definition: io.h:147
struct spa_rectangle size
the video size
Definition: io.h:149
a sequence of timed controls
Definition: pod/pod.h:248
Definition: defs.h:98