Functions |
static void | lv2_atom_forge_init (LV2_Atom_Forge *forge, LV2_URID_Map *map) |
| Initialise forge .
|
static LV2_Atom * | lv2_atom_forge_deref (LV2_Atom_Forge *forge, LV2_Atom_Forge_Ref ref) |
|
static void | lv2_atom_forge_set_buffer (LV2_Atom_Forge *forge, uint8_t *buf, size_t size) |
| Set the output buffer where forge will write atoms.
|
static void | lv2_atom_forge_set_sink (LV2_Atom_Forge *forge, LV2_Atom_Forge_Sink sink, LV2_Atom_Forge_Deref_Func deref, LV2_Atom_Forge_Sink_Handle handle) |
| Set the sink function where forge will write output.
|
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_push (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, LV2_Atom_Forge_Ref ref) |
| Push a stack frame.
|
static void | lv2_atom_forge_pop (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame) |
| Pop a stack frame.
|
static bool | lv2_atom_forge_top_is (LV2_Atom_Forge *forge, uint32_t type) |
| Return true iff the top of the stack has the given type.
|
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_raw (LV2_Atom_Forge *forge, const void *data, uint32_t size) |
| Write raw output.
|
static void | lv2_atom_forge_pad (LV2_Atom_Forge *forge, uint32_t written) |
| Pad output accordingly so next write is 64-bit aligned.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_write (LV2_Atom_Forge *forge, const void *data, uint32_t size) |
| Write raw output, padding to 64-bits as necessary.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_string_body (LV2_Atom_Forge *forge, const char *str, uint32_t len) |
| Write a null-terminated string body.
|
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_atom (LV2_Atom_Forge *forge, uint32_t size, uint32_t type) |
| Write an atom:Atom header.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_primitive (LV2_Atom_Forge *forge, const LV2_Atom *a) |
| Write a primitive (fixed-size) atom.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_int (LV2_Atom_Forge *forge, int32_t val) |
| Write an atom:Int.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_long (LV2_Atom_Forge *forge, int64_t val) |
| Write an atom:Long.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_float (LV2_Atom_Forge *forge, float val) |
| Write an atom:Float.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_double (LV2_Atom_Forge *forge, double val) |
| Write an atom:Double.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_bool (LV2_Atom_Forge *forge, bool val) |
| Write an atom:Bool.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_urid (LV2_Atom_Forge *forge, LV2_URID id) |
| Write an atom:URID.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_typed_string (LV2_Atom_Forge *forge, uint32_t type, const char *str, uint32_t len) |
| Write an atom compatible with atom:String.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_string (LV2_Atom_Forge *forge, const char *str, uint32_t len) |
| Write an atom:String.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_uri (LV2_Atom_Forge *forge, const char *uri, uint32_t len) |
| Write an atom:URI.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_path (LV2_Atom_Forge *forge, const char *path, uint32_t len) |
| Write an atom:Path.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_literal (LV2_Atom_Forge *forge, const char *str, uint32_t len, uint32_t datatype, uint32_t lang) |
| Write an atom:Literal.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_vector_head (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t child_size, uint32_t child_type) |
| Start an atom:Vector.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_vector (LV2_Atom_Forge *forge, uint32_t child_size, uint32_t child_type, uint32_t n_elems, const void *elems) |
| Write a complete atom:Vector.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_tuple (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame) |
| Write the header of an atom:Tuple.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_resource (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, LV2_URID id, LV2_URID otype) |
| Write the header of an atom:Resource.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_blank (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t id, LV2_URID otype) |
| The same as lv2_atom_forge_resource(), but for object:Blank.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_property_head (LV2_Atom_Forge *forge, LV2_URID key, LV2_URID context) |
| Write the header for a property body (likely in an Object).
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_sequence_head (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t unit) |
| Write the header for a Sequence.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_frame_time (LV2_Atom_Forge *forge, int64_t frames) |
| Write the time stamp header of an Event (in a Sequence) in audio frames.
|
static LV2_Atom_Forge_Ref | lv2_atom_forge_beat_time (LV2_Atom_Forge *forge, double beats) |
| Write the time stamp header of an Event (in a Sequence) in beats.
|
An API for constructing LV2 atoms.
This file provides an API for constructing Atoms which makes it relatively simple to build nested atoms of arbitrary complexity without requiring dynamic memory allocation.
The API is based on successively appending the appropriate pieces to build a complete Atom. The size of containers is automatically updated. Functions that begin a container return (via their frame argument) a stack frame which must be popped when the container is finished.
All output is written to a user-provided buffer or sink function. This makes it popssible to create create atoms on the stack, on the heap, in LV2 port buffers, in a ringbuffer, or elsewhere, all using the same API.
This entire API is realtime safe if used with a buffer or a realtime safe sink, except lv2_atom_forge_init() which is only realtime safe if the URI map function is.
Note these functions are all static inline, do not take their address.
This header is non-normative, it is provided for convenience.