diff options
author | David Robillard <d@drobilla.net> | 2012-03-02 21:11:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-02 21:11:12 +0000 |
commit | 7622f485c8d78608d0a906771fcc088bceecf367 (patch) | |
tree | 397ccb988714a7aff19d4da3beabe4738efc16ba /tests/sratom_test.c | |
parent | 8c8e3e1e306cb936be63cc033d8db2ca4442cbe5 (diff) | |
download | sratom-7622f485c8d78608d0a906771fcc088bceecf367.tar.gz sratom-7622f485c8d78608d0a906771fcc088bceecf367.tar.bz2 sratom-7622f485c8d78608d0a906771fcc088bceecf367.zip |
Implement binary blob serialisation.
git-svn-id: http://svn.drobilla.net/lad/trunk/sratom@4012 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'tests/sratom_test.c')
-rw-r--r-- | tests/sratom_test.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/sratom_test.c b/tests/sratom_test.c index 29ead8f..dadcf4d 100644 --- a/tests/sratom_test.c +++ b/tests/sratom_test.c @@ -97,10 +97,11 @@ main() LV2_URID eg_string = urid_map(NULL, "http://example.org/j-string"); LV2_URID eg_langlit = urid_map(NULL, "http://example.org/k-langlit"); LV2_URID eg_typelit = urid_map(NULL, "http://example.org/l-typelit"); - LV2_URID eg_blank = urid_map(NULL, "http://example.org/m-blank"); - LV2_URID eg_tuple = urid_map(NULL, "http://example.org/n-tuple"); - LV2_URID eg_vector = urid_map(NULL, "http://example.org/o-vector"); - LV2_URID eg_seq = urid_map(NULL, "http://example.org/p-seq"); + LV2_URID eg_blob = urid_map(NULL, "http://example.org/m-blob"); + LV2_URID eg_blank = urid_map(NULL, "http://example.org/n-blank"); + LV2_URID eg_tuple = urid_map(NULL, "http://example.org/o-tuple"); + LV2_URID eg_vector = urid_map(NULL, "http://example.org/p-vector"); + LV2_URID eg_seq = urid_map(NULL, "http://example.org/q-seq"); uint8_t buf[1024]; lv2_atom_forge_set_buffer(&forge, buf, sizeof(buf)); @@ -120,7 +121,7 @@ main() // eg_three = (Float)3.0 lv2_atom_forge_property_head(&forge, eg_three, 0); lv2_atom_forge_float(&forge, 3.0f); - + // eg_four = (Double)4.0 lv2_atom_forge_property_head(&forge, eg_four, 0); lv2_atom_forge_double(&forge, 4.0); @@ -162,10 +163,17 @@ main() // eg_typelit = (Literal)"bonjour"@fr lv2_atom_forge_property_head(&forge, eg_typelit, 0); - lv2_atom_forge_literal( + lv2_atom_forge_literal( &forge, (const uint8_t*)"value", strlen("value"), urid_map(NULL, "http://example.org/Type"), 0); + // eg_blob = 0xDEADBEEF + uint32_t blob_type = map.map(map.handle, "http://example.org/Blob"); + uint8_t blob_buf[] = { 0xDE, 0xAD, 0xBE, 0xEF }; + lv2_atom_forge_property_head(&forge, eg_blob, 0); + lv2_atom_forge_atom(&forge, sizeof(blob_buf), blob_type); + lv2_atom_forge_write(&forge, blob_buf, sizeof(blob_buf)); + // eg_blank = [ a <http://example.org/Object> ] lv2_atom_forge_property_head(&forge, eg_blank, 0); LV2_Atom_Forge_Frame blank_frame; |