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

@ -82,6 +82,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 monitor_count;
bool started;
uint32_t cpu_flags;
convert_func_t convert;
bool monitor;
@ -576,10 +578,10 @@ static int setup_convert(struct impl *this)
outport->format.info.raw.channels,
outport->format.info.raw.rate);
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;
@ -1063,10 +1065,19 @@ 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);
if (info != NULL && (str = spa_dict_lookup(info, "merger.monitor")) != NULL)
this->monitor = atoi(str);