slave -> follower

We use master/follower terminology everywhere.
This commit is contained in:
Wim Taymans 2020-02-21 10:47:32 +01:00
parent bdeeebfdd4
commit a528189d26
22 changed files with 301 additions and 300 deletions

View file

@ -189,7 +189,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
default:
return -ENOENT;
}
spa_alsa_reslave(this);
spa_alsa_reassign_follower(this);
return 0;
}

View file

@ -188,7 +188,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
default:
return -ENOENT;
}
spa_alsa_reslave(this);
spa_alsa_reassign_follower(this);
return 0;
}
@ -647,10 +647,10 @@ static int impl_node_process(void *object)
io->buffer_id = SPA_ID_INVALID;
}
if (spa_list_is_empty(&this->ready) && this->slaved)
if (spa_list_is_empty(&this->ready) && this->following)
spa_alsa_read(this, 0);
if (spa_list_is_empty(&this->ready) || !this->slaved)
if (spa_list_is_empty(&this->ready) || !this->following)
return SPA_STATUS_OK;
b = spa_list_first(&this->ready, struct buffer, link);

View file

@ -647,7 +647,7 @@ static int get_status(struct state *state, snd_pcm_uframes_t *delay, snd_pcm_ufr
}
static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t delay,
snd_pcm_sframes_t target, bool slave)
snd_pcm_sframes_t target, bool follower)
{
double err, corr;
@ -669,8 +669,8 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
if (state->last_threshold != state->threshold) {
int32_t diff = (int32_t) (state->last_threshold - state->threshold);
spa_log_trace(state->log, NAME" %p: slave:%d quantum change %d",
state, slave, diff);
spa_log_trace(state->log, NAME" %p: follower:%d quantum change %d",
state, follower, diff);
state->next_time += diff / corr * 1e9 / state->rate;
state->last_threshold = state->threshold;
}
@ -682,8 +682,8 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
else if (state->bw == BW_MED)
set_loop(state, BW_MIN);
spa_log_debug(state->log, NAME" %p: slave:%d match:%d rate:%f bw:%f del:%d target:%ld err:%f (%f %f %f)",
state, slave, state->matching, corr, state->bw, state->delay, target,
spa_log_debug(state->log, NAME" %p: follower:%d match:%d rate:%f bw:%f del:%d target:%ld err:%f (%f %f %f)",
state, follower, state->matching, corr, state->bw, state->delay, target,
err, state->z1, state->z2, state->z3);
}
@ -698,7 +698,7 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
state->next_time += state->threshold / corr * 1e9 / state->rate;
if (!slave && state->clock) {
if (!follower && state->clock) {
state->clock->nsec = nsec;
state->clock->position += state->duration;
state->clock->duration = state->duration;
@ -707,8 +707,8 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
state->clock->next_nsec = state->next_time;
}
spa_log_trace_fp(state->log, NAME" %p: slave:%d %"PRIu64" %f %ld %f %f %d",
state, slave, nsec, corr, delay, err, state->threshold * corr,
spa_log_trace_fp(state->log, NAME" %p: follower:%d %"PRIu64" %f %ld %f %f %d",
state, follower, nsec, corr, delay, err, state->threshold * corr,
state->threshold);
return 0;
@ -726,7 +726,7 @@ int spa_alsa_write(struct state *state, snd_pcm_uframes_t silence)
state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom;
}
if (state->slaved && state->alsa_started) {
if (state->following && state->alsa_started) {
uint64_t nsec;
snd_pcm_uframes_t delay, target;
@ -734,7 +734,7 @@ int spa_alsa_write(struct state *state, snd_pcm_uframes_t silence)
return res;
if (!state->alsa_recovering && delay > target + state->threshold) {
spa_log_warn(state->log, NAME" %p: slave delay:%ld resync %f %f %f",
spa_log_warn(state->log, NAME" %p: follower delay:%ld resync %f %f %f",
state, delay, state->z1, state->z2, state->z3);
init_loop(state);
state->alsa_sync = true;
@ -927,7 +927,7 @@ int spa_alsa_read(struct state *state, snd_pcm_uframes_t silence)
state->duration = state->position->clock.duration;
state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom;
}
if (!state->slaved) {
if (!state->following) {
uint64_t position;
position = state->position->clock.position;
@ -941,7 +941,7 @@ int spa_alsa_read(struct state *state, snd_pcm_uframes_t silence)
}
}
if (state->slaved && state->alsa_started) {
if (state->following && state->alsa_started) {
uint64_t nsec;
snd_pcm_uframes_t delay, target;
uint32_t threshold = state->threshold;
@ -950,13 +950,13 @@ int spa_alsa_read(struct state *state, snd_pcm_uframes_t silence)
return res;
if (!state->alsa_recovering && (delay < target || delay > target * 2)) {
spa_log_warn(state->log, NAME" %p: slave delay:%lu target:%lu resync %f %f %f",
spa_log_warn(state->log, NAME" %p: follower delay:%lu target:%lu resync %f %f %f",
state, delay, target, state->z1, state->z2, state->z3);
init_loop(state);
state->alsa_sync = true;
}
if (state->alsa_sync) {
spa_log_warn(state->log, NAME" %p: slave resync %ld %d %ld",
spa_log_warn(state->log, NAME" %p: follower resync %ld %d %ld",
state, delay, threshold, target);
if (delay < target)
snd_pcm_rewind(state->hndl, target - delay + 32);
@ -1131,7 +1131,7 @@ static int set_timers(struct state *state)
spa_system_clock_gettime(state->data_system, CLOCK_MONOTONIC, &now);
state->next_time = SPA_TIMESPEC_TO_NSEC(&now);
if (state->slaved) {
if (state->following) {
set_timeout(state, 0);
} else {
set_timeout(state, state->next_time);
@ -1139,7 +1139,7 @@ static int set_timers(struct state *state)
return 0;
}
static inline bool is_slaved(struct state *state)
static inline bool is_following(struct state *state)
{
return state->position && state->clock && state->position->clock.id != state->clock->id;
}
@ -1151,8 +1151,8 @@ int spa_alsa_start(struct state *state)
if (state->started)
return 0;
state->slaved = is_slaved(state);
state->matching = state->slaved;
state->following = is_following(state);
state->matching = state->following;
if (state->position) {
int card;
@ -1175,9 +1175,9 @@ int spa_alsa_start(struct state *state)
init_loop(state);
state->safety = 0.0;
spa_log_debug(state->log, NAME" %p: start %d duration:%d rate:%d slave:%d match:%d",
spa_log_debug(state->log, NAME" %p: start %d duration:%d rate:%d follower:%d match:%d",
state, state->threshold, state->duration, state->rate_denom,
state->slaved, state->matching);
state->following, state->matching);
CHECK(set_swparams(state), "swparams");
if (SPA_UNLIKELY(spa_log_level_enabled(state->log, SPA_LOG_LEVEL_DEBUG)))
@ -1218,7 +1218,7 @@ int spa_alsa_start(struct state *state)
return 0;
}
static int do_reslave(struct spa_loop *loop,
static int do_reassign_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -1231,18 +1231,18 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
int spa_alsa_reslave(struct state *state)
int spa_alsa_reassign_follower(struct state *state)
{
bool slaved;
bool following;
if (!state->started)
return 0;
slaved = is_slaved(state);
if (slaved != state->slaved) {
spa_log_debug(state->log, NAME" %p: reslave %d->%d", state, state->slaved, slaved);
state->slaved = slaved;
spa_loop_invoke(state->data_loop, do_reslave, 0, NULL, 0, true, state);
following = is_following(state);
if (following != state->following) {
spa_log_debug(state->log, NAME" %p: reassign follower %d->%d", state, state->following, following);
state->following = following;
spa_loop_invoke(state->data_loop, do_reassign_follower, 0, NULL, 0, true, state);
}
return 0;
}

View file

@ -139,7 +139,7 @@ struct state {
unsigned int alsa_started:1;
unsigned int alsa_sync:1;
unsigned int alsa_recovering:1;
unsigned int slaved:1;
unsigned int following:1;
unsigned int matching:1;
int64_t sample_count;
@ -165,7 +165,7 @@ spa_alsa_enum_format(struct state *state, int seq,
int spa_alsa_set_format(struct state *state, struct spa_audio_info *info, uint32_t flags);
int spa_alsa_start(struct state *state);
int spa_alsa_reslave(struct state *state);
int spa_alsa_reassign_follower(struct state *state);
int spa_alsa_pause(struct state *state);
int spa_alsa_close(struct state *state);

View file

@ -149,7 +149,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
default:
return -ENOENT;
}
spa_alsa_seq_reslave(this);
spa_alsa_seq_reassign_follower(this);
return 0;
}

View file

@ -647,7 +647,7 @@ static void set_loop(struct seq_state *state, double bw)
#define NSEC_TO_CLOCK(c,n) ((n) * (c)->rate.denom / ((c)->rate.num * SPA_NSEC_PER_SEC))
static int update_time(struct seq_state *state, uint64_t nsec, bool slave)
static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
{
snd_seq_queue_status_t *status;
const snd_seq_real_time_t* queue_time;
@ -699,13 +699,13 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool slave)
else if (state->bw == BW_MED)
set_loop(state, BW_MIN);
spa_log_debug(state->log, NAME" %p: slave:%d rate:%f bw:%f err:%f (%f %f %f)",
state, slave, corr, state->bw, err, state->z1, state->z2, state->z3);
spa_log_debug(state->log, NAME" %p: follower:%d rate:%f bw:%f err:%f (%f %f %f)",
state, follower, corr, state->bw, err, state->z1, state->z2, state->z3);
}
state->next_time += state->threshold / corr * 1e9 / state->rate.denom;
if (!slave && state->clock) {
if (!follower && state->clock) {
state->clock->nsec = nsec;
state->clock->position += state->duration;
state->clock->duration = state->duration;
@ -726,7 +726,7 @@ int spa_alsa_seq_process(struct seq_state *state)
res = process_recycle(state);
if (state->slaved) {
if (state->following) {
update_time(state, state->position->clock.nsec, true);
res |= process_read(state);
}
@ -791,7 +791,7 @@ static int set_timers(struct seq_state *state)
spa_system_clock_gettime(state->data_system, CLOCK_MONOTONIC, &now);
state->next_time = SPA_TIMESPEC_TO_NSEC(&now);
if (state->slaved) {
if (state->following) {
set_timeout(state, 0);
} else {
set_timeout(state, state->next_time);
@ -799,7 +799,7 @@ static int set_timers(struct seq_state *state)
return 0;
}
static inline bool is_slaved(struct seq_state *state)
static inline bool is_following(struct seq_state *state)
{
return state->position && state->clock && state->position->clock.id != state->clock->id;
}
@ -811,9 +811,9 @@ int spa_alsa_seq_start(struct seq_state *state)
if (state->started)
return 0;
state->slaved = is_slaved(state);
state->following = is_following(state);
spa_log_debug(state->log, "alsa %p: start slave:%d", state, state->slaved);
spa_log_debug(state->log, "alsa %p: start follower:%d", state, state->following);
if ((res = seq_start(state, &state->event)) < 0)
return res;
@ -844,7 +844,7 @@ int spa_alsa_seq_start(struct seq_state *state)
return 0;
}
static int do_reslave(struct spa_loop *loop,
static int do_reassign_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -856,18 +856,18 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
int spa_alsa_seq_reslave(struct seq_state *state)
int spa_alsa_seq_reassign_follower(struct seq_state *state)
{
bool slaved;
bool following;
if (!state->started)
return 0;
slaved = is_slaved(state);
if (slaved != state->slaved) {
spa_log_debug(state->log, "alsa %p: reslave %d->%d", state, state->slaved, slaved);
state->slaved = slaved;
spa_loop_invoke(state->data_loop, do_reslave, 0, NULL, 0, true, state);
following = is_following(state);
if (following != state->following) {
spa_log_debug(state->log, "alsa %p: reassign follower %d->%d", state, state->following, following);
state->following = following;
spa_loop_invoke(state->data_loop, do_reassign_follower, 0, NULL, 0, true, state);
}
return 0;
}

View file

@ -149,7 +149,7 @@ struct seq_state {
unsigned int opened:1;
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
struct seq_stream streams[2];
@ -171,7 +171,7 @@ int spa_alsa_seq_close(struct seq_state *state);
int spa_alsa_seq_start(struct seq_state *state);
int spa_alsa_seq_pause(struct seq_state *state);
int spa_alsa_seq_reslave(struct seq_state *state);
int spa_alsa_seq_reassign_follower(struct seq_state *state);
int spa_alsa_seq_recycle_buffer(struct seq_state *state, struct seq_port *port, uint32_t buffer_id);

View file

@ -56,10 +56,10 @@ struct impl {
struct spa_node *target;
struct spa_node *slave;
struct spa_hook slave_listener;
uint32_t slave_flags;
struct spa_audio_info slave_current_format;
struct spa_node *follower;
struct spa_hook follower_listener;
uint32_t follower_flags;
struct spa_audio_info follower_current_format;
struct spa_handle *hnd_convert;
struct spa_node *convert;
@ -121,7 +121,7 @@ next:
case SPA_PARAM_EnumFormat:
case SPA_PARAM_Format:
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
id, &result.next, filter, &param, &b)) != 1)
return res;
@ -154,11 +154,11 @@ static int link_io(struct impl *this)
spa_zero(this->io_rate_match);
this->io_rate_match.rate = 1.0;
if ((res = spa_node_port_set_io(this->slave,
if ((res = spa_node_port_set_io(this->follower,
this->direction, 0,
SPA_IO_RateMatch,
&this->io_rate_match, sizeof(this->io_rate_match))) < 0) {
spa_log_debug(this->log, NAME " %p: set RateMatch on slave disabled %d %s", this,
spa_log_debug(this->log, NAME " %p: set RateMatch on follower disabled %d %s", this,
res, spa_strerror(res));
}
else if ((res = spa_node_port_set_io(this->convert,
@ -171,11 +171,11 @@ static int link_io(struct impl *this)
spa_zero(this->io_buffers);
if ((res = spa_node_port_set_io(this->slave,
if ((res = spa_node_port_set_io(this->follower,
this->direction, 0,
SPA_IO_Buffers,
&this->io_buffers, sizeof(this->io_buffers))) < 0) {
spa_log_warn(this->log, NAME " %p: set Buffers on slave failed %d %s", this,
spa_log_warn(this->log, NAME " %p: set Buffers on follower failed %d %s", this,
res, spa_strerror(res));
return res;
}
@ -243,11 +243,11 @@ static int negotiate_buffers(struct impl *this)
uint32_t state;
struct spa_pod *param;
int res;
bool slave_alloc, conv_alloc;
bool follower_alloc, conv_alloc;
uint32_t i, size, buffers, blocks, align, flags;
uint32_t *aligns;
struct spa_data *datas;
uint32_t slave_flags, conv_flags;
uint32_t follower_flags, conv_flags;
spa_log_debug(this->log, "%p: %d", this, this->n_buffers);
@ -256,12 +256,12 @@ static int negotiate_buffers(struct impl *this)
state = 0;
param = NULL;
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
SPA_PARAM_Buffers, &state,
param, &param, &b)) < 0) {
debug_params(this, this->slave, this->direction, 0,
SPA_PARAM_Buffers, param, "slave buffers", res);
debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_Buffers, param, "follower buffers", res);
return -ENOTSUP;
}
@ -278,17 +278,17 @@ static int negotiate_buffers(struct impl *this)
spa_pod_fixate(param);
slave_flags = this->slave_flags;
follower_flags = this->follower_flags;
conv_flags = this->convert_flags;
slave_alloc = SPA_FLAG_IS_SET(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
follower_alloc = SPA_FLAG_IS_SET(follower_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
conv_alloc = SPA_FLAG_IS_SET(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
flags = 0;
if (conv_alloc || slave_alloc) {
if (conv_alloc || follower_alloc) {
flags |= SPA_BUFFER_ALLOC_FLAG_NO_DATA;
if (conv_alloc)
slave_alloc = false;
follower_alloc = false;
}
if ((res = spa_pod_parse_object(param,
@ -300,7 +300,7 @@ static int negotiate_buffers(struct impl *this)
return res;
spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d %d:%d",
this, buffers, blocks, size, align, slave_alloc, conv_alloc);
this, buffers, blocks, size, align, follower_alloc, conv_alloc);
align = SPA_MAX(align, this->max_align);
@ -326,9 +326,9 @@ static int negotiate_buffers(struct impl *this)
this->buffers, this->n_buffers)) < 0)
return res;
if ((res = spa_node_port_use_buffers(this->slave,
if ((res = spa_node_port_use_buffers(this->follower,
this->direction, 0,
slave_alloc ? SPA_NODE_BUFFERS_FLAG_ALLOC : 0,
follower_alloc ? SPA_NODE_BUFFERS_FLAG_ALLOC : 0,
this->buffers, this->n_buffers)) < 0)
return res;
@ -351,7 +351,7 @@ static int configure_format(struct impl *this, uint32_t flags, const struct spa_
return res;
}
if ((res = spa_node_port_set_param(this->slave,
if ((res = spa_node_port_set_param(this->follower,
this->direction, 0,
SPA_PARAM_Format, flags,
format)) < 0)
@ -391,20 +391,20 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
if (spa_format_audio_raw_parse(param, &info.info.raw) < 0)
return -EINVAL;
this->slave_current_format = info;
this->follower_current_format = info;
break;
case SPA_PARAM_PortConfig:
if (this->started)
return -EIO;
if (this->target != this->slave) {
if (this->target != this->follower) {
if ((res = spa_node_set_param(this->target, id, flags, param)) < 0)
return res;
}
break;
case SPA_PARAM_Props:
if (this->target != this->slave) {
if (this->target != this->follower) {
if ((res = spa_node_set_param(this->target, id, flags, param)) < 0)
return res;
}
@ -426,8 +426,8 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
if (this->target)
res = spa_node_set_io(this->target, id, data, size);
if (this->target != this->slave)
res = spa_node_set_io(this->slave, id, data, size);
if (this->target != this->follower)
res = spa_node_set_io(this->follower, id, data, size);
return res;
}
@ -451,14 +451,14 @@ static int negotiate_format(struct impl *this)
format = NULL;
if (this->have_format)
format = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &this->slave_current_format.info.raw);
format = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &this->follower_current_format.info.raw);
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
SPA_PARAM_EnumFormat, &state,
format, &format, &b)) < 0) {
debug_params(this, this->slave, this->direction, 0,
SPA_PARAM_EnumFormat, format, "slave format", res);
debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_EnumFormat, format, "follower format", res);
return -ENOTSUP;
}
@ -516,8 +516,8 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
return res;
}
if (this->target != this->slave) {
if ((res = spa_node_send_command(this->slave, command)) < 0) {
if (this->target != this->follower) {
if ((res = spa_node_send_command(this->follower, command)) < 0) {
spa_log_error(this->log, NAME " %p: can't send command: %s",
this, spa_strerror(res));
return res;
@ -583,7 +583,7 @@ static const struct spa_node_events convert_node_events = {
.result = convert_result,
};
static void slave_info(void *data, const struct spa_node_info *info)
static void follower_info(void *data, const struct spa_node_info *info)
{
struct impl *this = data;
@ -595,7 +595,7 @@ static void slave_info(void *data, const struct spa_node_info *info)
this->info.max_input_ports = this->direction == SPA_DIRECTION_INPUT ? 128 : 0;
this->info.max_output_ports = this->direction == SPA_DIRECTION_OUTPUT ? 128 : 0;
spa_log_debug(this->log, NAME" %p: slave info %s", this,
spa_log_debug(this->log, NAME" %p: follower info %s", this,
this->direction == SPA_DIRECTION_INPUT ?
"Input" : "Output");
@ -606,7 +606,7 @@ static void slave_info(void *data, const struct spa_node_info *info)
}
}
static void slave_port_info(void *data,
static void follower_port_info(void *data,
enum spa_direction direction, uint32_t port_id,
const struct spa_port_info *info)
{
@ -630,13 +630,13 @@ static void slave_port_info(void *data,
emit_node_info(this, false);
}
static const struct spa_node_events slave_node_events = {
static const struct spa_node_events follower_node_events = {
SPA_VERSION_NODE_EVENTS,
.info = slave_info,
.port_info = slave_port_info,
.info = follower_info,
.port_info = follower_port_info,
};
static int slave_ready(void *data, int status)
static int follower_ready(void *data, int status)
{
struct impl *this = data;
@ -650,7 +650,7 @@ static int slave_ready(void *data, int status)
return spa_node_call_ready(&this->callbacks, status);
}
static int slave_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
static int follower_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
{
int res;
struct impl *this = data;
@ -663,17 +663,17 @@ static int slave_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
return res;
}
static int slave_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_pod *info)
static int follower_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_pod *info)
{
struct impl *this = data;
return spa_node_call_xrun(&this->callbacks, trigger, delay, info);
}
static const struct spa_node_callbacks slave_node_callbacks = {
static const struct spa_node_callbacks follower_node_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.ready = slave_ready,
.reuse_buffer = slave_reuse_buffer,
.xrun = slave_xrun,
.ready = follower_ready,
.reuse_buffer = follower_reuse_buffer,
.xrun = follower_xrun,
};
static int impl_node_add_listener(void *object,
@ -695,7 +695,7 @@ static int impl_node_add_listener(void *object,
if (events->info || events->port_info) {
spa_zero(l);
spa_node_add_listener(this->slave, &l, &slave_node_events, this);
spa_node_add_listener(this->follower, &l, &follower_node_events, this);
spa_hook_remove(&l);
if (this->use_converter) {
@ -734,7 +734,7 @@ impl_node_sync(void *object, int seq)
spa_return_val_if_fail(this != NULL, -EINVAL);
return spa_node_sync(this->slave, seq);
return spa_node_sync(this->follower, seq);
}
static int
@ -875,7 +875,7 @@ static int impl_node_process(void *object)
status = spa_node_process(this->convert);
}
status = spa_node_process(this->slave);
status = spa_node_process(this->follower);
if (this->direction == SPA_DIRECTION_OUTPUT &&
!this->master && this->use_converter) {
@ -885,7 +885,7 @@ static int impl_node_process(void *object)
break;
if (status & SPA_STATUS_NEED_DATA) {
status = spa_node_process(this->slave);
status = spa_node_process(this->follower);
if (!(status & SPA_STATUS_HAVE_DATA))
break;
}
@ -942,8 +942,8 @@ static int impl_clear(struct spa_handle *handle)
this = (struct impl *) handle;
spa_hook_remove(&this->slave_listener);
spa_node_set_callbacks(this->slave, NULL, NULL);
spa_hook_remove(&this->follower_listener);
spa_node_set_callbacks(this->follower, NULL, NULL);
if (this->buffers)
free(this->buffers);
@ -1006,11 +1006,12 @@ impl_init(const struct spa_handle_factory *factory,
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL)
if (info == NULL ||
(str = spa_dict_lookup(info, "audio.adapt.follower")) == NULL)
return -EINVAL;
sscanf(str, "pointer:%p", &this->slave);
if (this->slave == NULL)
sscanf(str, "pointer:%p", &this->follower);
if (this->follower == NULL)
return -EINVAL;
if (this->cpu)
@ -1043,9 +1044,9 @@ impl_init(const struct spa_handle_factory *factory,
this->info.params = this->params;
this->info.n_params = 6;
spa_node_add_listener(this->slave,
&this->slave_listener, &slave_node_events, this);
spa_node_set_callbacks(this->slave, &slave_node_callbacks, this);
spa_node_add_listener(this->follower,
&this->follower_listener, &follower_node_events, this);
spa_node_set_callbacks(this->follower, &follower_node_callbacks, this);
spa_node_add_listener(this->convert,
&this->convert_listener, &convert_node_events, this);

View file

@ -43,8 +43,8 @@ SPA_LOG_IMPL(logger);
extern const struct spa_handle_factory test_source_factory;
struct context {
struct spa_handle *slave_handle;
struct spa_node *slave_node;
struct spa_handle *follower_handle;
struct spa_node *follower_node;
struct spa_handle *adapter_handle;
struct spa_node *adapter_node;
@ -75,22 +75,22 @@ static int setup_context(struct context *ctx)
logger.log.level = SPA_LOG_LEVEL_TRACE;
support[0] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_Log, &logger.log);
/* make slave */
/* make follower */
factory = &test_source_factory;
size = spa_handle_factory_get_size(factory, NULL);
ctx->slave_handle = calloc(1, size);
spa_assert(ctx->slave_handle != NULL);
ctx->follower_handle = calloc(1, size);
spa_assert(ctx->follower_handle != NULL);
res = spa_handle_factory_init(factory,
ctx->slave_handle,
ctx->follower_handle,
NULL, support, 1);
spa_assert(res >= 0);
res = spa_handle_get_interface(ctx->slave_handle,
res = spa_handle_get_interface(ctx->follower_handle,
SPA_TYPE_INTERFACE_Node, &iface);
spa_assert(res >= 0);
ctx->slave_node = iface;
ctx->follower_node = iface;
/* make adapter */
factory = find_factory(SPA_NAME_AUDIO_ADAPT);
@ -101,8 +101,8 @@ static int setup_context(struct context *ctx)
ctx->adapter_handle = calloc(1, size);
spa_assert(ctx->adapter_handle != NULL);
snprintf(value, sizeof(value), "pointer:%p", ctx->slave_node);
items[0] = SPA_DICT_ITEM_INIT("audio.adapt.slave", value);
snprintf(value, sizeof(value), "pointer:%p", ctx->follower_node);
items[0] = SPA_DICT_ITEM_INIT("audio.adapt.follower", value);
res = spa_handle_factory_init(factory,
ctx->adapter_handle,
@ -121,9 +121,9 @@ static int setup_context(struct context *ctx)
static int clean_context(struct context *ctx)
{
spa_handle_clear(ctx->adapter_handle);
spa_handle_clear(ctx->slave_handle);
spa_handle_clear(ctx->follower_handle);
free(ctx->adapter_handle);
free(ctx->slave_handle);
free(ctx->follower_handle);
return 0;
}

View file

@ -112,7 +112,7 @@ struct impl {
struct port port;
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
struct spa_source source;
int timerfd;
@ -246,7 +246,7 @@ static int set_timers(struct impl *this)
int res;
ts.it_value.tv_sec = 0;
if (this->slaved) {
if (this->following) {
ts.it_value.tv_nsec = 0;
} else {
ts.it_value.tv_nsec = 1;
@ -260,7 +260,7 @@ static int set_timers(struct impl *this)
return res;
}
static int do_reslave(struct spa_loop *loop,
static int do_reassign_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -272,7 +272,7 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
static inline bool is_slaved(struct impl *this)
static inline bool is_following(struct impl *this)
{
return this->position && this->clock && this->position->clock.id != this->clock->id;
}
@ -280,7 +280,7 @@ static inline bool is_slaved(struct impl *this)
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *this = object;
bool slaved;
bool following;
spa_return_val_if_fail(this != NULL, -EINVAL);
@ -295,11 +295,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return -ENOENT;
}
slaved = is_slaved(this);
if (this->started && slaved != this->slaved) {
spa_log_debug(this->log, NAME " %p: reslave %d->%d", this, this->slaved, slaved);
this->slaved = slaved;
spa_loop_invoke(this->data_loop, do_reslave, 0, NULL, 0, true, this);
following = is_following(this);
if (this->started && following != this->following) {
spa_log_debug(this->log, NAME " %p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_reassign_follower, 0, NULL, 0, true, this);
}
return 0;
}
@ -626,7 +626,7 @@ static int flush_data(struct impl *this, uint64_t now_time)
spa_log_trace(this->log, NAME" %p: %"PRIu64" %"PRIi64" %"PRIu64" %"PRIu64" %d", this,
now_time, queued, this->sample_time, elapsed, this->write_samples);
if (!this->slaved) {
if (!this->following) {
if (queued < FILL_FRAMES * this->write_samples) {
queued = (FILL_FRAMES + 1) * this->write_samples;
if (this->sample_time < elapsed) {
@ -797,9 +797,9 @@ static int do_start(struct impl *this)
if (this->started)
return 0;
this->slaved = is_slaved(this);
this->following = is_following(this);
spa_log_debug(this->log, NAME " %p: start slaved:%d", this, this->slaved);
spa_log_debug(this->log, NAME " %p: start following:%d", this, this->following);
if ((res = spa_bt_transport_acquire(this->transport, false)) < 0)
return res;

View file

@ -113,7 +113,7 @@ struct impl {
struct port port;
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
struct spa_source source;
@ -216,7 +216,7 @@ static int impl_node_enum_params(void *object, int seq,
return 0;
}
static int do_reslave(struct spa_loop *loop,
static int do_reassing_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -226,7 +226,7 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
static inline bool is_slaved(struct impl *this)
static inline bool is_following(struct impl *this)
{
return this->position && this->clock && this->position->clock.id != this->clock->id;
}
@ -234,7 +234,7 @@ static inline bool is_slaved(struct impl *this)
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *this = object;
bool slaved;
bool following;
spa_return_val_if_fail(this != NULL, -EINVAL);
@ -249,11 +249,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return -ENOENT;
}
slaved = is_slaved(this);
if (this->started && slaved != this->slaved) {
spa_log_debug(this->log, NAME" %p: reslave %d->%d", this, this->slaved, slaved);
this->slaved = slaved;
spa_loop_invoke(this->data_loop, do_reslave, 0, NULL, 0, true, this);
following = is_following(this);
if (this->started && following != this->following) {
spa_log_debug(this->log, NAME" %p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_reassing_follower, 0, NULL, 0, true, this);
}
return 0;
}

View file

@ -112,7 +112,7 @@ struct impl {
/* Flags */
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
/* Sources */
struct spa_source source;
@ -238,7 +238,7 @@ static void set_timeout(struct impl *this, time_t sec, long nsec)
static void reset_timeout(struct impl *this)
{
set_timeout(this, 0, this->slaved ? 0 : 1);
set_timeout(this, 0, this->following ? 0 : 1);
}
@ -246,8 +246,8 @@ static void set_next_timeout(struct impl *this, uint64_t now_time)
{
struct port *port = &this->port;
/* Set the next timeout if not slaved, otherwise reset values */
if (!this->slaved) {
/* Set the next timeout if not following, otherwise reset values */
if (!this->following) {
/* Get the elapsed time */
uint64_t elapsed_time = 0;
if (now_time > this->start_time)
@ -271,7 +271,7 @@ static void set_next_timeout(struct impl *this, uint64_t now_time)
}
}
static int do_reslave(struct spa_loop *loop,
static int do_reassign_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -283,7 +283,7 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
static inline bool is_slaved(struct impl *this)
static inline bool is_following(struct impl *this)
{
return this->position && this->clock && this->position->clock.id != this->clock->id;
}
@ -291,7 +291,7 @@ static inline bool is_slaved(struct impl *this)
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *this = object;
bool slaved;
bool following;
spa_return_val_if_fail(object != NULL, -EINVAL);
@ -306,11 +306,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return -ENOENT;
}
slaved = is_slaved(this);
if (this->started && slaved != this->slaved) {
spa_log_debug(this->log, "sco-sink %p: reslave %d->%d", this, this->slaved, slaved);
this->slaved = slaved;
spa_loop_invoke(this->data_loop, do_reslave, 0, NULL, 0, true, this);
following = is_following(this);
if (this->started && following != this->following) {
spa_log_debug(this->log, "sco-sink %p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_reassign_follower, 0, NULL, 0, true, this);
}
return 0;
}
@ -505,8 +505,8 @@ static int do_start(struct impl *this)
/* Make sure the transport is valid */
spa_return_val_if_fail (this->transport != NULL, -EIO);
/* Set the slaved flag */
this->slaved = is_slaved(this);
/* Set the following flag */
this->following = is_following(this);
/* Do accept if Gateway; otherwise do connect for Head Unit */
do_accept = this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY;

View file

@ -108,7 +108,7 @@ struct impl {
struct port port;
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
struct spa_source source;
@ -209,7 +209,7 @@ static int impl_node_enum_params(void *object, int seq,
return 0;
}
static int do_reslave(struct spa_loop *loop,
static int do_reassign_follower(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -219,7 +219,7 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
static inline bool is_slaved(struct impl *this)
static inline bool is_following(struct impl *this)
{
return this->position && this->clock && this->position->clock.id != this->clock->id;
}
@ -227,7 +227,7 @@ static inline bool is_slaved(struct impl *this)
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *this = object;
bool slaved;
bool following;
spa_return_val_if_fail(this != NULL, -EINVAL);
@ -242,11 +242,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return -ENOENT;
}
slaved = is_slaved(this);
if (this->started && slaved != this->slaved) {
spa_log_debug(this->log, "sco-source %p: reslave %d->%d", this, this->slaved, slaved);
this->slaved = slaved;
spa_loop_invoke(this->data_loop, do_reslave, 0, NULL, 0, true, this);
following = is_following(this);
if (this->started && following != this->following) {
spa_log_debug(this->log, "sco-source %p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_reassign_follower, 0, NULL, 0, true, this);
}
return 0;
}

View file

@ -52,9 +52,9 @@ struct impl {
struct spa_node *target;
struct spa_hook target_listener;
struct spa_node *slave;
struct spa_hook slave_listener;
uint32_t slave_flags;
struct spa_node *follower;
struct spa_hook follower_listener;
uint32_t follower_flags;
struct spa_handle *hnd_convert;
struct spa_node *convert;
@ -116,7 +116,7 @@ next:
case SPA_PARAM_EnumFormat:
case SPA_PARAM_Format:
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
id, &start, filter, &param, &b)) != 1)
return res;
@ -150,11 +150,11 @@ static int link_io(struct impl *this)
spa_zero(this->io_rate_match);
this->io_rate_match.rate = 1.0;
if ((res = spa_node_port_set_io(this->slave,
if ((res = spa_node_port_set_io(this->follower,
this->direction, 0,
SPA_IO_RateMatch,
&this->io_rate_match, sizeof(this->io_rate_match))) < 0) {
spa_log_warn(this->log, NAME " %p: set RateMatch on slave failed %d %s", this,
spa_log_warn(this->log, NAME " %p: set RateMatch on follower failed %d %s", this,
res, spa_strerror(res));
}
else if ((res = spa_node_port_set_io(this->convert,
@ -167,11 +167,11 @@ static int link_io(struct impl *this)
spa_zero(this->io_buffers);
if ((res = spa_node_port_set_io(this->slave,
if ((res = spa_node_port_set_io(this->follower,
this->direction, 0,
SPA_IO_Buffers,
&this->io_buffers, sizeof(this->io_buffers))) < 0) {
spa_log_warn(this->log, NAME " %p: set Buffers on slave failed %d %s", this,
spa_log_warn(this->log, NAME " %p: set Buffers on follower failed %d %s", this,
res, spa_strerror(res));
return res;
}
@ -216,13 +216,13 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
case SPA_PARAM_PortConfig:
if (this->started)
return -EIO;
if (this->target != this->slave) {
if (this->target != this->follower) {
if ((res = spa_node_set_param(this->target, id, flags, param)) < 0)
return res;
}
break;
case SPA_PARAM_Props:
if (this->target != this->slave) {
if (this->target != this->follower) {
if ((res = spa_node_set_param(this->target, id, flags, param)) < 0)
return res;
@ -248,8 +248,8 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
if (this->target)
res = spa_node_set_io(this->target, id, data, size);
if (this->target != this->slave)
res = spa_node_set_io(this->slave, id, data, size);
if (this->target != this->follower)
res = spa_node_set_io(this->follower, id, data, size);
return res;
}
@ -278,9 +278,9 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
return res;
}
if (this->target != this->slave) {
if ((res = spa_node_send_command(this->slave, command)) < 0) {
spa_log_error(this->log, NAME " %p: can't start slave: %s",
if (this->target != this->follower) {
if ((res = spa_node_send_command(this->follower, command)) < 0) {
spa_log_error(this->log, NAME " %p: can't start follower: %s",
this, spa_strerror(res));
return res;
}
@ -320,7 +320,7 @@ static const struct spa_node_events target_node_events = {
.result = target_result,
};
static void slave_info(void *data, const struct spa_node_info *info)
static void follower_info(void *data, const struct spa_node_info *info)
{
struct impl *this = data;
const char *str;
@ -330,7 +330,7 @@ static void slave_info(void *data, const struct spa_node_info *info)
else
this->direction = SPA_DIRECTION_OUTPUT;
spa_log_debug(this->log, NAME" %p: slave info %s", this,
spa_log_debug(this->log, NAME" %p: follower info %s", this,
this->direction == SPA_DIRECTION_INPUT ?
"Input" : "Output");
@ -340,12 +340,12 @@ static void slave_info(void *data, const struct spa_node_info *info)
}
}
static const struct spa_node_events slave_node_events = {
static const struct spa_node_events follower_node_events = {
SPA_VERSION_NODE_EVENTS,
.info = slave_info,
.info = follower_info,
};
static int slave_ready(void *data, int status)
static int follower_ready(void *data, int status)
{
struct impl *this = data;
@ -357,7 +357,7 @@ static int slave_ready(void *data, int status)
return spa_node_call_ready(&this->callbacks, status);
}
static int slave_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
static int follower_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
{
int res;
struct impl *this = data;
@ -370,10 +370,10 @@ static int slave_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
return res;
}
static const struct spa_node_callbacks slave_node_callbacks = {
static const struct spa_node_callbacks follower_node_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.ready = slave_ready,
.reuse_buffer = slave_reuse_buffer,
.ready = follower_ready,
.reuse_buffer = follower_reuse_buffer,
};
static int impl_node_add_listener(void *object,
@ -424,7 +424,7 @@ impl_node_sync(void *object, int seq)
spa_return_val_if_fail(this != NULL, -EINVAL);
return spa_node_sync(this->slave, seq);
return spa_node_sync(this->follower, seq);
}
static int
@ -525,12 +525,12 @@ static int negotiate_format(struct impl *this)
state = 0;
format = NULL;
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
SPA_PARAM_EnumFormat, &state,
format, &format, &b)) < 0) {
debug_params(this, this->slave, this->direction, 0,
SPA_PARAM_EnumFormat, format, "slave format", res);
debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_EnumFormat, format, "follower format", res);
return -ENOTSUP;
}
@ -555,7 +555,7 @@ static int negotiate_format(struct impl *this)
format)) < 0)
return res;
if ((res = spa_node_port_set_param(this->slave,
if ((res = spa_node_port_set_param(this->follower,
this->direction, 0,
SPA_PARAM_Format, 0,
format)) < 0)
@ -571,11 +571,11 @@ static int negotiate_buffers(struct impl *this)
uint32_t state;
struct spa_pod *param;
int res, i;
bool slave_alloc, conv_alloc;
bool follower_alloc, conv_alloc;
int32_t size, buffers, blocks, align, flags;
uint32_t *aligns;
struct spa_data *datas;
uint32_t slave_flags, conv_flags;
uint32_t follower_flags, conv_flags;
spa_log_debug(this->log, "%p: %d", this, this->n_buffers);
@ -584,12 +584,12 @@ static int negotiate_buffers(struct impl *this)
state = 0;
param = NULL;
if ((res = spa_node_port_enum_params_sync(this->slave,
if ((res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
SPA_PARAM_Buffers, &state,
param, &param, &b)) < 0) {
debug_params(this, this->slave, this->direction, 0,
SPA_PARAM_Buffers, param, "slave buffers", res);
debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_Buffers, param, "follower buffers", res);
return -ENOTSUP;
}
@ -606,17 +606,17 @@ static int negotiate_buffers(struct impl *this)
spa_pod_fixate(param);
slave_flags = this->slave_flags;
follower_flags = this->follower_flags;
conv_flags = this->convert_flags;
slave_alloc = SPA_FLAG_IS_SET(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
follower_alloc = SPA_FLAG_IS_SET(follower_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
conv_alloc = SPA_FLAG_IS_SET(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
flags = 0;
if (conv_alloc || slave_alloc) {
if (conv_alloc || follower_alloc) {
flags |= SPA_BUFFER_ALLOC_FLAG_NO_DATA;
if (conv_alloc)
slave_alloc = false;
follower_alloc = false;
}
if ((res = spa_pod_parse_object(param,
@ -628,7 +628,7 @@ static int negotiate_buffers(struct impl *this)
return res;
spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d %d:%d",
this, buffers, blocks, size, align, slave_alloc, conv_alloc);
this, buffers, blocks, size, align, follower_alloc, conv_alloc);
datas = alloca(sizeof(struct spa_data) * blocks);
memset(datas, 0, sizeof(struct spa_data) * blocks);
@ -652,9 +652,9 @@ static int negotiate_buffers(struct impl *this)
this->buffers, this->n_buffers)) < 0)
return res;
if ((res = spa_node_port_use_buffers(this->slave,
if ((res = spa_node_port_use_buffers(this->follower,
this->direction, 0,
slave_alloc ? SPA_NODE_BUFFERS_FLAG_ALLOC : 0,
follower_alloc ? SPA_NODE_BUFFERS_FLAG_ALLOC : 0,
this->buffers, this->n_buffers)) < 0) {
return res;
}
@ -770,7 +770,7 @@ static int impl_node_process(void *object)
status = spa_node_process(this->convert);
}
status = spa_node_process(this->slave);
status = spa_node_process(this->follower);
if (this->monitor)
status |= SPA_STATUS_HAVE_DATA;
@ -826,8 +826,8 @@ static int impl_clear(struct spa_handle *handle)
this = (struct impl *) handle;
spa_hook_remove(&this->slave_listener);
spa_node_set_callbacks(this->slave, NULL, NULL);
spa_hook_remove(&this->follower_listener);
spa_node_set_callbacks(this->follower, NULL, NULL);
if (this->buffers)
free(this->buffers);
@ -875,16 +875,16 @@ impl_init(const struct spa_handle_factory *factory,
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
if (info == NULL || (str = spa_dict_lookup(info, "video.adapt.slave")) == NULL)
if (info == NULL || (str = spa_dict_lookup(info, "video.adapt.follower")) == NULL)
return -EINVAL;
sscanf(str, "pointer:%p", &this->slave);
if (this->slave == NULL)
sscanf(str, "pointer:%p", &this->follower);
if (this->follower == NULL)
return -EINVAL;
spa_node_add_listener(this->slave,
&this->slave_listener, &slave_node_events, this);
spa_node_set_callbacks(this->slave, &slave_node_callbacks, this);
spa_node_add_listener(this->follower,
&this->follower_listener, &follower_node_events, this);
spa_node_set_callbacks(this->follower, &follower_node_callbacks, this);
this->node.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_Node,
@ -908,7 +908,7 @@ impl_init(const struct spa_handle_factory *factory,
link_io(this);
#else
this->target = this->slave;
this->target = this->follower;
spa_node_add_listener(this->target,
&this->target_listener, &target_node_events, this);