alloc-params: use dynamic types for alloc-params

This commit is contained in:
Wim Taymans 2017-03-23 10:12:20 +01:00
parent 7270986c3a
commit 048a4b81a8
21 changed files with 166 additions and 271 deletions

View file

@ -70,6 +70,8 @@ typedef struct {
SpaAudioFormats audio_formats;
SpaNodeEvents node_events;
SpaNodeCommands node_commands;
SpaAllocParamBuffers alloc_param_buffers;
SpaAllocParamMetaEnable alloc_param_meta_enable;
} URI;
struct _SpaVolume {
@ -382,15 +384,15 @@ spa_volume_node_port_set_format (SpaNode *node,
port->info.params = port->params;
spa_pod_builder_init (&b, port->params_buffer, sizeof (port->params_buffer));
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_BUFFERS,
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, 16),
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 16),
PROP_U_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, 16),
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 16),
PROP_U_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
PROP (&f[1], this->uri.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
port->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
port->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
port->info.extra = NULL;
@ -844,6 +846,8 @@ volume_init (const SpaHandleFactory *factory,
spa_audio_formats_map (this->map, &this->uri.audio_formats);
spa_node_events_map (this->map, &this->uri.node_events);
spa_node_commands_map (this->map, &this->uri.node_commands);
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
this->node = volume_node;
reset_volume_props (&this->props);