mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
io: Add current video frame size to position
Add some padding, tweak some padding Remove count in the clock, it's useless For video frames we will want to use metadata to place this on individual buffers.
This commit is contained in:
parent
140203d5a3
commit
d94019ccd2
6 changed files with 23 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue