mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
command: remove clock-update
This commit is contained in:
parent
6976175d65
commit
5a3eee9cac
5 changed files with 4 additions and 108 deletions
|
|
@ -47,8 +47,6 @@ extern "C" {
|
|||
#define SPA_TYPE_COMMAND_NODE__Drain SPA_TYPE_COMMAND_NODE_BASE "Drain"
|
||||
/** Set a marker on a node or port */
|
||||
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
|
||||
/** Send a clock update to a node */
|
||||
#define SPA_TYPE_COMMAND_NODE__ClockUpdate SPA_TYPE_COMMAND_NODE_BASE "ClockUpdate"
|
||||
|
||||
struct spa_type_command_node {
|
||||
uint32_t Suspend;
|
||||
|
|
@ -59,7 +57,6 @@ struct spa_type_command_node {
|
|||
uint32_t Flush;
|
||||
uint32_t Drain;
|
||||
uint32_t Marker;
|
||||
uint32_t ClockUpdate;
|
||||
};
|
||||
|
||||
static inline void
|
||||
|
|
@ -74,58 +71,9 @@ spa_type_command_node_map(struct spa_type_map *map, struct spa_type_command_node
|
|||
type->Flush = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Flush);
|
||||
type->Drain = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Drain);
|
||||
type->Marker = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Marker);
|
||||
type->ClockUpdate = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__ClockUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* spa_command_node_clock_update:
|
||||
* @change_mask: marks which fields are updated
|
||||
* @rate: the number of @ticks per second
|
||||
* @ticks: the new ticks, when @change_mask = 1<<0
|
||||
* @monotonic_time: the new monotonic time in nanoseconds associated with
|
||||
* @ticks, when @change_mask = 1<<0
|
||||
* @offset: the difference between the time when this update was generated
|
||||
* and @monotonic_time in nanoseconds
|
||||
* @scale: update to the speed stored as Q16.16, @change_mask = 1<<1
|
||||
* @state: the new clock state, when @change_mask = 1<<2
|
||||
*/
|
||||
struct spa_command_node_clock_update_body {
|
||||
struct spa_pod_object_body body;
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_TIME (1 << 0)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE (1 << 1)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_STATE (1 << 2)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_LATENCY (1 << 3)
|
||||
struct spa_pod_int change_mask SPA_ALIGNED(8);
|
||||
struct spa_pod_int rate SPA_ALIGNED(8);
|
||||
struct spa_pod_long ticks SPA_ALIGNED(8);
|
||||
struct spa_pod_long monotonic_time SPA_ALIGNED(8);
|
||||
struct spa_pod_long offset SPA_ALIGNED(8);
|
||||
struct spa_pod_int scale SPA_ALIGNED(8);
|
||||
struct spa_pod_int state SPA_ALIGNED(8);
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE (1 << 0)
|
||||
struct spa_pod_int flags SPA_ALIGNED(8);
|
||||
struct spa_pod_long latency SPA_ALIGNED(8);
|
||||
};
|
||||
|
||||
struct spa_command_node_clock_update {
|
||||
struct spa_pod pod;
|
||||
struct spa_command_node_clock_update_body body;
|
||||
};
|
||||
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(type,change_mask,rate,ticks,monotonic_time,offset,scale,state,flags,latency) \
|
||||
SPA_COMMAND_INIT_FULL(struct spa_command_node_clock_update, \
|
||||
sizeof(struct spa_command_node_clock_update_body), type, \
|
||||
SPA_POD_INT_INIT(change_mask), \
|
||||
SPA_POD_INT_INIT(rate), \
|
||||
SPA_POD_LONG_INIT(ticks), \
|
||||
SPA_POD_LONG_INIT(monotonic_time), \
|
||||
SPA_POD_LONG_INIT(offset), \
|
||||
SPA_POD_INT_INIT(scale), \
|
||||
SPA_POD_INT_INIT(state), \
|
||||
SPA_POD_INT_INIT(flags), \
|
||||
SPA_POD_LONG_INIT(latency))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -335,13 +335,9 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
|
||||
t = this->impl->t;
|
||||
|
||||
if (SPA_COMMAND_TYPE(command) == t->command_node.ClockUpdate) {
|
||||
pw_client_node_resource_command(this->resource, this->seq++, command);
|
||||
} else {
|
||||
/* send start */
|
||||
pw_client_node_resource_command(this->resource, this->seq, command);
|
||||
res = SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,36 +127,6 @@ static int suspend_node(struct pw_node *this)
|
|||
return res;
|
||||
}
|
||||
|
||||
static void send_clock_update(struct pw_node *this)
|
||||
{
|
||||
int res;
|
||||
struct spa_command_node_clock_update cu =
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(this->core->type.command_node.ClockUpdate,
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_TIME |
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE |
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_STATE |
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_LATENCY, /* change_mask */
|
||||
1, /* rate */
|
||||
0, /* ticks */
|
||||
0, /* monotonic_time */
|
||||
0, /* offset */
|
||||
(1 << 16) | 1, /* scale */
|
||||
SPA_CLOCK_STATE_RUNNING, /* state */
|
||||
0, /* flags */
|
||||
0); /* latency */
|
||||
|
||||
if (this->clock && this->live) {
|
||||
cu.body.flags.value = SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE;
|
||||
res = spa_clock_get_time(this->clock,
|
||||
&cu.body.rate.value,
|
||||
&cu.body.ticks.value,
|
||||
&cu.body.monotonic_time.value);
|
||||
}
|
||||
res = spa_node_send_command(this->node, (struct spa_command *) &cu);
|
||||
if (res < 0)
|
||||
pw_log_debug("node %p: send clock update error %s", this, spa_strerror(res));
|
||||
}
|
||||
|
||||
static void node_unbind_func(void *data)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
|
|
@ -643,9 +613,6 @@ static void node_event(void *data, struct spa_event *event)
|
|||
struct pw_node *node = data;
|
||||
|
||||
pw_log_trace("node %p: event %d", node, SPA_EVENT_TYPE(event));
|
||||
if (SPA_EVENT_TYPE(event) == node->core->type.event_node.RequestClockUpdate) {
|
||||
send_clock_update(node);
|
||||
}
|
||||
spa_hook_list_call(&node->listener_list, struct pw_node_events, event, event);
|
||||
}
|
||||
|
||||
|
|
@ -1053,7 +1020,6 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state)
|
|||
case PW_NODE_STATE_RUNNING:
|
||||
if (node->active) {
|
||||
node_activate(node);
|
||||
send_clock_update(node);
|
||||
res = start_node(node);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -869,21 +869,6 @@ static void client_node_command(void *object, uint32_t seq, const struct spa_com
|
|||
|
||||
pw_client_node_proxy_done(data->node_proxy, seq, res);
|
||||
}
|
||||
else if (SPA_COMMAND_TYPE(command) == remote->core->type.command_node.ClockUpdate) {
|
||||
struct spa_command_node_clock_update *cu = (__typeof__(cu)) command;
|
||||
|
||||
#if 0
|
||||
if (cu->body.flags.value & SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE) {
|
||||
pw_properties_set(stream->properties, PW_STREAM_PROP_IS_LIVE, "1");
|
||||
pw_properties_setf(stream->properties,
|
||||
PW_STREAM_PROP_LATENCY_MIN, "%" PRId64,
|
||||
cu->body.latency.value);
|
||||
}
|
||||
impl->last_ticks = cu->body.ticks.value;
|
||||
impl->last_rate = cu->body.rate.value;
|
||||
impl->last_monotonic = cu->body.monotonic_time.value;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
pw_log_warn("unhandled node command %d", SPA_COMMAND_TYPE(command));
|
||||
pw_client_node_proxy_done(data->node_proxy, seq, -ENOTSUP);
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ do_call_process(struct spa_loop *loop,
|
|||
{
|
||||
struct stream *impl = user_data;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
pw_log_trace("do process");
|
||||
spa_hook_list_call(&stream->listener_list, struct pw_stream_events, process);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue