format: make media types and properties dynamic

Use URI properties to dynamically register the media types/subtypes and
property names. Add some helpers to set up the mappings.
This commit is contained in:
Wim Taymans 2017-03-21 11:28:23 +01:00
parent ee470fc6c6
commit 3f5a3e215b
25 changed files with 769 additions and 685 deletions

View file

@ -45,6 +45,7 @@ id_map_get_id (SpaIDMap *map, const char *uri)
if (strcmp (this->uris[i], uri) == 0)
return i;
}
printf ("spa adding %d %s\n", i, uri);
this->uris[i] = (char *)uri;
this->n_uris++;
}
@ -56,6 +57,8 @@ id_map_get_uri (SpaIDMap *map, uint32_t id)
{
IDMap *this = SPA_CONTAINER_OF (map, IDMap, map);
printf ("spa get %d\n", id);
if (id < this->n_uris)
return this->uris[id];
return 0;
@ -71,8 +74,16 @@ static IDMap default_id_map = {
0
};
static SpaIDMap *default_map = &default_id_map.map;
SpaIDMap *
spa_id_map_get_default (void)
{
return &default_id_map.map;
return default_map;
}
void
spa_id_map_set_default (SpaIDMap *map)
{
default_map = map;
}