mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
port: implement latency_changed event
Emit the latency changed event when the latency was updated.
This commit is contained in:
parent
0222e408e0
commit
cd58c51582
3 changed files with 10 additions and 4 deletions
|
|
@ -365,6 +365,8 @@ static int process_latency_param(void *data, int seq,
|
||||||
return 0;
|
return 0;
|
||||||
if (latency.direction != this->direction)
|
if (latency.direction != this->direction)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (spa_latency_info_compare(&this->latency[this->direction], &latency) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
pw_log_info("port %p: got %s latency %f-%f %d-%d %"PRIu64"-%"PRIu64, this,
|
pw_log_info("port %p: got %s latency %f-%f %d-%d %"PRIu64"-%"PRIu64, this,
|
||||||
pw_direction_as_string(this->direction),
|
pw_direction_as_string(this->direction),
|
||||||
|
|
@ -373,6 +375,7 @@ static int process_latency_param(void *data, int seq,
|
||||||
latency.min_ns, latency.max_ns);
|
latency.min_ns, latency.max_ns);
|
||||||
|
|
||||||
this->latency[this->direction] = latency;
|
this->latency[this->direction] = latency;
|
||||||
|
pw_impl_port_emit_latency_changed(this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,8 +383,8 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i
|
||||||
{
|
{
|
||||||
uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0;
|
uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: flags:%08"PRIx64" change_mask:%08"PRIx64,
|
pw_log_debug(NAME" %p: %p flags:%08"PRIx64" change_mask:%08"PRIx64,
|
||||||
port, info->flags, info->change_mask);
|
port, info, info->flags, info->change_mask);
|
||||||
|
|
||||||
if (info->change_mask & SPA_PORT_CHANGE_MASK_FLAGS) {
|
if (info->change_mask & SPA_PORT_CHANGE_MASK_FLAGS) {
|
||||||
port->spa_flags = info->flags;
|
port->spa_flags = info->flags;
|
||||||
|
|
@ -426,7 +429,6 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ enum pw_impl_port_state {
|
||||||
|
|
||||||
/** Port events, use \ref pw_impl_port_add_listener */
|
/** Port events, use \ref pw_impl_port_add_listener */
|
||||||
struct pw_impl_port_events {
|
struct pw_impl_port_events {
|
||||||
#define PW_VERSION_IMPL_PORT_EVENTS 1
|
#define PW_VERSION_IMPL_PORT_EVENTS 2
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
/** The port is destroyed */
|
/** The port is destroyed */
|
||||||
|
|
@ -89,6 +89,9 @@ struct pw_impl_port_events {
|
||||||
|
|
||||||
/** a parameter changed, since version 1 */
|
/** a parameter changed, since version 1 */
|
||||||
void (*param_changed) (void *data, uint32_t id);
|
void (*param_changed) (void *data, uint32_t id);
|
||||||
|
|
||||||
|
/** latency changed. Since version 2 */
|
||||||
|
void (*latency_changed) (void *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Create a new port
|
/** Create a new port
|
||||||
|
|
|
||||||
|
|
@ -731,6 +731,7 @@ struct pw_impl_port_implementation {
|
||||||
#define pw_impl_port_emit_control_added(p,c) pw_impl_port_emit(p, control_added, 0, c)
|
#define pw_impl_port_emit_control_added(p,c) pw_impl_port_emit(p, control_added, 0, c)
|
||||||
#define pw_impl_port_emit_control_removed(p,c) pw_impl_port_emit(p, control_removed, 0, c)
|
#define pw_impl_port_emit_control_removed(p,c) pw_impl_port_emit(p, control_removed, 0, c)
|
||||||
#define pw_impl_port_emit_param_changed(p,i) pw_impl_port_emit(p, param_changed, 1, i)
|
#define pw_impl_port_emit_param_changed(p,i) pw_impl_port_emit(p, param_changed, 1, i)
|
||||||
|
#define pw_impl_port_emit_latency_changed(p) pw_impl_port_emit(p, latency_changed, 2)
|
||||||
|
|
||||||
#define PW_IMPL_PORT_IS_CONTROL(port) SPA_FLAG_MASK(port->flags, \
|
#define PW_IMPL_PORT_IS_CONTROL(port) SPA_FLAG_MASK(port->flags, \
|
||||||
PW_IMPL_PORT_FLAG_BUFFERS|PW_IMPL_PORT_FLAG_CONTROL,\
|
PW_IMPL_PORT_FLAG_BUFFERS|PW_IMPL_PORT_FLAG_CONTROL,\
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue