added default dir&format settings
[maemo-recorder] / src / maemo-recorder-au.h
1 /* vim: set ts=4 sw=4 et: */
2 /*
3  * maemo-recorder-au.h
4  * Support for reading and writing AU/SND files
5  *
6  * Copyright (C) 2006 Nokia Corporation
7  *
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16  * for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  */
23
24 #ifndef MAEMO_RECORDER_AU_H
25 #define MAEMO_RECORDER_AU_H
26
27 #include <libgnomevfs/gnome-vfs.h>
28
29 #include <stdio.h>
30
31 #define AU_MAGIC ((uint32_t) 0x2e736e64) /* ".snd" */
32 #define AU_SIZE_UNKNOWN (~0)    /* (unsigned) -1 */
33
34 enum
35 {
36     AU_ENCODING_MULAW_8 = 1,    /* 8-bit ISDN u-law */
37     AU_ENCODING_LINEAR_8 = 2,   /* 8-bit linear PCM */
38     AU_ENCODING_LINEAR_16 = 3,  /* 16-bit linear PCM */
39     AU_ENCODING_LINEAR_24 = 4,  /* 24-bit linear PCM */ 
40     AU_ENCODING_LINEAR_32 = 5,  /* 32-bit linear PCM */ 
41     AU_ENCODING_FLOAT = 6,      /* 32-bit IEEE floating point */ 
42     AU_ENCODING_DOUBLE = 7,     /* 64-bit IEEE floating point */ 
43     AU_ENCODING_ADPCM_G721 = 23,    /* 4-bit CCITT g.721 ADPCM */ 
44     AU_ENCODING_ADPCM_G722 = 24,    /* CCITT g.722 ADPCM */ 
45     AU_ENCODING_ADPCM_G723_3 = 25,  /* CCITT g.723 3-bit ADPCM */ 
46     AU_ENCODING_ADPCM_G723_5 = 26,  /* CCITT g.723 5-bit ADPCM */ 
47     AU_ENCODING_ALAW_8 = 27    /* 8-bit ISDN A-law */
48 };
49
50 struct au_header 
51 {
52     uint32_t magic;
53     uint32_t data_offset;
54     uint32_t data_size;
55     uint32_t encoding;
56     uint32_t sample_rate;
57     uint32_t channels;
58
59 } __attribute__((__packed__));
60
61
62 gint au_write(GnomeVFSHandle *handle, guint32 encoding, guint32 rate, guint32 channels, gconstpointer data, size_t len);
63
64 gint 
65 au_write_copy(GnomeVFSHandle *to_handle, guint32 encoding, guint32 rate, guint32 channels, GnomeVFSHandle *from_handle, size_t len);
66
67 gint
68 au_get_info(GnomeVFSHandle *handle, guint32 *format, guint32 *rate, guint32 *channels, guint32 *data_size, guint32 *data_offset);
69
70 gint au_copy_data(GnomeVFSHandle *to_handle, GnomeVFSHandle *from_handle, guint32 from_offset);
71
72 guint32 au_get_encoding(AudioFormat format);
73
74 #endif