1 /* This program is licensed under the GNU Library General Public License, version 2,
2  * a copy of which is included with this program (with filename LICENSE.LGPL).
3  *
4  * (c) 2000-2001 Michael Smith <msmith@xiph.org>
5  * (c) 2020      Philipp Schafft <lion@lion.leolix.org>
6  *
7  * VCEdit header.
8  *
9  * last modified: $ID:$
10  */
11 
12 #ifndef __VCEDIT_H
13 #define __VCEDIT_H
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <stdio.h>
20 #include <ogg/ogg.h>
21 #include <vorbis/codec.h>
22 
23 typedef size_t (*vcedit_read_func)(void *, size_t, size_t, void *);
24 typedef size_t (*vcedit_write_func)(const void *, size_t, size_t, void *);
25 
26 typedef struct {
27     long *streams;
28     size_t streams_len;
29 } vcedit_serial_nos;
30 
31 typedef struct {
32     ogg_sync_state      *oy;
33     ogg_stream_state    *os;
34 
35     vorbis_comment      *vc;
36     vorbis_info         *vi;
37 
38     vcedit_read_func    read;
39     vcedit_write_func   write;
40 
41     void                *in;
42     int serial;
43     vcedit_serial_nos   serials;
44     unsigned char       *mainbuf;
45     unsigned char       *bookbuf;
46     int                 mainlen;
47     int                 booklen;
48     char                *lasterror;
49     char                *vendor;
50     int                 prevW;
51     int                 extrapage;
52     int                 eosin;
53     struct vcedit_buffer_chain *sidebuf;
54 } vcedit_state;
55 
56 extern vcedit_state *   vcedit_new_state(void);
57 extern void             vcedit_clear(vcedit_state *state);
58 extern vorbis_comment * vcedit_comments(vcedit_state *state);
59 extern int              vcedit_open(vcedit_state *state, FILE *in);
60 extern int              vcedit_open_callbacks(vcedit_state *state, void *in,
61                                               vcedit_read_func read_func, vcedit_write_func write_func);
62 extern int              vcedit_write(vcedit_state *state, void *out);
63 extern const char *     vcedit_error(vcedit_state *state);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* __VCEDIT_H */
70 
71