buffer: document memory type when allocating

When allocating buffers the type will contain a bitmask of
allowed types.
This commit is contained in:
Wim Taymans 2020-03-02 17:21:16 +01:00
parent c8633767e7
commit fef0e17b76
2 changed files with 4 additions and 1 deletions

View file

@ -63,7 +63,9 @@ struct spa_chunk {
/** Data for a buffer this stays constant for a buffer */
struct spa_data {
uint32_t type; /**< memory type, one of enum spa_data_type */
uint32_t type; /**< memory type, one of enum spa_data_type, when
* allocating memory, the type contains a bitmask
* of allowed types */
#define SPA_DATA_FLAG_NONE 0
#define SPA_DATA_FLAG_READABLE (1u<<0) /**< data is readable */
#define SPA_DATA_FLAG_WRITABLE (1u<<1) /**< data is writable */

View file

@ -103,6 +103,7 @@ static int alloc_buffers(struct pw_mempool *pool,
d->maxsize = data_sizes[i];
SPA_FLAG_SET(d->flags, SPA_DATA_FLAG_READWRITE);
} else {
/* type is a bitmask of allowed types */
d->type = SPA_ID_INVALID;
d->maxsize = 0;
}