formats: clarify setting of reverse_bytes
[sox.git] / src / raw-fmt.c
blob15768db392cf7519d79984d7ba8929fb12c38f88
1 /* libSoX file formats: raw (c) 2007-11 SoX contributors
3 * This library is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation; either version 2.1 of the License, or (at
6 * your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
11 * General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include "sox_i.h"
20 static int raw_start(sox_format_t * ft) {
21 return lsx_rawstart(ft, sox_false, sox_false, sox_true, SOX_ENCODING_UNKNOWN, 0);
24 LSX_FORMAT_HANDLER(raw)
26 static char const * const names[] = {"raw", NULL};
27 static unsigned const encodings[] = {
28 SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0,
29 SOX_ENCODING_UNSIGNED, 32, 24, 16, 8, 0,
30 SOX_ENCODING_ULAW, 8, 0,
31 SOX_ENCODING_ALAW, 8, 0,
32 SOX_ENCODING_FLOAT, 64, 32, 0,
33 0};
34 static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
35 "Raw PCM, mu-law, or A-law", names, 0,
36 raw_start, lsx_rawread , NULL,
37 raw_start, lsx_rawwrite, NULL,
38 lsx_rawseek, encodings, NULL, 0
40 return &handler;
43 static int sln_start(sox_format_t * ft)
45 return lsx_check_read_params(ft, 1, 8000., SOX_ENCODING_SIGN2, 16, (uint64_t)0, sox_false);
48 LSX_FORMAT_HANDLER(sln)
50 static char const * const names[] = {"sln", NULL};
51 static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
52 static sox_rate_t const write_rates[] = {8000, 0};
53 static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
54 "Asterisk PBX headerless format",
55 names, SOX_FILE_LIT_END|SOX_FILE_MONO,
56 sln_start, lsx_rawread, NULL,
57 NULL, lsx_rawwrite, NULL,
58 lsx_rawseek, write_encodings, write_rates, 0
60 return &handler;