vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

dflac.c (2198B)


      1 
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 #include <stdarg.h>
      5 #include <sys/stat.h>
      6 #include <assert.h>
      7 #include <unistd.h>
      8 
      9 #include "FLAC/file_decoder.h"
     10 #include "src/flac/decode.h"
     11 
     12 void fatal(const char *fmt, ...)
     13 {
     14 	va_list ap;
     15 	va_start(ap, fmt);
     16 	vfprintf(stderr, fmt, ap);
     17 	va_end(ap);
     18 	fputc('\n', stderr);
     19 	exit(2);
     20 }
     21 
     22 int fseek(FILE *stream, long offset, int whence) { assert(0); }
     23 long ftell(FILE *stream) { assert(0); }
     24 FILE *fopen(const char *path, const char *mode) { assert(0); }
     25 int fclose(FILE *fp) { assert(0); }
     26 int unlink(const char *path) { assert(0); }
     27 int stat(const char *file_name, struct stat *buf) { assert(0); }
     28 double atof(const char *nptr) { assert(0); }
     29 
     30 const char *grabbag__file_get_basename(const char *path) { return path; }
     31 FILE *grabbag__file_get_binary_stdout() { return stdout; }
     32 
     33 void grabbag__replaygain_load_from_vorbiscomment() { assert(0); }
     34 void grabbag__replaygain_compute_scale_factor() { assert(0); }
     35 void FLAC__replaygain_synthesis__init_dither_context(
     36 	DitherContext *dither, int bits, int shapingtype) { assert(0); }
     37 size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context) { assert(0); }
     38 
     39 void flac__analyze_init(analysis_options aopts) { assert(0); }
     40 void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, analysis_options aopts, FILE *fout) { assert(0); }
     41 void flac__analyze_finish(analysis_options aopts) { assert(0); }
     42 
     43 
     44 
     45 int main(int argc, char **argv)
     46 {
     47 	static wav_decode_options_t wavopts;
     48 	static analysis_options aopts;
     49 
     50 	close(2);  // sorry
     51 
     52 	flac__utils_parse_skip_until_specification(NULL,
     53 			&wavopts.common.skip_specification);
     54 	flac__utils_parse_skip_until_specification(NULL,
     55 			&wavopts.common.until_specification);
     56 	wavopts.common.until_specification.is_relative = true;
     57 
     58 	int rc = flac__decode_wav("-", "-", 0, aopts, wavopts);
     59 	if (rc != 0)
     60 		fatal("flac__decode_wav: %d", rc);
     61 
     62 	return 0;
     63 }
     64