Lines Matching refs:error
56 static FLAC__bool copy_data_(FILE *fin, FILE *fout, size_t size, const char **error, const char * const read_error, const char * const write_error)
63 if(error) *error = read_error;
67 if(error) *error = write_error;
75 static FLAC__bool append_block_(foreign_metadata_t *fm, off_t offset, FLAC__uint32 size, const char **error)
85 if(error) *error = "out of memory";
89 static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char **error)
94 if(error) *error = "ftello() error (001)";
98 if(error) *error = "unsupported FORM layout (002)";
101 if(!append_block_(fm, offset, 12, error))
107 if(error) *error = "ftello() error (003)";
113 if(error) *error = "invalid AIFF file (004)";
122 if(error) *error = "invalid AIFF file: multiple \"COMM\" chunks (005)";
126 if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (006)";
133 if(error) *error = "invalid AIFF file: multiple \"SSND\" chunks (007)";
137 if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (008)";
143 if(error) *error = "invalid AIFF file (009)";
148 if(error) *error = "invalid AIFF file: seek error (010)";
152 if(!append_block_(fm, offset, 8 + (memcmp(buffer, "SSND", 4)? size : 8 + fm->ssnd_offset_size), error))
155 if(error) *error = "invalid AIFF file: seek error (011)";
160 if(error) *error = "invalid AIFF file: unexpected EOF (012)";
164 if(error) *error = "invalid AIFF file: missing \"COMM\" chunk (013)";
168 if(error) *error = "invalid AIFF file: missing \"SSND\" chunk (014)";
174 static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **error)
179 if(error) *error = "ftello() error (001)";
183 if(error) *error = "unsupported RIFF layout (002)";
186 if(!append_block_(fm, offset, 12, error))
192 if(error) *error = "ftello() error (003)";
198 if(error) *error = "invalid WAVE file (004)";
207 if(error) *error = "invalid WAVE file: multiple \"fmt \" chunks (005)";
211 if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (006)";
218 if(error) *error = "invalid WAVE file: multiple \"data\" chunks (007)";
222 if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (008)";
227 if(!append_block_(fm, offset, 8 + (memcmp(buffer, "data", 4)? size : 0), error))
230 if(error) *error = "invalid WAVE file: seek error (009)";
235 if(error) *error = "invalid WAVE file: unexpected EOF (010)";
239 if(error) *error = "invalid WAVE file: missing \"fmt \" chunk (011)";
243 if(error) *error = "invalid WAVE file: missing \"data\" chunk (012)";
249 static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__Metadata_SimpleIterator *it, const char **error)
260 if(error) *error = "no matching PADDING block found (004)";
265 if(error) *error = "PADDING block with wrong size found (005)";
271 if(error) *error = "seek failed in WAVE/AIFF file (006)";
275 if(error) *error = "seek failed in FLAC file (007)";
283 if(error) *error = "write failed in FLAC file (008)";
288 if(error) *error = "seek failed in FLAC file (009)";
294 if(error) *error = "write failed in FLAC file (010)";
298 if(!copy_data_(fin, fout, fm->blocks[block_num].size, error, "read failed in WAVE/AIFF file (011)", "write failed in FLAC file (012)"))
305 static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadata_SimpleIterator *it, const char **error)
317 if(error) *error = "FLAC__metadata_simple_iterator_get_application_id() error (003)";
328 if(error) *error = "seek error (004)";
332 if(error) *error = "read error (005)";
341 if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (005)";
348 if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (006)";
354 if(error) *error = "invalid WAVE metadata: multiple \"fmt \" chunks (007)";
358 if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (008)";
365 if(error) *error = "invalid WAVE metadata: multiple \"data\" chunks (009)";
369 if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (010)";
378 if(error) *error = "invalid AIFF metadata: multiple \"COMM\" chunks (011)";
382 if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (012)";
389 if(error) *error = "invalid AIFF metadata: multiple \"SSND\" chunks (013)";
393 if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (014)";
399 if(error) *error = "read error (015)";
408 if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (016)";
411 if(!append_block_(fm, offset, FLAC__metadata_simple_iterator_get_block_length(it)-sizeof(id), error))
415 if(error) *error = "no foreign metadata found (017)";
419 if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"fmt \" chunk (018)" : "invalid AIFF file: missing \"COMM\" chunk (018)";
423 if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"data\" chunk (019)" : "invalid AIFF file: missing \"SSND\" chunk (019)";
429 static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, off_t offset1, off_t offset2, off_t offset3, const char **error)
433 if(error) *error = "seek failed in WAVE/AIFF file (002)";
438 if(error) *error = "seek failed in FLAC file (003)";
441 if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (004)", "write failed in FLAC file (005)"))
445 if(error) *error = "seek failed in WAVE/AIFF file (006)";
450 if(error) *error = "seek failed in FLAC file (007)";
453 if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (008)", "write failed in FLAC file (009)"))
457 if(error) *error = "seek failed in WAVE/AIFF file (010)";
462 if(error) *error = "seek failed in FLAC file (011)";
465 if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (012)", "write failed in FLAC file (013)"))
488 FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error)
493 if(error) *error = "can't open AIFF file for reading (000)";
496 ok = read_from_aiff_(fm, f, error);
501 FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error)
506 if(error) *error = "can't open WAVE file for reading (000)";
509 ok = read_from_wave_(fm, f, error);
514 FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error)
520 if(error) *error = "out of memory (000)";
524 if(error) *error = "can't initialize iterator (001)";
529 if(error) *error = "can't open WAVE/AIFF file for reading (002)";
534 if(error) *error = "can't open FLAC file for updating (003)";
539 ok = write_to_flac_(fm, fin, fout, it, error);
546 FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error)
552 if(error) *error = "out of memory (000)";
556 if(error) *error = "can't initialize iterator (001)";
561 if(error) *error = "can't open FLAC file for reading (002)";
565 ok = read_from_flac_(fm, f, it, error);
571 FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error)
576 if(error) *error = "can't open FLAC file for reading (000)";
580 if(error) *error = "can't open WAVE/AIFF file for updating (001)";
584 ok = write_to_iff_(fm, fin, fout, offset1, offset2, offset3, error);