use dictionary for extra port info

This commit is contained in:
Wim Taymans 2016-10-14 10:42:02 +02:00
parent d79489b29b
commit becae3e7fa
9 changed files with 14 additions and 13 deletions

View file

@ -28,6 +28,7 @@ typedef struct _SpaAllocParam SpaAllocParam;
#include <spa/defs.h>
#include <spa/buffer.h>
#include <spa/dict.h>
#define SPA_ALLOC_PARAM_URI "http://spaplug.in/ns/alloc-param"
#define SPA_ALLOC_PARAM_PREFIX SPA_ALLOC_PARAM_URI "#"
@ -110,7 +111,7 @@ typedef enum {
* @latency: latency on this port in nanoseconds
* @params: extra allocation parameters
* @n_params: number of elements in @params;
* @features: NULL terminated array of extra port features
* @extra: a dictionary of extra port info
*
*/
typedef struct {
@ -119,7 +120,7 @@ typedef struct {
uint64_t latency;
SpaAllocParam **params;
unsigned int n_params;
const char **features;
SpaDict *extra;
} SpaPortInfo;

View file

@ -136,7 +136,7 @@ typedef struct {
* @range_type: type of the range values
* @n_range_values: number of elements in @range_values
* @range_values: array of possible values
* @info: extra info
* @extra: extra info
*/
typedef struct {
uint32_t id;
@ -148,7 +148,7 @@ typedef struct {
SpaPropRangeType range_type;
unsigned int n_range_values;
const SpaPropRangeInfo *range_values;
SpaDict *info;
SpaDict *extra;
} SpaPropInfo;
/**

View file

@ -432,9 +432,9 @@ spa_debug_props (const SpaProps *props, bool print_ranges)
fprintf (stderr, "\t: %-12s\n", rinfo->name);
}
}
if (info->info) {
fprintf (stderr, "Info: \n");
spa_debug_dict (info->info);
if (info->extra) {
fprintf (stderr, "Extra info: \n");
spa_debug_dict (info->extra);
}
}
return SPA_RESULT_OK;

View file

@ -62,7 +62,7 @@ spa_port_info_serialize (void *p, const SpaPortInfo *info)
pi->params = SPA_INT_TO_PTR (SPA_PTRDIFF (ap, pi));
else
pi->params = 0;
pi->features = 0;
pi->extra = 0;
p = SPA_MEMBER (ap, sizeof (SpaAllocParam*) * info->n_params, void);

View file

@ -341,7 +341,7 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
this->param_buffers.min_buffers = 1;
this->param_buffers.max_buffers = 8;
this->param_buffers.align = 16;
this->info.features = NULL;
this->info.extra = NULL;
this->have_format = true;
update_state (this, SPA_NODE_STATE_READY);

View file

@ -375,7 +375,7 @@ spa_alsa_source_node_port_set_format (SpaNode *node,
this->param_meta.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta.param.size = sizeof (this->param_meta);
this->param_meta.type = SPA_META_TYPE_HEADER;
this->info.features = NULL;
this->info.extra = NULL;
this->have_format = true;

View file

@ -583,7 +583,7 @@ spa_audiotestsrc_node_port_set_format (SpaNode *node,
this->param_meta.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta.param.size = sizeof (this->param_meta);
this->param_meta.type = SPA_META_TYPE_HEADER;
this->info.features = NULL;
this->info.extra = NULL;
update_state (this, SPA_NODE_STATE_READY);
}
else

View file

@ -816,7 +816,7 @@ spa_v4l2_set_format (SpaV4l2Source *this, V4l2Format *f, bool try_only)
state->param_meta.param.size = sizeof (state->param_meta);
state->param_meta.type = SPA_META_TYPE_HEADER;
state->info.features = NULL;
state->info.extra = NULL;
return 0;
}

View file

@ -532,7 +532,7 @@ spa_videotestsrc_node_port_set_format (SpaNode *node,
this->param_meta.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta.param.size = sizeof (this->param_meta);
this->param_meta.type = SPA_META_TYPE_HEADER;
this->info.features = NULL;
this->info.extra = NULL;
update_state (this, SPA_NODE_STATE_READY);
}
else