mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
id-map: add get_size method
This commit is contained in:
parent
ff659ad1a7
commit
997aa036ba
2 changed files with 11 additions and 0 deletions
|
|
@ -62,11 +62,19 @@ id_map_get_uri (SpaIDMap *map, uint32_t id)
|
||||||
return NULL;
|
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 = {
|
static IDMap default_id_map = {
|
||||||
{ sizeof (SpaIDMap),
|
{ sizeof (SpaIDMap),
|
||||||
NULL,
|
NULL,
|
||||||
id_map_get_id,
|
id_map_get_id,
|
||||||
id_map_get_uri,
|
id_map_get_uri,
|
||||||
|
id_map_get_size,
|
||||||
},
|
},
|
||||||
{ { NULL, } },
|
{ { NULL, } },
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,13 @@ struct _SpaIDMap {
|
||||||
|
|
||||||
const char * (*get_uri) (SpaIDMap *map,
|
const char * (*get_uri) (SpaIDMap *map,
|
||||||
uint32_t id);
|
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_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_uri(n,...) (n)->get_uri((n),__VA_ARGS__)
|
||||||
|
#define spa_id_map_get_size(n) (n)->get_size(n)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue