aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-01-29 19:16:04 +0100
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-01-29 19:16:04 +0100
commit0c42030406c4cbc841dcbe82b7a4d31c456f36de (patch)
tree6083e47590f051efe5201a5eba64242445f9db33
parent1f1e6ad6dca747f7dd55d3dbe19418c99aff9156 (diff)
downloadser_atom.lv2-0c42030406c4cbc841dcbe82b7a4d31c456f36de.zip
ser_atom.lv2-0c42030406c4cbc841dcbe82b7a4d31c456f36de.tar.gz
ser_atom.lv2-0c42030406c4cbc841dcbe82b7a4d31c456f36de.tar.bz2
ser_atom.lv2-0c42030406c4cbc841dcbe82b7a4d31c456f36de.tar.xz
add ser_atom_get to API.
-rw-r--r--ser_atom.lv2/ser_atom.h19
-rw-r--r--test/ser_atom_test.c3
2 files changed, 21 insertions, 1 deletions
diff --git a/ser_atom.lv2/ser_atom.h b/ser_atom.lv2/ser_atom.h
index 89c25ff..7357e65 100644
--- a/ser_atom.lv2/ser_atom.h
+++ b/ser_atom.lv2/ser_atom.h
@@ -49,6 +49,9 @@ ser_atom_funcs(ser_atom_t *ser, ser_atom_realloc_t realloc,
SER_ATOM_API int
ser_atom_reset(ser_atom_t *ser, LV2_Atom_Forge *forge);
+SER_ATOM_API LV2_Atom *
+ser_atom_get(ser_atom_t *ser);
+
SER_ATOM_API int
ser_atom_deinit(ser_atom_t *ser);
@@ -61,7 +64,10 @@ struct _ser_atom_t {
size_t size;
size_t offset;
- uint8_t *buf;
+ union {
+ uint8_t *buf;
+ LV2_Atom *atom;
+ };
};
static LV2_Atom_Forge_Ref
@@ -169,6 +175,17 @@ ser_atom_reset(ser_atom_t *ser, LV2_Atom_Forge *forge)
return 0;
}
+SER_ATOM_API LV2_Atom *
+ser_atom_get(ser_atom_t *ser)
+{
+ if(!ser)
+ {
+ return NULL;
+ }
+
+ return ser->atom;
+}
+
SER_ATOM_API int
ser_atom_deinit(ser_atom_t *ser)
{
diff --git a/test/ser_atom_test.c b/test/ser_atom_test.c
index 0da4865..00898f0 100644
--- a/test/ser_atom_test.c
+++ b/test/ser_atom_test.c
@@ -122,6 +122,9 @@ main(int argc, char **argv)
assert(lv2_atom_forge_deref(&forge, 0) == NULL);
+ assert(ser_atom_get(NULL) == NULL);
+ assert(ser_atom_get(&ser) == ser.atom);
+
assert(ser_atom_deinit(NULL) != 0);
assert(ser_atom_deinit(&ser) == 0);