diff options
author | Wim Taymans <wtaymans@redhat.com> | 2017-11-07 20:28:07 +0100 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2017-11-07 20:28:07 +0100 |
commit | 4d890a2d985ef46897caa34223f65b2267099cfb (patch) | |
tree | ff37590599c41a666c048cff9659636a017cb515 | |
parent | f3bca483980639c73e3e21acf90f35160c95e53e (diff) |
small cleanups
Remove the temp storage for formats and props now that we get a builder
from the host to write into.
-rw-r--r-- | spa/plugins/alsa/alsa-sink.c | 14 | ||||
-rw-r--r-- | spa/plugins/alsa/alsa-source.c | 16 | ||||
-rw-r--r-- | spa/plugins/alsa/alsa-utils.h | 3 | ||||
-rw-r--r-- | spa/plugins/audiomixer/audiomixer.c | 1 | ||||
-rw-r--r-- | spa/plugins/audiotestsrc/audiotestsrc.c | 2 | ||||
-rw-r--r-- | spa/plugins/v4l2/v4l2-source.c | 14 | ||||
-rw-r--r-- | spa/plugins/v4l2/v4l2-utils.c | 1 | ||||
-rw-r--r-- | spa/plugins/videotestsrc/videotestsrc.c | 2 | ||||
-rw-r--r-- | spa/plugins/volume/volume.c | 2 |
9 files changed, 7 insertions, 48 deletions
diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c index 5471a8d0..28bcc237 100644 --- a/spa/plugins/alsa/alsa-sink.c +++ b/spa/plugins/alsa/alsa-sink.c @@ -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); diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 9c5ce098..01c2f6e5 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -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, diff --git a/spa/plugins/alsa/alsa-utils.h b/spa/plugins/alsa/alsa-utils.h index 6d39e664..d70935ee 100644 --- a/spa/plugins/alsa/alsa-utils.h +++ b/spa/plugins/alsa/alsa-utils.h @@ -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]; diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 50dc76ed..f5ac954b 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -114,7 +114,6 @@ struct impl { struct port in_ports[MAX_PORTS]; struct port out_ports[1]; - uint8_t format_buffer[4096]; bool have_format; int n_formats; struct spa_audio_info format; diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index 7bf61cf4..cdc821af 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -122,7 +122,6 @@ struct impl { struct spa_log *log; struct spa_loop *data_loop; - uint8_t props_buffer[512]; struct props props; const struct spa_node_callbacks *callbacks; @@ -137,7 +136,6 @@ struct impl { bool have_format; struct spa_audio_info current_format; - uint8_t format_buffer[1024]; size_t bpf; render_func_t render_func; double accumulator; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 97ad9d1e..a2974870 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -121,7 +121,6 @@ struct port { bool have_format; struct spa_video_info current_format; - uint8_t format_buffer[1024]; int fd; bool opened; @@ -154,7 +153,6 @@ struct impl { uint32_t seq; - uint8_t props_buffer[512]; struct props props; const struct spa_node_callbacks *callbacks; @@ -455,16 +453,6 @@ static int 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 impl *this = SPA_CONTAINER_OF(node, struct impl, node); - return spa_v4l2_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, @@ -547,7 +535,7 @@ static int impl_node_port_enum_params(struct spa_node *node, return SPA_RESULT_ENUM_END; } else if (id == t->param.idEnumFormat) { - return port_enum_formats(node, direction, port_id, index, filter, builder); + return spa_v4l2_enum_format(this, index, filter, builder); } else if (id == t->param.idFormat) { return port_get_format(node, direction, port_id, index, filter, builder); diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 71564ca7..b2908085 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -683,7 +683,6 @@ spa_v4l2_enum_format(struct impl *this, media_subtype = *SPA_MEMBER(&this->type, info->media_subtype_offset, uint32_t); video_format = *SPA_MEMBER(&this->type, info->format_offset, uint32_t); - spa_pod_builder_init(builder, port->format_buffer, sizeof(port->format_buffer)); spa_pod_builder_push_object(builder, &f[0], this->type.param.idEnumFormat, this->type.format); spa_pod_builder_add(builder, diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c index 5f2a3f17..d5667cbd 100644 --- a/spa/plugins/videotestsrc/videotestsrc.c +++ b/spa/plugins/videotestsrc/videotestsrc.c @@ -111,7 +111,6 @@ struct impl { struct spa_log *log; struct spa_loop *data_loop; - uint8_t props_buffer[512]; struct props props; const struct spa_node_callbacks *callbacks; @@ -126,7 +125,6 @@ struct impl { bool have_format; struct spa_video_info current_format; - uint8_t format_buffer[1024]; size_t bpp; int stride; diff --git a/spa/plugins/volume/volume.c b/spa/plugins/volume/volume.c index f618b737..66524364 100644 --- a/spa/plugins/volume/volume.c +++ b/spa/plugins/volume/volume.c @@ -51,7 +51,6 @@ struct port { bool have_format; struct spa_port_info info; - uint8_t params_buffer[1024]; struct buffer buffers[MAX_BUFFERS]; uint32_t n_buffers; @@ -112,7 +111,6 @@ struct impl { const struct spa_node_callbacks *callbacks; void *callbacks_data; - uint8_t format_buffer[1024]; struct spa_audio_info current_format; int bpf; |