]> 4ch.mooo.com Git - 16.git/blob - src/lib/dl/ext/vorbtool/flac.h
refresh wwww
[16.git] / src / lib / dl / ext / vorbtool / flac.h
1
2 #ifndef __FLAC_H
3 #define __FLAC_H
4
5 #include "encode.h"
6 #include "audio.h"
7 #include <stdio.h>
8 #include <flac/stream_decoder.h>
9 #if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
10 #define NEED_EASYFLAC 1
11 #endif
12 #if NEED_EASYFLAC
13 #include <OggFLAC/stream_decoder.h>
14 #include "easyflac.h"
15 #endif
16
17 typedef struct {
18 #if NEED_EASYFLAC
19     EasyFLAC__StreamDecoder *decoder;
20 #else
21     FLAC__StreamDecoder *decoder;
22 #endif
23     short channels;
24     int rate;
25     long totalsamples; /* per channel, of course */
26
27     FLAC__StreamMetadata *comments;
28
29     FILE *in;  /* Cache the FILE pointer so the FLAC read callback can use it */
30     int eos;  /* End of stream read */
31
32
33     /* Buffer for decoded audio */
34     float **buf;  /* channels by buf_len array */
35     int buf_len;
36     int buf_start; /* Offset to start of audio data */
37     int buf_fill; /* Number of bytes of audio data in buffer */
38
39     /* Buffer for input data we already read in the id phase */
40     unsigned char *oldbuf;
41     int oldbuf_len;
42     int oldbuf_start;
43 } flacfile;
44
45
46 int flac_id(unsigned char *buf, int len);
47 int oggflac_id(unsigned char *buf, int len);
48 int flac_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
49 void flac_close(void *);
50
51 long flac_read(void *, float **buffer, int samples);
52
53 #endif /* __FLAC_H */
54