summaryrefslogtreecommitdiffstats
path: root/include/xas
diff options
context:
space:
mode:
Diffstat (limited to 'include/xas')
-rw-r--r--include/xas/riff.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/xas/riff.h b/include/xas/riff.h
new file mode 100644
index 0000000..6dc2d8d
--- /dev/null
+++ b/include/xas/riff.h
@@ -0,0 +1,47 @@
+#ifndef _XAS_RIFF_H
+#define _XAS_RIFF_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+typedef struct _xas_riff_chunk {
+ char id[4];
+ uint32_t size;
+} xas_riff_chunk;
+
+typedef struct _xas_riff_main_chunk {
+ xas_riff_chunk header;
+ char type[4];
+} xas_riff_main_chunk;
+
+typedef struct _xas_riff_wave_format_chunk {
+ xas_riff_chunk header;
+
+ uint16_t type,
+ channels;
+
+ uint32_t sample_rate,
+ byte_rate;
+
+ uint16_t sample_size,
+ sample_size_bits;
+} xas_riff_wave_chunk;
+
+typedef struct _xas_riff_wave_header {
+ xas_riff_main_chunk riff;
+ xas_riff_wave_chunk wave;
+ xas_riff_chunk data;
+} xas_riff_wave_header;
+
+typedef struct _xas_riff {
+ int fd;
+ size_t size;
+} xas_riff;
+
+xas_riff *xas_riff_open_file(const char *path, int flags);
+
+int xas_riff_close(xas_riff *riff);
+
+ssize_t xas_riff_write(xas_riff *riff, void *data, size_t len);
+
+#endif /* _XAS_RIFF_H */