xref: /aosp_15_r20/external/flac/src/flac/decode.h (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1 /* flac - Command-line FLAC encoder/decoder
2  * Copyright (C) 2000-2009  Josh Coalson
3  * Copyright (C) 2011-2023  Xiph.Org Foundation
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef flac__decode_h
21 #define flac__decode_h
22 
23 #ifdef HAVE_CONFIG_H
24 #  include <config.h>
25 #endif
26 
27 #include "analyze.h"
28 #include "foreign_metadata.h"
29 #include "utils.h"
30 #include "share/replaygain_synthesis.h"
31 
32 
33 typedef struct {
34 	FLAC__bool apply;
35 	FLAC__bool use_album_gain; /* false => use track gain */
36 	enum { RGSS_LIMIT__NONE, RGSS_LIMIT__PEAK, RGSS_LIMIT__HARD} limiter;
37 	NoiseShaping noise_shaping;
38 	double preamp;
39 } replaygain_synthesis_spec_t;
40 
41 typedef struct {
42 	FLAC__bool treat_warnings_as_errors;
43 	FLAC__bool continue_through_decode_errors;
44 	replaygain_synthesis_spec_t replaygain_synthesis_spec;
45 #if FLAC__HAS_OGG
46 	FLAC__bool is_ogg;
47 	FLAC__bool use_first_serial_number;
48 	long serial_number;
49 #endif
50 	utils__SkipUntilSpecification skip_specification;
51 	utils__SkipUntilSpecification until_specification;
52 	FLAC__bool has_cue_specification;
53 	utils__CueSpecification cue_specification;
54 	FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
55 	FLAC__bool relaxed_foreign_metadata_handling;
56 	FileSubFormat force_subformat;
57 
58 	FileFormat format;
59 	union {
60 		struct {
61 			FLAC__bool is_big_endian;
62 			FLAC__bool is_unsigned_samples;
63 		} raw;
64 		struct {
65 			foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */
66 		} iff;
67 	} format_options;
68 } decode_options_t;
69 
70 /* outfile == 0 => test only */
71 int flac__decode_file(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, decode_options_t options);
72 
73 #endif
74