1 #ifndef LAME_GLOBAL_FLAGS_H
2 #define LAME_GLOBAL_FLAGS_H
4 #ifndef lame_internal_flags_defined
5 #define lame_internal_flags_defined
6 struct lame_internal_flags;
7 typedef struct lame_internal_flags lame_internal_flags;
11 typedef enum short_block_e {
12 short_block_not_set = -1, /* allow LAME to decide */
13 short_block_allowed = 0, /* LAME may use them, even different block types for L/R */
14 short_block_coupled, /* LAME may use them, but always same block types in L/R */
15 short_block_dispensed, /* LAME will not use short blocks, long blocks only */
16 short_block_forced /* LAME will not use long blocks, short blocks only */
19 /***********************************************************************
21 * Control Parameters set by User. These parameters are here for
22 * backwards compatibility with the old, non-shared lib API.
23 * Please use the lame_set_variablename() functions below
26 ***********************************************************************/
27 struct lame_global_struct {
28 unsigned int class_id;
30 /* input description */
31 unsigned long num_samples; /* number of samples. default=2^32-1 */
32 int num_channels; /* input number of channels. default=2 */
33 int samplerate_in; /* input_samp_rate in Hz. default=44.1 kHz */
34 int samplerate_out; /* output_samp_rate.
35 default: LAME picks best value
36 at least not used for MP3 decoding:
37 Remember 44.1 kHz MP3s and AC97 */
38 float scale; /* scale input by this amount before encoding
39 at least not used for MP3 decoding */
40 float scale_left; /* scale input of channel 0 (left) by this
41 amount before encoding */
42 float scale_right; /* scale input of channel 1 (right) by this
43 amount before encoding */
45 /* general control params */
46 int analysis; /* collect data for a MP3 frame analyzer? */
47 int write_lame_tag; /* add Xing VBR tag? */
48 int decode_only; /* use lame/mpglib to convert mp3 to wav */
49 int quality; /* quality setting 0=best, 9=worst default=5 */
50 MPEG_mode mode; /* see enum in lame.h
51 default = LAME picks best value */
52 int force_ms; /* force M/S mode. requires mode=1 */
53 int free_format; /* use free format? default=0 */
54 int findReplayGain; /* find the RG value? default=0 */
55 int decode_on_the_fly; /* decode on the fly? default=0 */
56 int write_id3tag_automatic; /* 1 (default) writes ID3 tags, 0 not */
63 int subblock_gain; /* 0 = no, 1 = yes */
64 int use_best_huffman; /* 0 = no. 1=outside loop 2=inside loop(slow) */
67 * set either brate>0 or compression_ratio>0, LAME will compute
68 * the value of the variable not set.
69 * Default is compression_ratio = 11.025
71 int brate; /* bitrate */
72 float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file) */
76 int copyright; /* mark as copyright. default=0 */
77 int original; /* mark as original. default=1 */
78 int extension; /* the MP3 'private extension' bit.
80 int emphasis; /* Input PCM is emphased PCM (for
81 instance from one of the rarely
82 emphased CDs), it is STRONGLY not
83 recommended to use this, because
84 psycho does not take it into account,
85 and last but not least many decoders
86 don't care about these bits */
87 int error_protection; /* use 2 bytes per frame for a CRC
88 checksum. default=0 */
89 int strict_ISO; /* enforce ISO spec as much as possible */
91 int disable_reservoir; /* use bit reservoir? */
93 /* quantization/noise shaping */
104 float VBR_q_frac; /* Range [0,...,1[ */
105 int VBR_q; /* Range [0,...,9] */
106 int VBR_mean_bitrate_kbps;
107 int VBR_min_bitrate_kbps;
108 int VBR_max_bitrate_kbps;
109 int VBR_hard_min; /* strictly enforce VBR_min_bitrate
110 normaly, it will be violated for analog
114 /* resampling and filtering */
115 int lowpassfreq; /* freq in Hz. 0=lame choses.
117 int highpassfreq; /* freq in Hz. 0=lame choses.
119 int lowpasswidth; /* freq width of filter, in Hz
121 int highpasswidth; /* freq width of filter, in Hz
127 * psycho acoustics and other arguments which you should not change
128 * unless you know what you are doing
131 float maskingadjust_short;
132 int ATHonly; /* only use ATH */
133 int ATHshort; /* only use ATH for short blocks */
134 int noATH; /* disable ATH */
135 int ATHtype; /* select ATH formula */
136 float ATHcurve; /* change ATH formula 4 shape */
137 float ATH_lower_db; /* lower ATH by this many db */
138 int athaa_type; /* select ATH auto-adjust scheme */
139 float athaa_sensitivity; /* dB, tune active region of auto-level */
140 short_block_t short_blocks;
141 int useTemporal; /* use temporal masking effect */
143 float msfix; /* Naoki's adjustment of Mid/Side maskings */
145 int tune; /* 0 off, 1 on */
146 float tune_value_a; /* used to pass values for debugging and stuff */
148 float attackthre; /* attack threshold for L/R/M channel */
149 float attackthre_s; /* attack threshold for S channel */
153 void (*msgf) (const char *format, va_list ap);
154 void (*debugf) (const char *format, va_list ap);
155 void (*errorf) (const char *format, va_list ap);
158 /************************************************************************/
159 /* internal variables, do not set... */
160 /* provided because they may be of use to calling application */
161 /************************************************************************/
163 int lame_allocated_gfp; /* is this struct owned by calling
168 /**************************************************************************/
169 /* more internal variables are stored in this structure: */
170 /**************************************************************************/
171 lame_internal_flags *internal_flags;
182 int is_lame_global_flags_valid(const lame_global_flags * gfp);
184 #endif /* LAME_GLOBAL_FLAGS_H */