From df5c81e3bed9d1221f7bb8036d9f38553d11eb50 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 21 Mar 2019 10:38:21 +0100 Subject: [PATCH] buffer: add DYNAMIC data flag Add a flag to mark when a buffer data pointer can change. Improve docs for port flags --- spa/include/spa/buffer/buffer.h | 3 ++- spa/include/spa/node/node.h | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/spa/include/spa/buffer/buffer.h b/spa/include/spa/buffer/buffer.h index 462b93bb4..65223ada7 100644 --- a/spa/include/spa/buffer/buffer.h +++ b/spa/include/spa/buffer/buffer.h @@ -62,7 +62,8 @@ struct spa_chunk { struct spa_data { uint32_t type; /**< memory type, one of enum spa_data_type */ #define SPA_DATA_FLAG_NONE 0 -#define SPA_DATA_FLAG_CORRUPTED (1<<0) /**< data is corrupted in some way */ +#define SPA_DATA_FLAG_CORRUPTED (1u<<0) /**< data is corrupted in some way */ +#define SPA_DATA_FLAG_DYNAMIC (1u<<1) /**< data pointer can be changed */ uint32_t flags; /**< data flags */ int64_t fd; /**< optional fd for data */ uint32_t mapoffset; /**< offset to map fd at */ diff --git a/spa/include/spa/node/node.h b/spa/include/spa/node/node.h index a9c731de4..f2232da7e 100644 --- a/spa/include/spa/node/node.h +++ b/spa/include/spa/node/node.h @@ -85,14 +85,19 @@ struct spa_port_info { #define SPA_PORT_FLAG_CAN_USE_BUFFERS (1u<<3) /**< the port can use a provided buffer */ #define SPA_PORT_FLAG_IN_PLACE (1u<<4) /**< the port can process data in-place and * will need a writable input buffer */ -#define SPA_PORT_FLAG_NO_REF (1u<<5) /**< the port does not keep a ref on the buffer */ +#define SPA_PORT_FLAG_NO_REF (1u<<5) /**< the port does not keep a ref on the buffer. + * This means the node will always completely + * consume the input buffer and it will be + * recycled after process. */ #define SPA_PORT_FLAG_LIVE (1u<<6) /**< output buffers from this port are * timestamped against a live clock. */ #define SPA_PORT_FLAG_PHYSICAL (1u<<7) /**< connects to some device */ #define SPA_PORT_FLAG_TERMINAL (1u<<8) /**< data was not created from this port * or will not be made available on another * port */ -#define SPA_PORT_FLAG_DYNAMIC_DATA (1u<<9) /**< data pointer on buffers can be changed */ +#define SPA_PORT_FLAG_DYNAMIC_DATA (1u<<9) /**< data pointer on buffers can be changed. + * Only the buffer data marked as DYNAMIC + * can be changed. */ uint64_t flags; /**< port flags */ struct spa_fraction rate; /**< rate of sequence numbers on port */ const struct spa_dict *props; /**< extra port properties */