From aeebfa8cf21973833f9bd4a6191f2e95dbf87109 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Apr 2012 21:49:16 +0000 Subject: Make feature URI distinct from extension URI. Add return status enumeration. Improve documentation. --- lv2/lv2plug.in/ns/ext/resize-port/resize-port.h | 52 +++++++++++++++---------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'lv2/lv2plug.in/ns/ext/resize-port/resize-port.h') diff --git a/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h index c1419e6..fa3abd7 100644 --- a/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h +++ b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h @@ -20,7 +20,12 @@ #include #include -#define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" +#define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" +#define LV2_RESIZE_PORT_PREFIX LV2_RESIZE_PORT_URI "#" + +#define LV2_RESIZE_PORT__asLargeAs LV2_RESIZE_PORT_PREFIX "asLargeAs" +#define LV2_RESIZE_PORT__minimumSize LV2_RESIZE_PORT_PREFIX "minimumSize" +#define LV2_RESIZE_PORT__resize LV2_RESIZE_PORT_PREFIX "resize" #ifdef __cplusplus extern "C" { @@ -28,31 +33,36 @@ extern "C" { # include #endif +/** A status code for state functions. */ +typedef enum { + LV2_RESIZE_PORT_SUCCESS = 0, /**< Completed successfully. */ + LV2_RESIZE_PORT_ERR_UNKNOWN = 1, /**< Unknown error. */ + LV2_RESIZE_PORT_ERR_NO_SPACE = 2 /**< Insufficient space. */ +} LV2_Resize_Port_Status; + typedef void* LV2_Resize_Port_Feature_Data; typedef struct { LV2_Resize_Port_Feature_Data data; - /** Resize a port buffer to at least @a size bytes. - * - * This function MAY return false, in which case the port buffer was - * not resized and the port is still connected to the same location. - * Plugins MUST gracefully handle this situation. - * - * This function MUST NOT be called from any context other than - * the context associated with the port of the given index. - * - * The host MUST preserve the contents of the port buffer when - * resizing. - * - * Plugins MAY resize a port many times in a single run callback. - * Hosts SHOULD make this an inexpensive as possible (i.e. plugins - * can liberally use this function in a similar way to realloc). - */ - bool (*resize_port)(LV2_Resize_Port_Feature_Data data, - uint32_t index, - size_t size); -} LV2_Resize_Port_Feature; + /** + Resize a port buffer to at least @a size bytes. + + This function MAY return an error, in which case the port buffer was not + resized and the port is still connected to the same location. Plugins + MUST gracefully handle this situation. + + This function is in the audio threading class. + + The host MUST preserve the contents of the port buffer when resizing. + + Plugins MAY resize a port many times in a single run callback. Hosts + SHOULD make this as inexpensive as possible. + */ + LV2_Resize_Port_Status (*resize)(LV2_Resize_Port_Feature_Data data, + uint32_t index, + size_t size); +} LV2_Resize_Port_Resize; #ifdef __cplusplus } /* extern "C" */ -- cgit v1.2.1