annotate libaf/format.c @ 36182:8587ae275646

Rename HAVE_CMOV to HAVE_I686 for FFmpeg. Keep the cmov name in configure since it is less confusing, since cmov is what we test for and also since for example VIA C3 sometimes is considered i686 that does not implement the optional CMOV instruction.
author reimar
date Fri, 17 May 2013 15:59:38 +0000
parents 389d43c448b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28229
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
1 /*
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
2 * Copyright (C) 2005 Alex Beregszaszi
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
3 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
4 * This file is part of MPlayer.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
5 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
7 * it under the terms of the GNU General Public License as published by
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
9 * (at your option) any later version.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
10 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
14 * GNU General Public License for more details.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
15 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
16 * You should have received a copy of the GNU General Public License along
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24890
diff changeset
19 */
16115
69eadbd92faa added missing license header
alex
parents: 14748
diff changeset
20
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
21 #include <stdio.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
22 #include <stdlib.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
23 #include <string.h>
35903
389d43c448b3 Add missing strings.h #includes for strcasecmp().
diego
parents: 34103
diff changeset
24 #include <strings.h>
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
25 #include <inttypes.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
26 #include <limits.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
27
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
28 #include "af.h"
17863
8ec63246c118 last print on libaf to af_msg
reynaldo
parents: 16259
diff changeset
29 #include "help_mp.h"
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
30
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
31 // Convert from string to format
19108
5e767cabf4cd marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org
reynaldo
parents: 17876
diff changeset
32 int af_str2fmt(const char* str)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
33 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
34 int format=0;
24595
85f669a84e7a cosmetics: misc typo fixes
diego
parents: 22748
diff changeset
35 // Scan for endianness
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
36 if(strstr(str,"be") || strstr(str,"BE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
37 format |= AF_FORMAT_BE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
38 else if(strstr(str,"le") || strstr(str,"LE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
39 format |= AF_FORMAT_LE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
40 else
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
41 format |= AF_FORMAT_NE;
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
42
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
43 // Scan for special formats
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
44 if(strstr(str,"mulaw") || strstr(str,"MULAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
45 format |= AF_FORMAT_MU_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
46 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
47 if(strstr(str,"alaw") || strstr(str,"ALAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
48 format |= AF_FORMAT_A_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
49 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
50 if(strstr(str,"ac3") || strstr(str,"AC3")){
30241
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30236
diff changeset
51 format |= AF_FORMAT_AC3 | AF_FORMAT_16BIT; return format;
14748
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 if(strstr(str,"mpeg2") || strstr(str,"MPEG2")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
54 format |= AF_FORMAT_MPEG2; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
55 }
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
56 if(strstr(str,"iec61937") || strstr(str,"IEC61937")){
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
57 format |= AF_FORMAT_IEC61937 | AF_FORMAT_16BIT; return format;
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
58 }
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
59 if(strstr(str,"imaadpcm") || strstr(str,"IMAADPCM")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
60 format |= AF_FORMAT_IMA_ADPCM; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
61 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
62
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
63 // Scan for int/float
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
64 if(strstr(str,"float") || strstr(str,"FLOAT")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
65 format |= AF_FORMAT_F; return 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 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
68 format |= AF_FORMAT_I;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
69
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
70 // Scan for signed/unsigned
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
71 if(strstr(str,"unsigned") || strstr(str,"UNSIGNED"))
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
72 format |= AF_FORMAT_US;
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
73 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
74 format |= AF_FORMAT_SI;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
75
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
76 return format;
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
24890
a54a25221b79 Remove some pointless 'inline' qualifiers
uau
parents: 24595
diff changeset
79 int af_fmt2bits(int format)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
80 {
30236
cb2e10d85c04 Add a hack to af_fmt2bits to recognize AC3 as a 16-bit format, since this
reimar
parents: 29263
diff changeset
81 if (AF_FORMAT_IS_AC3(format)) return 16;
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
82 return (format & AF_FORMAT_BITS_MASK)+8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
83 // return (((format & AF_FORMAT_BITS_MASK)>>3)+1) * 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
84 #if 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
85 switch(format & AF_FORMAT_BITS_MASK)
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 case AF_FORMAT_8BIT: return 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
88 case AF_FORMAT_16BIT: return 16;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
89 case AF_FORMAT_24BIT: return 24;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
90 case AF_FORMAT_32BIT: return 32;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
91 case AF_FORMAT_48BIT: return 48;
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 #endif
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
94 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
95 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
96
24890
a54a25221b79 Remove some pointless 'inline' qualifiers
uau
parents: 24595
diff changeset
97 int af_bits2fmt(int bits)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
98 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
99 return (bits/8 - 1) << 3;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
100 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
101
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
102 /* Convert format to str input str is a buffer for the
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
103 converted string, size is the size of the buffer */
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
104 char* af_fmt2str(int format, char* str, int size)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
105 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
106 int i=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
107
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
108 if (size < 1)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
109 return NULL;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
110 size--; // reserve one for terminating 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
111
24595
85f669a84e7a cosmetics: misc typo fixes
diego
parents: 22748
diff changeset
112 // Endianness
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
113 if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
114 i+=snprintf(str,size-i,"little-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
115 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
116 i+=snprintf(str,size-i,"big-endian ");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
117
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
118 if(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
119 switch(format & AF_FORMAT_SPECIAL_MASK){
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
120 case(AF_FORMAT_MU_LAW):
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
121 i+=snprintf(&str[i],size-i,"mu-law "); break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
122 case(AF_FORMAT_A_LAW):
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
123 i+=snprintf(&str[i],size-i,"A-law "); break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
124 case(AF_FORMAT_MPEG2):
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
125 i+=snprintf(&str[i],size-i,"MPEG-2 "); break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
126 case(AF_FORMAT_AC3):
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
127 i+=snprintf(&str[i],size-i,"AC3 "); break;
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
128 case(AF_FORMAT_IEC61937):
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
129 i+=snprintf(&str[i],size-i,"IEC61937 "); break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
130 case(AF_FORMAT_IMA_ADPCM):
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
131 i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
132 default:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
133 i+=snprintf(&str[i],size-i,MSGTR_AF_FORMAT_UnknownFormat);
14748
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 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
137 // Bits
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
138 i+=snprintf(&str[i],size-i,"%d-bit ", af_fmt2bits(format));
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
139
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
140 // Point
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
141 if(AF_FORMAT_F == (format & AF_FORMAT_POINT_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
142 i+=snprintf(&str[i],size-i,"float ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
143 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
144 // Sign
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
145 if(AF_FORMAT_US == (format & AF_FORMAT_SIGN_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
146 i+=snprintf(&str[i],size-i,"unsigned ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
147 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
148 i+=snprintf(&str[i],size-i,"signed ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
149
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
150 i+=snprintf(&str[i],size-i,"int ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
151 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
152 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
153 // remove trailing space
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
154 if (i > 0 && str[i - 1] == ' ')
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
155 i--;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
156 str[i] = 0; // make sure it is 0 terminated.
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
157 return str;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
158 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
159
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
160 static struct {
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
161 const char *name;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
162 const int format;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
163 } af_fmtstr_table[] = {
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
164 { "mulaw", AF_FORMAT_MU_LAW },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
165 { "alaw", AF_FORMAT_A_LAW },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
166 { "mpeg2", AF_FORMAT_MPEG2 },
30241
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30236
diff changeset
167 { "ac3le", AF_FORMAT_AC3_LE },
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30236
diff changeset
168 { "ac3be", AF_FORMAT_AC3_BE },
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30236
diff changeset
169 { "ac3ne", AF_FORMAT_AC3_NE },
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
170 { "iec61937le", AF_FORMAT_IEC61937_LE },
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
171 { "iec61937be", AF_FORMAT_IEC61937_BE },
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
172 { "iec61937ne", AF_FORMAT_IEC61937_NE },
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
173 { "imaadpcm", AF_FORMAT_IMA_ADPCM },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
174
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
175 { "u8", AF_FORMAT_U8 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
176 { "s8", AF_FORMAT_S8 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
177 { "u16le", AF_FORMAT_U16_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
178 { "u16be", AF_FORMAT_U16_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
179 { "u16ne", AF_FORMAT_U16_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
180 { "s16le", AF_FORMAT_S16_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
181 { "s16be", AF_FORMAT_S16_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
182 { "s16ne", AF_FORMAT_S16_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
183 { "u24le", AF_FORMAT_U24_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
184 { "u24be", AF_FORMAT_U24_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
185 { "u24ne", AF_FORMAT_U24_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
186 { "s24le", AF_FORMAT_S24_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
187 { "s24be", AF_FORMAT_S24_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
188 { "s24ne", AF_FORMAT_S24_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
189 { "u32le", AF_FORMAT_U32_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
190 { "u32be", AF_FORMAT_U32_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
191 { "u32ne", AF_FORMAT_U32_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
192 { "s32le", AF_FORMAT_S32_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
193 { "s32be", AF_FORMAT_S32_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
194 { "s32ne", AF_FORMAT_S32_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
195 { "floatle", AF_FORMAT_FLOAT_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
196 { "floatbe", AF_FORMAT_FLOAT_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
197 { "floatne", AF_FORMAT_FLOAT_NE },
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28229
diff changeset
198
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
199 { NULL, 0 }
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
200 };
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
201
19108
5e767cabf4cd marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org
reynaldo
parents: 17876
diff changeset
202 const char *af_fmt2str_short(int format)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
203 {
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
204 int i;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
205
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
206 for (i = 0; af_fmtstr_table[i].name; i++)
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
207 if (af_fmtstr_table[i].format == format)
19109
6e840952870d Removes an unneeded cast. Patch by Stefan Huehner, stefan AT.. huehner.org
reynaldo
parents: 19108
diff changeset
208 return af_fmtstr_table[i].name;
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
209
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
210 return "??";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
211 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
212
19108
5e767cabf4cd marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org
reynaldo
parents: 17876
diff changeset
213 int af_str2fmt_short(const char* str)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
214 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
215 int i;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
216
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
217 for (i = 0; af_fmtstr_table[i].name; i++)
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
218 if (!strcasecmp(str, af_fmtstr_table[i].name))
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
219 return af_fmtstr_table[i].format;
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
220
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
221 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
222 }