audioconvert: use cpu detection interface

This commit is contained in:
Wim Taymans 2018-12-17 13:26:54 +01:00
parent e984c19f6c
commit 4dfe1011a6
6 changed files with 65 additions and 20 deletions

View file

@ -83,6 +83,7 @@ struct impl {
struct spa_node node;
struct spa_log *log;
struct spa_cpu *cpu;
const struct spa_node_callbacks *callbacks;
void *user_data;
@ -92,6 +93,7 @@ struct impl {
int port_count;
bool started;
uint32_t cpu_flags;
convert_func_t convert;
bool have_profile;
@ -569,10 +571,10 @@ static int setup_convert(struct impl *this)
inport->format.info.raw.rate,
this->port_count);
conv = find_conv_info(src_fmt, dst_fmt, FEATURE_DEFAULT);
conv = find_conv_info(src_fmt, dst_fmt, this->cpu_flags);
if (conv != NULL) {
spa_log_info(this->log, NAME " %p: got converter features %08x", this,
conv->features);
spa_log_info(this->log, NAME " %p: got converter features %08x:%08x", this,
this->cpu_flags, conv->features);
this->convert = conv->func;
return 0;
@ -1006,9 +1008,17 @@ impl_init(const struct spa_handle_factory *factory,
this = (struct impl *) handle;
for (i = 0; i < n_support; i++) {
if (support[i].type == SPA_TYPE_INTERFACE_Log)
switch (support[i].type) {
case SPA_TYPE_INTERFACE_Log:
this->log = support[i].data;
break;
case SPA_TYPE_INTERFACE_CPU:
this->cpu = support[i].data;
break;
}
}
if (this->cpu)
this->cpu_flags = spa_cpu_get_flags(this->cpu);
this->node = impl_node;