switch to using FLAC__stream_encoder_set_compression_level()
[platform/upstream/flac.git] / src / flac / encode.h
1 /* flac - Command-line FLAC encoder/decoder
2  * Copyright (C) 2000,2001,2002,2003,2004,2005,2006  Josh Coalson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19 #ifndef flac__encode_h
20 #define flac__encode_h
21
22 /* needed because of off_t */
23 #if HAVE_CONFIG_H
24 #  include <config.h>
25 #endif
26
27 #include "FLAC/metadata.h"
28 #include "utils.h"
29
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33
34 extern const int FLAC_ENCODE__DEFAULT_PADDING;
35
36 typedef enum {
37         CST_BLOCKSIZE,
38         CST_COMPRESSION_LEVEL,
39         CST_DO_MID_SIDE,
40         CST_LOOSE_MID_SIDE,
41         CST_APODIZATION,
42         CST_MAX_LPC_ORDER,
43         CST_QLP_COEFF_PRECISION,
44         CST_DO_QLP_COEFF_PREC_SEARCH,
45         CST_DO_ESCAPE_CODING,
46         CST_DO_EXHAUSTIVE_MODEL_SEARCH,
47         CST_MIN_RESIDUAL_PARTITION_ORDER,
48         CST_MAX_RESIDUAL_PARTITION_ORDER,
49         CST_RICE_PARAMETER_SEARCH_DIST
50 } compression_setting_type_t;
51
52 typedef struct {
53         compression_setting_type_t type;
54         union {
55                 FLAC__bool t_bool;
56                 unsigned t_unsigned;
57                 const char *t_string;
58         } value;
59 } compression_setting_t;
60
61 typedef struct {
62         utils__SkipUntilSpecification skip_specification;
63         utils__SkipUntilSpecification until_specification;
64         FLAC__bool verify;
65 #ifdef FLAC__HAS_OGG
66         FLAC__bool use_ogg;
67         long serial_number;
68 #endif
69         FLAC__bool lax;
70         int padding;
71         size_t num_compression_settings;
72         compression_setting_t compression_settings[64];
73         char *requested_seek_points;
74         int num_requested_seek_points;
75         const char *cuesheet_filename;
76         FLAC__bool cued_seekpoints;
77         FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
78
79         /* options related to --replay-gain and --sector-align */
80         FLAC__bool is_first_file;
81         FLAC__bool is_last_file;
82         FLAC__int32 **align_reservoir;
83         unsigned *align_reservoir_samples;
84         FLAC__bool replay_gain;
85         FLAC__bool sector_align;
86
87         FLAC__StreamMetadata *vorbis_comment;
88         FLAC__StreamMetadata *pictures[64];
89         unsigned num_pictures;
90
91         struct {
92                 FLAC__bool disable_constant_subframes;
93                 FLAC__bool disable_fixed_subframes;
94                 FLAC__bool disable_verbatim_subframes;
95         } debug;
96 } encode_options_t;
97
98 typedef struct {
99         encode_options_t common;
100 } wav_encode_options_t;
101
102 typedef struct {
103         encode_options_t common;
104
105         FLAC__bool is_big_endian;
106         FLAC__bool is_unsigned_samples;
107         unsigned channels;
108         unsigned bps;
109         unsigned sample_rate;
110 } raw_encode_options_t;
111
112 typedef struct {
113         encode_options_t common;
114 } flac_encode_options_t;
115
116 int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc);
117 int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options);
118 int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options);
119 int flac__encode_flac(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, flac_encode_options_t options);
120
121 #endif