diff --git a/spa/include/spa/node/io.h b/spa/include/spa/node/io.h index 49d7e8af0..bc780f882 100644 --- a/spa/include/spa/node/io.h +++ b/spa/include/spa/node/io.h @@ -127,10 +127,6 @@ struct spa_io_clock { * is unique per clock and can be used to check if nodes * share the same clock. */ uint64_t nsec; /**< time in nanoseconds against monotonic clock */ - uint64_t count; /**< a media specific counter. Can be used to detect - * gaps in the media. It usually represents the amount - * of processed media units (packets, frames, - * samples, ...) */ struct spa_fraction rate; /**< rate for position/duration/delay */ uint64_t position; /**< current position */ uint64_t duration; /**< duration of current cycle */ @@ -138,6 +134,19 @@ struct spa_io_clock { * positive for capture, negative for playback */ double rate_diff; /**< rate difference between clock and monotonic time */ uint64_t next_nsec; /**< extimated next wakup time in nanoseconds */ + uint32_t padding[8]; +}; + +/* the size of the video in this cycle */ +struct spa_io_video_size { +#define SPA_IO_VIDEO_SIZE_VALID (1<<0) + uint32_t flags; /**< optional flags */ + uint32_t stride; /**< video stride in bytes */ + struct spa_rectangle size; /**< the video size */ + struct spa_fraction framerate; /**< the minimum framerate, the cycle duration is + * always smaller to ensure there is only one + * video frame per cycle. */ + uint32_t padding[4]; }; /** latency reporting */ @@ -161,7 +170,7 @@ struct spa_io_segment_bar { float signature_denom; /**< time signature denominator */ double bpm; /**< beats per minute */ double beat; /**< current beat in segment */ - uint32_t padding[16]; + uint32_t padding[8]; }; /** video frame segment */ @@ -178,7 +187,7 @@ struct spa_io_segment_video { uint32_t seconds; uint32_t frames; uint32_t field_count; /**< 0 for progressive, 1 and 2 for interlaced */ - uint32_t padding[15]; + uint32_t padding[11]; }; /** @@ -252,6 +261,7 @@ enum spa_io_position_state { struct spa_io_position { struct spa_io_clock clock; /**< clock position of driver, always valid and * read only */ + struct spa_io_video_size video; /**< size of the video in the current cycle */ int64_t offset; /**< an offset to subtract from the clock position * to get a running time. This is the time that * the state has been in the RUNNING state and the diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index a66bdb1ba..63d75549b 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -700,7 +700,6 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del state->clock->nsec = nsec; state->clock->position += state->duration; state->clock->duration = state->duration; - state->clock->count = state->clock->position; state->clock->delay = state->duration * corr; state->clock->rate_diff = corr; state->clock->next_nsec = state->next_time; diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index a1f356969..cbb414766 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -695,7 +695,6 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool slave) state->clock->nsec = nsec; state->clock->position += state->duration; state->clock->duration = state->duration; - state->clock->count = state->clock->position; state->clock->delay = state->duration * corr; state->clock->rate_diff = corr; state->clock->next_nsec = state->next_time; diff --git a/spa/plugins/jack/jack-sink.c b/spa/plugins/jack/jack-sink.c index c8ad62d32..5c396f918 100644 --- a/spa/plugins/jack/jack-sink.c +++ b/spa/plugins/jack/jack-sink.c @@ -339,7 +339,6 @@ static void client_process(void *data) if (this->clock) { struct spa_io_clock *c = this->clock; c->nsec = this->client->current_usecs * SPA_NSEC_PER_USEC; - c->count = this->client->current_frames; c->rate = SPA_FRACTION(1, this->client->frame_rate); c->position = this->client->current_frames; c->duration = this->client->buffer_size; diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index b15f3888e..9ea6f6a57 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1186,7 +1186,6 @@ static int mmap_read(struct impl *this) this->clock->rate = port->rate; this->clock->position = buf.sequence; this->clock->duration = 1; - this->clock->count = buf.sequence; this->clock->delay = 0; this->clock->rate_diff = 1.0; this->clock->next_nsec = pts + 1000000000LL / port->rate.denom; diff --git a/spa/tests/test-node.c b/spa/tests/test-node.c index 1f329e433..9a8d23fc4 100644 --- a/spa/tests/test-node.c +++ b/spa/tests/test-node.c @@ -45,19 +45,21 @@ static void test_io_abi(void) spa_assert(sizeof(struct spa_io_buffers) == 8); spa_assert(sizeof(struct spa_io_memory) == 16); spa_assert(sizeof(struct spa_io_range) == 16); - spa_assert(sizeof(struct spa_io_clock) == 136); + spa_assert(sizeof(struct spa_io_clock) == 160); spa_assert(sizeof(struct spa_io_latency) == 24); spa_assert(sizeof(struct spa_io_sequence) == 16); - spa_assert(sizeof(struct spa_io_segment_bar) == 96); - spa_assert(sizeof(struct spa_io_segment_video) == 96); - spa_assert(sizeof(struct spa_io_segment) == 232); + spa_assert(sizeof(struct spa_io_segment_bar) == 64); + spa_assert(sizeof(struct spa_io_segment_video) == 80); + fprintf(stderr, "%zd", sizeof(struct spa_io_segment)); + spa_assert(sizeof(struct spa_io_segment) == 184); /* position state */ spa_assert(SPA_IO_POSITION_STATE_STOPPED == 0); spa_assert(SPA_IO_POSITION_STATE_STARTING == 1); spa_assert(SPA_IO_POSITION_STATE_RUNNING == 2); - spa_assert(sizeof(struct spa_io_position) == 2008); + fprintf(stderr, "%zd", sizeof(struct spa_io_position)); + spa_assert(sizeof(struct spa_io_position) == 1688); spa_assert(sizeof(struct spa_io_rate_match) == 48); }