Respond to MMC even when synced to JACK. Fixes #3700.
[ardour.git] / libs / ardour / lv2_pfile.h
1 /* Portable file-based implementation of LV2 Persist.
2  * See <http://lv2plug.in/ns/ext/persist> for details.
3  *
4  * This file is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This file is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this file; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #include <stdbool.h>
20 #include <stdint.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 typedef struct _LV2PFile*          LV2PFile;
27 typedef struct _LV2PFile_Iterator* LV2PFile_Iterator;
28
29 typedef enum {
30         LV2_PFILE_OK            = 0,
31         LV2_PFILE_UNKNOWN_ERROR = 1,
32         LV2_PFILE_EOF           = 2,
33         LV2_PFILE_CORRUPT       = 3
34 } LV2PFileStatus;
35
36 /** Open/Create a new persist file. */
37 LV2PFile
38 lv2_pfile_open(const char* path, bool write);
39
40 /** Write a record to a persist file. */
41 LV2PFileStatus
42 lv2_pfile_write(LV2PFile    file,
43                 const char* key,
44                 const void* value,
45                 uint64_t    size,
46                 const char* type);
47
48 /** Read a record from a persist file.
49  * @a key and @a value are allocated with malloc and must be freed by caller.
50  */
51 LV2PFileStatus
52 lv2_pfile_read(LV2PFile  file,
53                char**    key,
54                uint32_t* key_len,
55                char**    type,
56                uint32_t* type_len,
57                void**    value,
58                uint64_t* size);
59
60 /** Close a persist file.
61  * After this call, @a file is invalid.
62  */
63 void
64 lv2_pfile_close(LV2PFile file);
65
66 #ifdef __cplusplus
67 } /* extern "C" */
68 #endif