mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a type-casting the result. Rename to SPA_PTROFF which is more expressive (and has the same number of characters so we don't need to re-indent).
This commit is contained in:
parent
e598d0a422
commit
2405f0942b
92 changed files with 248 additions and 227 deletions
|
|
@ -1196,7 +1196,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
|
||||
this->hnd_convert = SPA_MEMBER(this, sizeof(struct impl), struct spa_handle);
|
||||
this->hnd_convert = SPA_PTROFF(this, sizeof(struct impl), struct spa_handle);
|
||||
spa_handle_factory_init(&spa_audioconvert_factory,
|
||||
this->hnd_convert,
|
||||
info, support, n_support);
|
||||
|
|
|
|||
|
|
@ -1288,37 +1288,37 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->info.params = this->params;
|
||||
this->info.n_params = 4;
|
||||
|
||||
this->hnd_merger = SPA_MEMBER(this, sizeof(struct impl), struct spa_handle);
|
||||
this->hnd_merger = SPA_PTROFF(this, sizeof(struct impl), struct spa_handle);
|
||||
spa_handle_factory_init(&spa_merger_factory,
|
||||
this->hnd_merger,
|
||||
info, support, n_support);
|
||||
size = spa_handle_factory_get_size(&spa_merger_factory, info);
|
||||
|
||||
this->hnd_convert_in = SPA_MEMBER(this->hnd_merger, size, struct spa_handle);
|
||||
this->hnd_convert_in = SPA_PTROFF(this->hnd_merger, size, struct spa_handle);
|
||||
spa_handle_factory_init(&spa_fmtconvert_factory,
|
||||
this->hnd_convert_in,
|
||||
info, support, n_support);
|
||||
size = spa_handle_factory_get_size(&spa_fmtconvert_factory, info);
|
||||
|
||||
this->hnd_channelmix = SPA_MEMBER(this->hnd_convert_in, size, struct spa_handle);
|
||||
this->hnd_channelmix = SPA_PTROFF(this->hnd_convert_in, size, struct spa_handle);
|
||||
spa_handle_factory_init(&spa_channelmix_factory,
|
||||
this->hnd_channelmix,
|
||||
info, support, n_support);
|
||||
size = spa_handle_factory_get_size(&spa_channelmix_factory, info);
|
||||
|
||||
this->hnd_resample = SPA_MEMBER(this->hnd_channelmix, size, struct spa_handle);
|
||||
this->hnd_resample = SPA_PTROFF(this->hnd_channelmix, size, struct spa_handle);
|
||||
spa_handle_factory_init(&spa_resample_factory,
|
||||
this->hnd_resample,
|
||||
info, support, n_support);
|
||||
size = spa_handle_factory_get_size(&spa_resample_factory, info);
|
||||
|
||||
this->hnd_convert_out = SPA_MEMBER(this->hnd_resample, size, struct spa_handle);
|
||||
this->hnd_convert_out = SPA_PTROFF(this->hnd_resample, size, struct spa_handle);
|
||||
spa_handle_factory_init(&spa_fmtconvert_factory,
|
||||
this->hnd_convert_out,
|
||||
info, support, n_support);
|
||||
size = spa_handle_factory_get_size(&spa_fmtconvert_factory, info);
|
||||
|
||||
this->hnd_splitter = SPA_MEMBER(this->hnd_convert_out, size, struct spa_handle);
|
||||
this->hnd_splitter = SPA_PTROFF(this->hnd_convert_out, size, struct spa_handle);
|
||||
spa_handle_factory_init(&spa_splitter_factory,
|
||||
this->hnd_splitter,
|
||||
info, support, n_support);
|
||||
|
|
|
|||
|
|
@ -891,7 +891,7 @@ static int impl_node_process(void *object)
|
|||
struct spa_data *sd = &inb->datas[src_remap];
|
||||
offs = SPA_MIN(sd->chunk->offset, sd->maxsize);
|
||||
size = SPA_MIN(size, SPA_MIN(sd->maxsize - offs, sd->chunk->size));
|
||||
src_datas[i] = SPA_MEMBER(sd->data, offs, void);
|
||||
src_datas[i] = SPA_PTROFF(sd->data, offs, void);
|
||||
}
|
||||
n_samples = size / inport->stride;
|
||||
|
||||
|
|
|
|||
|
|
@ -1267,7 +1267,7 @@ static int impl_node_process(void *object)
|
|||
|
||||
sd = &sbuf->buf->datas[0];
|
||||
|
||||
src_datas[i] = SPA_MEMBER(sd->data, sd->chunk->offset, void);
|
||||
src_datas[i] = SPA_PTROFF(sd->data, sd->chunk->offset, void);
|
||||
|
||||
n_samples = SPA_MIN(n_samples, sd->chunk->size / inport->stride);
|
||||
|
||||
|
|
|
|||
|
|
@ -370,13 +370,13 @@ int resample_native_init(struct resample *r)
|
|||
d->n_phases = n_phases;
|
||||
d->in_rate = in_rate;
|
||||
d->out_rate = out_rate;
|
||||
d->filter = SPA_MEMBER_ALIGN(d, sizeof(struct native_data), 64, float);
|
||||
d->hist_mem = SPA_MEMBER_ALIGN(d->filter, filter_size, 64, float);
|
||||
d->history = SPA_MEMBER(d->hist_mem, history_size, float*);
|
||||
d->filter = SPA_PTROFF_ALIGN(d, sizeof(struct native_data), 64, float);
|
||||
d->hist_mem = SPA_PTROFF_ALIGN(d->filter, filter_size, 64, float);
|
||||
d->history = SPA_PTROFF(d->hist_mem, history_size, float*);
|
||||
d->filter_stride = filter_stride / sizeof(float);
|
||||
d->filter_stride_os = d->filter_stride * oversample;
|
||||
for (c = 0; c < r->channels; c++)
|
||||
d->history[c] = SPA_MEMBER(d->hist_mem, c * history_stride, float);
|
||||
d->history[c] = SPA_PTROFF(d->hist_mem, c * history_stride, float);
|
||||
|
||||
build_filter(d->filter, d->filter_stride, n_taps, n_phases, scale);
|
||||
|
||||
|
|
|
|||
|
|
@ -849,10 +849,10 @@ static int impl_node_process(void *object)
|
|||
flush_in = draining = true;
|
||||
} else {
|
||||
for (i = 0; i < sb->n_datas; i++)
|
||||
src_datas[i] = SPA_MEMBER(sb->datas[i].data, inport->offset, void);
|
||||
src_datas[i] = SPA_PTROFF(sb->datas[i].data, inport->offset, void);
|
||||
}
|
||||
for (i = 0; i < db->n_datas; i++)
|
||||
dst_datas[i] = SPA_MEMBER(db->datas[i].data, outport->offset, void);
|
||||
dst_datas[i] = SPA_PTROFF(db->datas[i].data, outport->offset, void);
|
||||
|
||||
in_len = (size - inport->offset) / sizeof(float);
|
||||
out_len = (maxsize - outport->offset) / sizeof(float);
|
||||
|
|
|
|||
|
|
@ -920,7 +920,7 @@ static int impl_node_process(void *object)
|
|||
|
||||
maxsize = INT_MAX;
|
||||
for (i = 0; i < n_src_datas; i++) {
|
||||
src_datas[i] = SPA_MEMBER(sd[i].data,
|
||||
src_datas[i] = SPA_PTROFF(sd[i].data,
|
||||
sd[i].chunk->offset, void);
|
||||
maxsize = SPA_MIN(sd[i].chunk->size, maxsize);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue