simply use INTERFACE_Loop for the main-loop

This commit is contained in:
Wim Taymans 2019-06-06 15:20:43 +02:00
parent 4c2b6c7c91
commit 86dc0496a5
20 changed files with 73 additions and 61 deletions

View file

@ -63,7 +63,6 @@ struct impl {
struct spa_device device;
struct spa_log *log;
struct spa_loop *main_loop;
struct spa_hook_list hooks;
@ -446,14 +445,11 @@ 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;
else if (support[i].type == SPA_TYPE_INTERFACE_MainLoop)
this->main_loop = support[i].data;
}
if (this->main_loop == NULL) {
spa_log_error(this->log, "a main-loop is needed");
return -EINVAL;
break;
}
}
this->device.iface = SPA_INTERFACE_INIT(

View file

@ -444,7 +444,7 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; i < n_support; i++) {
if (support[i].type == SPA_TYPE_INTERFACE_Log)
this->log = support[i].data;
else if (support[i].type == SPA_TYPE_INTERFACE_MainLoop)
else if (support[i].type == SPA_TYPE_INTERFACE_Loop)
this->main_loop = support[i].data;
}
if (this->main_loop == NULL) {

View file

@ -707,19 +707,24 @@ impl_init(const struct spa_handle_factory *factory,
this = (struct state *) 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;
else if (support[i].type == SPA_TYPE_INTERFACE_DataLoop)
break;
case SPA_TYPE_INTERFACE_DataSystem:
this->data_system = support[i].data;
break;
case SPA_TYPE_INTERFACE_DataLoop:
this->data_loop = support[i].data;
else if (support[i].type == SPA_TYPE_INTERFACE_MainLoop)
this->main_loop = support[i].data;
break;
}
}
if (this->data_loop == NULL) {
spa_log_error(this->log, "a data loop is needed");
return -EINVAL;
}
if (this->main_loop == NULL) {
spa_log_error(this->log, "a main loop is needed");
if (this->data_system == NULL) {
spa_log_error(this->log, "a data system is needed");
return -EINVAL;
}

View file

@ -727,19 +727,24 @@ impl_init(const struct spa_handle_factory *factory,
this = (struct state *) 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;
else if (support[i].type == SPA_TYPE_INTERFACE_DataLoop)
break;
case SPA_TYPE_INTERFACE_DataSystem:
this->data_system = support[i].data;
break;
case SPA_TYPE_INTERFACE_DataLoop:
this->data_loop = support[i].data;
else if (support[i].type == SPA_TYPE_INTERFACE_MainLoop)
this->main_loop = support[i].data;
break;
}
}
if (this->data_loop == NULL) {
spa_log_error(this->log, "a data loop is needed");
return -EINVAL;
}
if (this->main_loop == NULL) {
spa_log_error(this->log, "a main loop is needed");
if (this->data_system == NULL) {
spa_log_error(this->log, "a data system is needed");
return -EINVAL;
}

View file

@ -76,7 +76,7 @@ struct state {
struct spa_node node;
struct spa_log *log;
struct spa_loop *main_loop;
struct spa_system *data_system;
struct spa_loop *data_loop;
snd_pcm_stream_t stream;