Recognizes if input is ogg or not.
[xiph.git] / vorbis-tools / oggenc / audio.h
blob72af2b64a3e0e96554ebca2cef46717346500bbe
2 #ifndef __AUDIO_H
3 #define __AUDIO_H
5 #include "encode.h"
6 #include <stdio.h>
8 int setup_resample(oe_enc_opt *opt);
9 void clear_resample(oe_enc_opt *opt);
10 void setup_downmix(oe_enc_opt *opt);
11 void clear_downmix(oe_enc_opt *opt);
12 void setup_scaler(oe_enc_opt *opt, float scale);
13 void clear_scaler(oe_enc_opt *opt);
15 typedef struct
17 int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
18 int id_data_len; /* Amount of data needed to id whether this can load the file */
19 int (*open_func)(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
20 void (*close_func)(void *);
21 char *format;
22 char *description;
23 } input_format;
26 typedef struct {
27 short format;
28 short channels;
29 int samplerate;
30 int bytespersec;
31 short align;
32 short samplesize;
33 } wav_fmt;
35 typedef struct {
36 short channels;
37 short samplesize;
38 long totalsamples;
39 long samplesread;
40 FILE *f;
41 short bigendian;
42 int *channel_permute;
43 } wavfile;
45 typedef struct {
46 short channels;
47 int totalframes;
48 short samplesize;
49 int rate;
50 int offset;
51 int blocksize;
52 } aiff_fmt;
54 typedef wavfile aifffile; /* They're the same */
56 input_format *open_audio_file(FILE *in, oe_enc_opt *opt);
58 int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
59 int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
60 int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
61 int wav_id(unsigned char *buf, int len);
62 int aiff_id(unsigned char *buf, int len);
63 void wav_close(void *);
64 void raw_close(void *);
66 long wav_read(void *, float **buffer, int samples);
67 long wav_ieee_read(void *, float **buffer, int samples);
68 long raw_read_stereo(void *, float **buffer, int samples);
70 #endif /* __AUDIO_H */