trunk/src/lib/util/chdcd.c
| r20102 | r20103 | |
| 164 | 164 | if (offset < 4) |
| 165 | 165 | { |
| 166 | 166 | osd_close(file); |
| 167 | | printf("ERROR: unexpected offset %d (%s)\n", actual, filename); |
| 167 | printf("ERROR: unexpected offset %lu (%s)\n", actual, filename); |
| 168 | 168 | return 0; |
| 169 | 169 | } |
| 170 | 170 | if (memcmp(&buf[0], "RIFF", 4) != 0) |
| r20102 | r20103 | |
| 180 | 180 | if (offset < 8) |
| 181 | 181 | { |
| 182 | 182 | osd_close(file); |
| 183 | | printf("ERROR: unexpected offset %d (%s)\n", actual, filename); |
| 183 | printf("ERROR: unexpected offset %lu (%s)\n", actual, filename); |
| 184 | 184 | return 0; |
| 185 | 185 | } |
| 186 | 186 | filesize = LITTLE_ENDIANIZE_INT32(filesize); |
| r20102 | r20103 | |
| 191 | 191 | if (offset < 12) |
| 192 | 192 | { |
| 193 | 193 | osd_close(file); |
| 194 | | printf("ERROR: unexpected offset %d (%s)\n", actual, filename); |
| 194 | printf("ERROR: unexpected offset %lu (%s)\n", actual, filename); |
| 195 | 195 | return 0; |
| 196 | 196 | } |
| 197 | 197 | if (memcmp(&buf[0], "WAVE", 4) != 0) |
| r20102 | r20103 | |
| 233 | 233 | return 0; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | | /* number of channels -- only mono is supported */ |
| 236 | /* number of channels -- only stereo is supported */ |
| 237 | 237 | osd_read(file, &temp16, offset, 2, &actual); |
| 238 | 238 | offset += actual; |
| 239 | 239 | temp16 = LITTLE_ENDIANIZE_INT16(temp16); |
| 240 | 240 | if (temp16 != 2) |
| 241 | 241 | { |
| 242 | 242 | osd_close(file); |
| 243 | | printf("ERROR: unsupported number of channels %d - only mono is supported (%s)\n", temp16, filename); |
| 243 | printf("ERROR: unsupported number of channels %d - only stereo is supported (%s)\n", temp16, filename); |
| 244 | 244 | return 0; |
| 245 | 245 | } |
| 246 | 246 | |
| r20102 | r20103 | |
| 251 | 251 | if (rate != 44100) |
| 252 | 252 | { |
| 253 | 253 | osd_close(file); |
| 254 | | printf("ERROR: unsupported samplerate %d - only 44100 is supported (%s)\n", rate, filename); |
| 254 | printf("ERROR: unsupported samplerate %u - only 44100 is supported (%s)\n", rate, filename); |
| 255 | 255 | return 0; |
| 256 | 256 | } |
| 257 | 257 | |