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#if HAVE_CONFIG_H 23# include <config.h> 24#endif 25 26#include "FLAC/metadata.h" 27#include "foreign_metadata.h" 28#include "utils.h" 29 30extern const int FLAC_ENCODE__DEFAULT_PADDING; 31 32typedef enum { 33 CST_BLOCKSIZE, 34 CST_COMPRESSION_LEVEL, 35 CST_DO_MID_SIDE, 36 CST_LOOSE_MID_SIDE, 37 CST_APODIZATION, 38 CST_MAX_LPC_ORDER, 39 CST_QLP_COEFF_PRECISION, 40 CST_DO_QLP_COEFF_PREC_SEARCH, 41 CST_DO_ESCAPE_CODING, 42 CST_DO_EXHAUSTIVE_MODEL_SEARCH, 43 CST_MIN_RESIDUAL_PARTITION_ORDER, 44 CST_MAX_RESIDUAL_PARTITION_ORDER, 45 CST_RICE_PARAMETER_SEARCH_DIST 46} compression_setting_type_t; 47 48typedef struct { 49 compression_setting_type_t type; 50 union { 51 FLAC__bool t_bool; 52 unsigned t_unsigned; 53 const char *t_string; 54 } value; 55} compression_setting_t; 56 57typedef struct { 58 utils__SkipUntilSpecification skip_specification; 59 utils__SkipUntilSpecification until_specification; 60 FLAC__bool verify; 61#if FLAC__HAS_OGG 62 FLAC__bool use_ogg; 63 long serial_number; 64#endif 65 FLAC__bool lax; 66 int padding; 67 size_t num_compression_settings; 68 compression_setting_t compression_settings[64]; 69 char *requested_seek_points; 70 int num_requested_seek_points; 71 const char *cuesheet_filename; 72 FLAC__bool treat_warnings_as_errors; 73 FLAC__bool continue_through_decode_errors; /* currently only obeyed when encoding from FLAC or Ogg FLAC */ 74 FLAC__bool cued_seekpoints; 75 FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ 76 77 /* options related to --replay-gain and --sector-align */ 78 FLAC__bool is_first_file; 79 FLAC__bool is_last_file; 80 FLAC__int32 **align_reservoir; 81 unsigned *align_reservoir_samples; 82 FLAC__bool replay_gain; 83 FLAC__bool ignore_chunk_sizes; 84 FLAC__bool sector_align; 85 86 FLAC__StreamMetadata *vorbis_comment; 87 FLAC__StreamMetadata *pictures[64]; 88 unsigned num_pictures; 89 90 struct { 91 FLAC__bool disable_constant_subframes; 92 FLAC__bool disable_fixed_subframes; 93 FLAC__bool disable_verbatim_subframes; 94 FLAC__bool do_md5; 95 } debug; 96} encode_options_t; 97 98typedef struct { 99 encode_options_t common; 100 foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ 101} wav_encode_options_t; 102 103typedef struct { 104 encode_options_t common; 105 106 FLAC__bool is_big_endian; 107 FLAC__bool is_unsigned_samples; 108 unsigned channels; 109 unsigned bps; 110 unsigned sample_rate; 111} raw_encode_options_t; 112 113typedef struct { 114 encode_options_t common; 115} flac_encode_options_t; 116 117int 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); 118int 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); 119int 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); 120int 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); 121 122#endif 123