diff --git a/pinos/client/mapper.c b/pinos/client/mapper.c index f0acba99b..511f5fb2d 100644 --- a/pinos/client/mapper.c +++ b/pinos/client/mapper.c @@ -62,11 +62,19 @@ id_map_get_uri (SpaIDMap *map, uint32_t id) return NULL; } +static uint32_t +id_map_get_size (SpaIDMap *map) +{ + IDMap *this = SPA_CONTAINER_OF (map, IDMap, map); + return pinos_map_get_size (&this->uris); +} + static IDMap default_id_map = { { sizeof (SpaIDMap), NULL, id_map_get_id, id_map_get_uri, + id_map_get_size, }, { { NULL, } }, }; diff --git a/spa/include/spa/id-map.h b/spa/include/spa/id-map.h index 5dfb08c23..fe69bbad3 100644 --- a/spa/include/spa/id-map.h +++ b/spa/include/spa/id-map.h @@ -52,10 +52,13 @@ struct _SpaIDMap { const char * (*get_uri) (SpaIDMap *map, uint32_t id); + + uint32_t (*get_size) (SpaIDMap *map); }; #define spa_id_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__) #define spa_id_map_get_uri(n,...) (n)->get_uri((n),__VA_ARGS__) +#define spa_id_map_get_size(n) (n)->get_size(n) #ifdef __cplusplus } /* extern "C" */