add --warnings-as-errors option to flac; for picture importing, allow MIME type in...
[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,2007  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 #if 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 treat_warnings_as_errors;
77         FLAC__bool continue_through_decode_errors; /* currently only obeyed when encoding from FLAC or Ogg FLAC */
78         FLAC__bool cued_seekpoints;
79         FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
80
81         /* options related to --replay-gain and --sector-align */
82         FLAC__bool is_first_file;
83         FLAC__bool is_last_file;
84         FLAC__int32 **align_reservoir;
85         unsigned *align_reservoir_samples;
86         FLAC__bool replay_gain;
87         FLAC__bool sector_align;
88
89         FLAC__StreamMetadata *vorbis_comment;
90         FLAC__StreamMetadata *pictures[64];
91         unsigned num_pictures;
92
93         struct {
94                 FLAC__bool disable_constant_subframes;
95                 FLAC__bool disable_fixed_subframes;
96                 FLAC__bool disable_verbatim_subframes;
97         } debug;
98 } encode_options_t;
99
100 typedef struct {
101         encode_options_t common;
102 } wav_encode_options_t;
103
104 typedef struct {
105         encode_options_t common;
106
107         FLAC__bool is_big_endian;
108         FLAC__bool is_unsigned_samples;
109         unsigned channels;
110         unsigned bps;
111         unsigned sample_rate;
112 } raw_encode_options_t;
113
114 typedef struct {
115         encode_options_t common;
116 } flac_encode_options_t;
117
118 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);
119 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);
120 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);
121 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, FLAC__bool input_is_ogg);
122
123 #endif