annotate libaf/format.c @ 16146:44c6af4f3ae7

synced with 1.178 and fixed typos
author gabrov
date Fri, 29 Jul 2005 00:09:41 +0000
parents 69eadbd92faa
children bf5ee9e17e00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16115
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
1 /*=============================================================================
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
2 //
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
3 // This software has been released under the terms of the GNU General Public
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
4 // license. See http://www.gnu.org/copyleft/gpl.html for details.
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
5 //
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
6 // Copyright 2005 Alex Beregszaszi
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
7 //
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
8 //=============================================================================
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
9 */
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
10
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
11 #include <stdio.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
12 #include <stdlib.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
13 #include <string.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
14 #include <unistd.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
15 #include <inttypes.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
16 #include <limits.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
17
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
18 #include "af.h"
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
19
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
20 // Convert from string to format
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
21 int af_str2fmt(char* str)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
22 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
23 int format=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
24 // Scan for endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
25 if(strstr(str,"be") || strstr(str,"BE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
26 format |= AF_FORMAT_BE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
27 else if(strstr(str,"le") || strstr(str,"LE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
28 format |= AF_FORMAT_LE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
29 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
30 format |= AF_FORMAT_NE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
31
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
32 // Scan for special formats
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
33 if(strstr(str,"mulaw") || strstr(str,"MULAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
34 format |= AF_FORMAT_MU_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
35 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
36 if(strstr(str,"alaw") || strstr(str,"ALAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
37 format |= AF_FORMAT_A_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
38 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
39 if(strstr(str,"ac3") || strstr(str,"AC3")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
40 format |= AF_FORMAT_AC3; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
41 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
42 if(strstr(str,"mpeg2") || strstr(str,"MPEG2")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
43 format |= AF_FORMAT_MPEG2; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
44 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
45 if(strstr(str,"imaadpcm") || strstr(str,"IMAADPCM")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
46 format |= AF_FORMAT_IMA_ADPCM; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
47 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
48
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
49 // Scan for int/float
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
50 if(strstr(str,"float") || strstr(str,"FLOAT")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
51 format |= AF_FORMAT_F; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
52 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
53 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
54 format |= AF_FORMAT_I;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
55
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
56 // Scan for signed/unsigned
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
57 if(strstr(str,"unsigned") || strstr(str,"UNSIGNED"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
58 format |= AF_FORMAT_US;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
59 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
60 format |= AF_FORMAT_SI;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
61
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
62 return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
63 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
64
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
65 inline int af_fmt2bits(int format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
66 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
67 return (format & AF_FORMAT_BITS_MASK)+8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
68 // return (((format & AF_FORMAT_BITS_MASK)>>3)+1) * 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
69 #if 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
70 switch(format & AF_FORMAT_BITS_MASK)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
71 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
72 case AF_FORMAT_8BIT: return 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
73 case AF_FORMAT_16BIT: return 16;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
74 case AF_FORMAT_24BIT: return 24;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
75 case AF_FORMAT_32BIT: return 32;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
76 case AF_FORMAT_48BIT: return 48;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
77 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
78 #endif
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
79 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
80 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
81
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
82 inline int af_bits2fmt(int bits)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
83 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
84 return (bits/8 - 1) << 3;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
85 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
86
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
87 /* Convert format to str input str is a buffer for the
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
88 converted string, size is the size of the buffer */
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
89 char* af_fmt2str(int format, char* str, int size)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
90 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
91 int i=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
92
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
93 if (size < 1)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
94 return NULL;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
95 size--; // reserve one for terminating 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
96
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
97 // Endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
98 if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
99 i+=snprintf(str,size-i,"little-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
100 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
101 i+=snprintf(str,size-i,"big-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
102
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
103 if(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
104 switch(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
105 case(AF_FORMAT_MU_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
106 i+=snprintf(&str[i],size-i,"mu-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
107 case(AF_FORMAT_A_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
108 i+=snprintf(&str[i],size-i,"A-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
109 case(AF_FORMAT_MPEG2):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
110 i+=snprintf(&str[i],size-i,"MPEG-2 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
111 case(AF_FORMAT_AC3):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
112 i+=snprintf(&str[i],size-i,"AC3 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
113 case(AF_FORMAT_IMA_ADPCM):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
114 i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
115 default:
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
116 printf("Unknown special\n");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
117 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
118 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
119 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
120 // Bits
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
121 i+=snprintf(&str[i],size-i,"%d-bit ", af_fmt2bits(format));
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
122
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
123 // Point
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
124 if(AF_FORMAT_F == (format & AF_FORMAT_POINT_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
125 i+=snprintf(&str[i],size-i,"float ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
126 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
127 // Sign
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
128 if(AF_FORMAT_US == (format & AF_FORMAT_SIGN_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
129 i+=snprintf(&str[i],size-i,"unsigned ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
130 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
131 i+=snprintf(&str[i],size-i,"signed ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
132
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
133 i+=snprintf(&str[i],size-i,"int ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
134 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
135 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
136 // remove trailing space
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
137 if (i > 0 && str[i - 1] == ' ')
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
138 i--;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
139 str[i] = 0; // make sure it is 0 terminated.
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
140 return str;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
141 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
142
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
143 char *af_fmt2str_short(int format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
144 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
145 switch(format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
146 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
147 // special
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
148 case AF_FORMAT_MU_LAW: return "mulaw";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
149 case AF_FORMAT_A_LAW: return "alaw";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
150 case AF_FORMAT_MPEG2: return "mpeg2";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
151 case AF_FORMAT_AC3: return "ac3";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
152 case AF_FORMAT_IMA_ADPCM: return "imaadpcm";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
153 // ordinary
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
154 case AF_FORMAT_U8: return "u8";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
155 case AF_FORMAT_S8: return "s8";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
156 case AF_FORMAT_U16_LE: return "u16le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
157 case AF_FORMAT_U16_BE: return "u16be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
158 case AF_FORMAT_S16_LE: return "s16le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
159 case AF_FORMAT_S16_BE: return "s16be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
160 case AF_FORMAT_U24_LE: return "u24le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
161 case AF_FORMAT_U24_BE: return "u24be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
162 case AF_FORMAT_S24_LE: return "s24le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
163 case AF_FORMAT_S24_BE: return "s24be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
164 case AF_FORMAT_U32_LE: return "u32le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
165 case AF_FORMAT_U32_BE: return "u32be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
166 case AF_FORMAT_S32_LE: return "s32le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
167 case AF_FORMAT_S32_BE: return "s32be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
168 case AF_FORMAT_FLOAT_LE: return "floatle";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
169 case AF_FORMAT_FLOAT_BE: return "floatbe";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
170 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
171 return "??";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
172 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
173
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
174 int af_str2fmt_short(char* str)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
175 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
176 int i;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
177 static struct {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
178 const char *name;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
179 const int format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
180 } table[] = {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
181 { "mulaw", AF_FORMAT_MU_LAW },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
182 { "alaw", AF_FORMAT_A_LAW },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
183 { "mpeg2", AF_FORMAT_MPEG2 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
184 { "ac3", AF_FORMAT_AC3 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
185 { "imaadpcm", AF_FORMAT_IMA_ADPCM },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
186
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
187 { "u8", AF_FORMAT_U8 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
188 { "s8", AF_FORMAT_S8 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
189 { "u16le", AF_FORMAT_U16_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
190 { "u16be", AF_FORMAT_U16_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
191 { "u16ne", AF_FORMAT_U16_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
192 { "s16le", AF_FORMAT_S16_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
193 { "s16be", AF_FORMAT_S16_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
194 { "s16ne", AF_FORMAT_S16_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
195 { "u24le", AF_FORMAT_U24_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
196 { "u24be", AF_FORMAT_U24_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
197 { "u24ne", AF_FORMAT_U24_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
198 { "s24le", AF_FORMAT_S24_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
199 { "s24be", AF_FORMAT_S24_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
200 { "s24ne", AF_FORMAT_S24_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
201 { "u32le", AF_FORMAT_U32_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
202 { "u32be", AF_FORMAT_U32_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
203 { "u32ne", AF_FORMAT_U32_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
204 { "s32le", AF_FORMAT_S32_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
205 { "s32be", AF_FORMAT_S32_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
206 { "s32ne", AF_FORMAT_S32_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
207 { "floatle", AF_FORMAT_FLOAT_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
208 { "floatbe", AF_FORMAT_FLOAT_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
209 { "floatne", AF_FORMAT_FLOAT_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
210
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
211 { NULL, 0 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
212 };
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
213
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
214 for (i = 0; table[i].name; i++)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
215 if (!strcasecmp(str, table[i].name))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
216 return table[i].format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
217
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
218 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
219 }