mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
io: rename some segment variables
Also initalize a default segment in the node.
This commit is contained in:
parent
7c865f5db0
commit
2805713da3
3 changed files with 22 additions and 18 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 3daf9f85d27a8af8f73daf975d273c01be1797bd
|
||||
Subproject commit 796278b207e686403638d1c850ce01fa0a0fee48
|
||||
|
|
@ -139,17 +139,17 @@ struct spa_io_segment_video {
|
|||
* A segment converts a raw clock time to a segment (stream) position.
|
||||
*
|
||||
* The segment position is valid when the current clock position is between
|
||||
* clock_start and clock_start + clock_duration. The position is then
|
||||
* start and start + duration. The position is then
|
||||
* calculated as:
|
||||
*
|
||||
* (clock_start - clock.position) * rate + position;
|
||||
* (start - clock.position) * rate + position;
|
||||
*
|
||||
* Support for looping is done by specifying a non-zero duration. When the
|
||||
* clock reaches clock_start + clock_duration, clock_duration is added to
|
||||
* clock_start and the loop repeats.
|
||||
* clock reaches start + duration, duration is added to start and the
|
||||
* loop repeats.
|
||||
*
|
||||
* Care has to be taken when the clock.duration extends past the
|
||||
* clock_start + clock_duration from the segment; the user should correctly
|
||||
* start + duration from the segment; the user should correctly
|
||||
* wrap around and partially repeat the loop in the current cycle.
|
||||
*
|
||||
* Extra information can be placed in the segment by setting the valid flags
|
||||
|
|
@ -162,15 +162,15 @@ struct spa_io_segment {
|
|||
#define SPA_IO_SEGMENT_VALID_BAR (1<<1)
|
||||
#define SPA_IO_SEGMENT_VALID_VIDEO (1<<2)
|
||||
uint32_t valid; /**< indicates what fields are valid below */
|
||||
uint64_t clock_start; /**< position against clock position when this
|
||||
uint64_t start; /**< position against clock position when this
|
||||
* info is active. Can be in the future for
|
||||
* pending changes. It does not have to be in
|
||||
* exact multiples of the clock duration. */
|
||||
uint64_t clock_duration; /**< duration when this info becomes invalid. If
|
||||
uint64_t duration; /**< duration when this info becomes invalid. If
|
||||
* the duration is 0, this segment extends to the
|
||||
* next segment. If the segment becomes invalid and
|
||||
* the looping flag is set, the segment is repeats. */
|
||||
uint64_t position; /**< The position when the clock == clock_start. */
|
||||
uint64_t position; /**< The position when the clock == start. */
|
||||
double rate; /**< overal rate of the graph, can be negative for
|
||||
* backwards time reporting. */
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ enum spa_io_position_state {
|
|||
*
|
||||
* The position information contains 1 or more segments that convert the
|
||||
* raw clock times to a stream time. They are sorted based on their
|
||||
* clock_start times, and thus the order in which they will activate in
|
||||
* start times, and thus the order in which they will activate in
|
||||
* the future. This makes it possible to look ahead in the scheduled
|
||||
* segments and anticipate the changes in the timeline.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -963,6 +963,13 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
|||
|
||||
this->rt.activation->position.clock.rate = SPA_FRACTION(1, 48000);
|
||||
this->rt.activation->position.clock.duration = DEFAULT_QUANTUM;
|
||||
this->rt.activation->position.n_segments = 1;
|
||||
this->rt.activation->position.segments[0].flags = 0;
|
||||
this->rt.activation->position.segments[0].valid = SPA_IO_SEGMENT_VALID_POSITION;
|
||||
this->rt.activation->position.segments[0].start = 0;
|
||||
this->rt.activation->position.segments[0].duration = 0;
|
||||
this->rt.activation->position.segments[0].position = 0;
|
||||
this->rt.activation->position.segments[0].rate = 1.0;
|
||||
|
||||
check_properties(this);
|
||||
|
||||
|
|
@ -1196,8 +1203,8 @@ static void update_position(struct pw_node *node)
|
|||
if (change_mask & PW_NODE_ACTIVATION_UPDATE_REPOSITION) {
|
||||
pw_log_debug("update position:%lu", segment.position);
|
||||
seg->flags = segment.flags;
|
||||
seg->clock_start = segment.clock_start;
|
||||
seg->clock_duration = segment.clock_duration;
|
||||
seg->start = segment.start;
|
||||
seg->duration = segment.duration;
|
||||
seg->position = segment.position;
|
||||
seg->rate = segment.rate;
|
||||
}
|
||||
|
|
@ -1212,14 +1219,11 @@ static void update_position(struct pw_node *node)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (seg->rate == 0.0)
|
||||
seg->rate = 1.0;
|
||||
|
||||
if (seg->clock_start == 0)
|
||||
seg->clock_start = a->position.clock.position;
|
||||
if (seg->start == 0)
|
||||
seg->start = a->position.clock.position;
|
||||
|
||||
if (a->position.state == SPA_IO_POSITION_STATE_STOPPED)
|
||||
seg->clock_start += a->position.clock.duration;
|
||||
seg->start += a->position.clock.duration;
|
||||
}
|
||||
|
||||
static int node_ready(void *data, int status)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue