annotate libaf/format.c @ 22111:089c303ef2c9

Link to the mencoder-users list for mencoder stuff
author reimar
date Sun, 04 Feb 2007 13:58:59 +0000
parents 6e840952870d
children 904e3f3f8bee
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"
17863
8ec63246c118 last print on libaf to af_msg
reynaldo
parents: 16259
diff changeset
19 #include "help_mp.h"
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
20
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
21 // 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
22 int af_str2fmt(const char* str)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
23 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
24 int format=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
25 // Scan for endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
26 if(strstr(str,"be") || strstr(str,"BE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
27 format |= AF_FORMAT_BE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
28 else if(strstr(str,"le") || strstr(str,"LE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
29 format |= AF_FORMAT_LE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
30 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
31 format |= AF_FORMAT_NE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
32
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
33 // Scan for special formats
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
34 if(strstr(str,"mulaw") || strstr(str,"MULAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
35 format |= AF_FORMAT_MU_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
36 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
37 if(strstr(str,"alaw") || strstr(str,"ALAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
38 format |= AF_FORMAT_A_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
39 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
40 if(strstr(str,"ac3") || strstr(str,"AC3")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
41 format |= AF_FORMAT_AC3; return format;
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 if(strstr(str,"mpeg2") || strstr(str,"MPEG2")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
44 format |= AF_FORMAT_MPEG2; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
45 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
46 if(strstr(str,"imaadpcm") || strstr(str,"IMAADPCM")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
47 format |= AF_FORMAT_IMA_ADPCM; return format;
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
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
50 // Scan for int/float
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
51 if(strstr(str,"float") || strstr(str,"FLOAT")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
52 format |= AF_FORMAT_F; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
53 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
54 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
55 format |= AF_FORMAT_I;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
56
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
57 // Scan for signed/unsigned
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
58 if(strstr(str,"unsigned") || strstr(str,"UNSIGNED"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
59 format |= AF_FORMAT_US;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
60 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
61 format |= AF_FORMAT_SI;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
62
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
63 return format;
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
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
66 inline int af_fmt2bits(int format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
67 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
68 return (format & AF_FORMAT_BITS_MASK)+8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
69 // return (((format & AF_FORMAT_BITS_MASK)>>3)+1) * 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
70 #if 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
71 switch(format & AF_FORMAT_BITS_MASK)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
72 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
73 case AF_FORMAT_8BIT: return 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
74 case AF_FORMAT_16BIT: return 16;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
75 case AF_FORMAT_24BIT: return 24;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
76 case AF_FORMAT_32BIT: return 32;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
77 case AF_FORMAT_48BIT: return 48;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
78 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
79 #endif
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
80 return -1;
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
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
83 inline int af_bits2fmt(int bits)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
84 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
85 return (bits/8 - 1) << 3;
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
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
88 /* Convert format to str input str is a buffer for the
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
89 converted string, size is the size of the buffer */
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
90 char* af_fmt2str(int format, char* str, int size)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
91 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
92 int i=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
93
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
94 if (size < 1)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
95 return NULL;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
96 size--; // reserve one for terminating 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
97
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
98 // Endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
99 if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
100 i+=snprintf(str,size-i,"little-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
101 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
102 i+=snprintf(str,size-i,"big-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
103
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
104 if(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
105 switch(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
106 case(AF_FORMAT_MU_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
107 i+=snprintf(&str[i],size-i,"mu-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
108 case(AF_FORMAT_A_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
109 i+=snprintf(&str[i],size-i,"A-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
110 case(AF_FORMAT_MPEG2):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
111 i+=snprintf(&str[i],size-i,"MPEG-2 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
112 case(AF_FORMAT_AC3):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
113 i+=snprintf(&str[i],size-i,"AC3 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
114 case(AF_FORMAT_IMA_ADPCM):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
115 i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
116 default:
17876
4645b9f89237 Fix up libaf unknown-format printing
corey
parents: 17863
diff changeset
117 i+=snprintf(&str[i],size-i,MSGTR_AF_FORMAT_UnknownFormat);
14748
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 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
120 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
121 // Bits
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
122 i+=snprintf(&str[i],size-i,"%d-bit ", af_fmt2bits(format));
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
123
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
124 // Point
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
125 if(AF_FORMAT_F == (format & AF_FORMAT_POINT_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
126 i+=snprintf(&str[i],size-i,"float ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
127 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
128 // Sign
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
129 if(AF_FORMAT_US == (format & AF_FORMAT_SIGN_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
130 i+=snprintf(&str[i],size-i,"unsigned ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
131 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
132 i+=snprintf(&str[i],size-i,"signed ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
133
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
134 i+=snprintf(&str[i],size-i,"int ");
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 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
137 // remove trailing space
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
138 if (i > 0 && str[i - 1] == ' ')
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
139 i--;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
140 str[i] = 0; // make sure it is 0 terminated.
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
141 return str;
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
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
144 static struct {
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
145 const char *name;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
146 const int format;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
147 } af_fmtstr_table[] = {
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
148 { "mulaw", AF_FORMAT_MU_LAW },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
149 { "alaw", AF_FORMAT_A_LAW },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
150 { "mpeg2", AF_FORMAT_MPEG2 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
151 { "ac3", AF_FORMAT_AC3 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
152 { "imaadpcm", AF_FORMAT_IMA_ADPCM },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
153
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
154 { "u8", AF_FORMAT_U8 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
155 { "s8", AF_FORMAT_S8 },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
156 { "u16le", AF_FORMAT_U16_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
157 { "u16be", AF_FORMAT_U16_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
158 { "u16ne", AF_FORMAT_U16_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
159 { "s16le", AF_FORMAT_S16_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
160 { "s16be", AF_FORMAT_S16_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
161 { "s16ne", AF_FORMAT_S16_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
162 { "u24le", AF_FORMAT_U24_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
163 { "u24be", AF_FORMAT_U24_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
164 { "u24ne", AF_FORMAT_U24_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
165 { "s24le", AF_FORMAT_S24_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
166 { "s24be", AF_FORMAT_S24_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
167 { "s24ne", AF_FORMAT_S24_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
168 { "u32le", AF_FORMAT_U32_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
169 { "u32be", AF_FORMAT_U32_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
170 { "u32ne", AF_FORMAT_U32_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
171 { "s32le", AF_FORMAT_S32_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
172 { "s32be", AF_FORMAT_S32_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
173 { "s32ne", AF_FORMAT_S32_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
174 { "floatle", AF_FORMAT_FLOAT_LE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
175 { "floatbe", AF_FORMAT_FLOAT_BE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
176 { "floatne", AF_FORMAT_FLOAT_NE },
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
177
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
178 { NULL, 0 }
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
179 };
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
180
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
181 const char *af_fmt2str_short(int format)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
182 {
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
183 int i;
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
184
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
185 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
186 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
187 return af_fmtstr_table[i].name;
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
188
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
189 return "??";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
190 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
191
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
192 int af_str2fmt_short(const char* str)
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
193 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
194 int i;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
195
16259
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
196 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
197 if (!strcasecmp(str, af_fmtstr_table[i].name))
bf5ee9e17e00 code reduction and less error prone, use the same table
alex
parents: 16115
diff changeset
198 return af_fmtstr_table[i].format;
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
199
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
200 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
201 }