small cleanups

Remove the temp storage for formats and props now that we get a builder
from the host to write into.
This commit is contained in:
Wim Taymans 2017-11-07 20:28:07 +01:00
parent f3bca48398
commit 4d890a2d98
9 changed files with 7 additions and 48 deletions

View file

@ -240,16 +240,6 @@ impl_node_port_get_info(struct spa_node *node,
return SPA_RESULT_OK;
}
static int port_enum_formats(struct spa_node *node,
enum spa_direction direction, uint32_t port_id,
uint32_t *index,
const struct spa_pod_object *filter,
struct spa_pod_builder *builder)
{
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
return spa_alsa_enum_format(this, index, filter, builder);
}
static int port_get_format(struct spa_node *node,
enum spa_direction direction, uint32_t port_id,
uint32_t *index,
@ -262,7 +252,7 @@ static int port_get_format(struct spa_node *node,
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
if(*index > 0)
if (*index > 0)
return SPA_RESULT_ENUM_END;
spa_pod_builder_object(builder,
@ -297,7 +287,7 @@ impl_node_port_enum_params(struct spa_node *node,
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
if (id == t->param.idEnumFormat) {
return port_enum_formats(node, direction, port_id, index, filter, builder);
return spa_alsa_enum_format(this, index, filter, builder);
}
else if (id == t->param.idFormat) {
return port_get_format(node, direction, port_id, index, filter, builder);

View file

@ -254,17 +254,6 @@ static void recycle_buffer(struct state *this, uint32_t buffer_id)
spa_list_append(&this->free, &b->link);
}
static int port_enum_formats(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t *index,
const struct spa_pod_object *filter,
struct spa_pod_builder *builder)
{
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
return spa_alsa_enum_format(this, index, filter, builder);
}
static int port_get_format(struct spa_node *node,
enum spa_direction direction, uint32_t port_id,
uint32_t *index,
@ -311,12 +300,15 @@ impl_node_port_enum_params(struct spa_node *node,
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
if (id == t->param.idEnumFormat) {
return port_enum_formats(node, direction, port_id, index, filter, builder);
return spa_alsa_enum_format(this, index, filter, builder);
}
else if (id == t->param.idFormat) {
return port_get_format(node, direction, port_id, index, filter, builder);
}
else if (id == t->param.idBuffers) {
if (*index > 0)
return SPA_RESULT_ENUM_END;
spa_pod_builder_object(builder,
id, t->param_alloc_buffers.Buffers,
":", t->param_alloc_buffers.size, "i", this->props.min_latency * this->frame_size,

View file

@ -132,7 +132,6 @@ struct state {
bool have_format;
struct spa_audio_info current_format;
uint8_t format_buffer[1024];
snd_pcm_uframes_t buffer_frames;
snd_pcm_uframes_t period_frames;
@ -142,8 +141,6 @@ struct state {
size_t frame_size;
struct spa_port_info info;
uint32_t params[3];
uint8_t params_buffer[1024];
struct spa_port_io *io;
struct buffer buffers[MAX_BUFFERS];