io: add support for segment

Move fields from the io_position to io_segment. The segment contains
the mapping between raw clock time and stream time in various
formats. We keep an array of pending segments available in the
io_position field so clients can anticipate changes.

Make looping a flag in the segment instead of a state.

Prepare for segment masters. These will be registered clients that
are responsible for updating parts of the extended segment info.

Add namespace to some defines.
This commit is contained in:
Wim Taymans 2019-08-27 21:36:15 +02:00
parent b356c83d32
commit 7c865f5db0
7 changed files with 137 additions and 80 deletions

View file

@ -349,10 +349,10 @@ struct pw_node_target {
};
struct pw_node_activation {
#define NOT_TRIGGERED 0
#define TRIGGERED 1
#define AWAKE 2
#define FINISHED 3
#define PW_NODE_ACTIVATION_NOT_TRIGGERED 0
#define PW_NODE_ACTIVATION_TRIGGERED 1
#define PW_NODE_ACTIVATION_AWAKE 2
#define PW_NODE_ACTIVATION_FINISHED 3
int status;
uint64_t signal_time;
@ -361,21 +361,32 @@ struct pw_node_activation {
uint64_t prev_signal_time;
struct spa_io_position position;
uint32_t segment_master[32]; /* unique id (client id usually) of client
* that will update extra segment info, There
* can be one master for each segment
* bitfield */
uint32_t version;
struct pw_node_activation_state state[2]; /* one current state and one next state,
* as low bit of version in position */
* as low bit of version */
float cpu_load[3]; /* averaged over short, medium, long time */
uint32_t xrun_count; /* number of xruns */
uint64_t xrun_time; /* time of last xrun in microseconds */
uint64_t xrun_delay; /* delay of last xrun in microseconds */
uint64_t max_delay; /* max of all xruns in microseconds */
struct {
uint32_t seq;
#define UPDATE_STATE (1<<0)
#define UPDATE_POSITION (1<<1)
#define PW_NODE_ACTIVATION_UPDATE_STATE (1<<0)
#define PW_NODE_ACTIVATION_UPDATE_SEGMENT (1<<1)
#define PW_NODE_ACTIVATION_UPDATE_REPOSITION (1<<2)
uint32_t change_mask;
enum spa_io_position_state state;
struct spa_io_position position;
struct spa_io_segment segment; /* update for the extra segment info
* fields. When REPOSITION update, the segment
* position field will contain the desired
* new position. */
} pending;
};