static void print_stats(const stream_info_struct *stream_info);
-int flac__decode_wav(const char *infile, const char *outfile, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options)
+int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options)
{
FLAC__bool md5_failure = false;
stream_info_struct stream_info;
stream_info.abort_flag = false;
stream_info.analysis_mode = analysis_mode;
stream_info.aopts = aopts;
- stream_info.test_only = (outfile == 0);
+ stream_info.test_only = (outfilename == 0);
stream_info.is_wave_out = true;
stream_info.verbose = options.common.verbose;
stream_info.skip = options.common.skip;
stream_info.is_ogg = options.common.is_ogg;
#endif
stream_info.decoder.file = 0; /* this zeroes stream_info.decoder.stream also */
- stream_info.inbasefilename = flac__file_get_basename(infile);
+ stream_info.inbasefilename = flac__file_get_basename(infilename);
stream_info.fout = 0; /* initialized with an open file later if necessary */
FLAC__ASSERT(!(stream_info.test_only && stream_info.analysis_mode));
if(!stream_info.test_only) {
- if(0 == strcmp(outfile, "-")) {
+ if(0 == strcmp(outfilename, "-")) {
stream_info.fout = stdout;
}
else {
- if(0 == (stream_info.fout = fopen(outfile, "wb"))) {
- fprintf(stderr, "%s: ERROR: can't open output file %s\n", stream_info.inbasefilename, outfile);
+ if(0 == (stream_info.fout = fopen(outfilename, "wb"))) {
+ fprintf(stderr, "%s: ERROR: can't open output file %s\n", stream_info.inbasefilename, outfilename);
return 1;
}
}
#ifdef FLaC__HAS_OGG
if(stream_info.is_ogg) {
- if (0 == strcmp(infile, "-")) {
+ if (0 == strcmp(infilename, "-")) {
stream_info.fin = stdin;
} else {
- if (0 == (stream_info.fin = fopen(infile, "rb"))) {
- fprintf(stderr, "%s: ERROR: can't open input file %s\n", stream_info.inbasefilename, infile);
+ if (0 == (stream_info.fin = fopen(infilename, "rb"))) {
+ fprintf(stderr, "%s: ERROR: can't open input file %s\n", stream_info.inbasefilename, infilename);
if(stream_info.fout != stdout)
fclose(stream_info.fout);
return 1;
if(analysis_mode)
flac__analyze_init(aopts);
- if(!init(infile, &stream_info))
+ if(!init(infilename, &stream_info))
goto wav_abort_;
if(stream_info.skip > 0) {
}
if(0 != stream_info.fout && stream_info.fout != stdout) {
fclose(stream_info.fout);
- unlink(outfile);
+ unlink(outfilename);
}
#ifdef FLaC__HAS_OGG
if(stream_info.is_ogg) {
return 1;
}
-int flac__decode_raw(const char *infile, const char *outfile, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options)
+int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options)
{
FLAC__bool md5_failure = false;
stream_info_struct stream_info;
stream_info.abort_flag = false;
stream_info.analysis_mode = analysis_mode;
stream_info.aopts = aopts;
- stream_info.test_only = (outfile == 0);
+ stream_info.test_only = (outfilename == 0);
stream_info.is_wave_out = false;
stream_info.is_big_endian = options.is_big_endian;
stream_info.is_unsigned_samples = options.is_unsigned_samples;
stream_info.samples_processed = 0;
stream_info.frame_counter = 0;
#ifdef FLaC__HAS_OGG
- stream_info.is_ogg = is_ogg;
+ stream_info.is_ogg = options.common.is_ogg;
#endif
stream_info.decoder.file = 0; /* this zeroes stream_info.decoder.stream also */
- stream_info.inbasefilename = flac__file_get_basename(infile);
+ stream_info.inbasefilename = flac__file_get_basename(infilename);
stream_info.fout = 0; /* initialized with an open file later if necessary */
FLAC__ASSERT(!(stream_info.test_only && stream_info.analysis_mode));
if(!stream_info.test_only) {
- if(0 == strcmp(outfile, "-")) {
+ if(0 == strcmp(outfilename, "-")) {
stream_info.fout = stdout;
}
else {
- if(0 == (stream_info.fout = fopen(outfile, "wb"))) {
- fprintf(stderr, "%s: ERROR: can't open output file %s\n", stream_info.inbasefilename, outfile);
+ if(0 == (stream_info.fout = fopen(outfilename, "wb"))) {
+ fprintf(stderr, "%s: ERROR: can't open output file %s\n", stream_info.inbasefilename, outfilename);
return 1;
}
}
#ifdef FLaC__HAS_OGG
if(stream_info.is_ogg) {
- if (0 == strcmp(infile, "-")) {
+ if (0 == strcmp(infilename, "-")) {
stream_info.fin = stdin;
} else {
- if (0 == (stream_info.fin = fopen(infile, "rb"))) {
- fprintf(stderr, "%s: ERROR: can't open input file %s\n", stream_info.inbasefilename, infile);
+ if (0 == (stream_info.fin = fopen(infilename, "rb"))) {
+ fprintf(stderr, "%s: ERROR: can't open input file %s\n", stream_info.inbasefilename, infilename);
if(stream_info.fout != stdout)
fclose(stream_info.fout);
return 1;
if(analysis_mode)
flac__analyze_init(aopts);
- if(!init(infile, &stream_info))
+ if(!init(infilename, &stream_info))
goto raw_abort_;
if(stream_info.skip > 0) {
}
if(0 != stream_info.fout && stream_info.fout != stdout) {
fclose(stream_info.fout);
- unlink(outfile);
+ unlink(outfilename);
}
#ifdef FLaC__HAS_OGG
if(stream_info.is_ogg) {
}
FLAC__stream_decoder_set_read_callback(stream_info->decoder.stream, read_callback);
-................................................................................
/*
* The three ugly casts here are to 'downcast' the 'void *' argument of
* the callback down to 'FLAC__StreamDecoder *'. In C++ this would be
(void)decoder; /* avoid compiler warning */
- if (feof(fin))
+ if(feof(fin))
return FLAC__STREAM_DECODER_READ_END_OF_STREAM;
bytes_read = fread(oggbuf, 1, OGG_READ_BUFFER_SIZE, fin);
- if (ferror(fin))
+ if(ferror(fin))
return FLAC__STREAM_DECODER_READ_ABORT;
- if (ogg_sync_wrote(&stream_info->ogg.oy, bytes_read) < 0)
+ if(ogg_sync_wrote(&stream_info->ogg.oy, bytes_read) < 0)
return FLAC__STREAM_DECODER_READ_ABORT;
- while (ogg_sync_pageout(&stream_info->ogg.oy, &og) == 1) {
- if (ogg_stream_pagein(&stream_info->ogg.os, &og) == 0) {
+ while(ogg_sync_pageout(&stream_info->ogg.oy, &og) == 1) {
+ if(ogg_stream_pagein(&stream_info->ogg.os, &og) == 0) {
ogg_packet op;
- while (ogg_stream_packetout(&stream_info->ogg.os, &op) == 1) {
+ while(ogg_stream_packetout(&stream_info->ogg.os, &op) == 1) {
memcpy(buffer + offset, op.packet, op.bytes);
*bytes += op.bytes;
offset += op.bytes;