| 1 | #ifndef LAME_GLOBAL_FLAGS_H |
| 2 | #define LAME_GLOBAL_FLAGS_H |
| 3 | |
| 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; |
| 8 | #endif |
| 9 | |
| 10 | |
| 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 */ |
| 17 | } short_block_t; |
| 18 | |
| 19 | /*********************************************************************** |
| 20 | * |
| 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 |
| 24 | * |
| 25 | * |
| 26 | ***********************************************************************/ |
| 27 | struct lame_global_struct { |
| 28 | unsigned int class_id; |
| 29 | |
| 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 */ |
| 44 | |
| 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 */ |
| 57 | |
| 58 | int nogap_total; |
| 59 | int nogap_current; |
| 60 | |
| 61 | int substep_shaping; |
| 62 | int noise_shaping; |
| 63 | int subblock_gain; /* 0 = no, 1 = yes */ |
| 64 | int use_best_huffman; /* 0 = no. 1=outside loop 2=inside loop(slow) */ |
| 65 | |
| 66 | /* |
| 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 |
| 70 | */ |
| 71 | int brate; /* bitrate */ |
| 72 | float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file) */ |
| 73 | |
| 74 | |
| 75 | /* frame params */ |
| 76 | int copyright; /* mark as copyright. default=0 */ |
| 77 | int original; /* mark as original. default=1 */ |
| 78 | int extension; /* the MP3 'private extension' bit. |
| 79 | Meaningless */ |
| 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 */ |
| 90 | |
| 91 | int disable_reservoir; /* use bit reservoir? */ |
| 92 | |
| 93 | /* quantization/noise shaping */ |
| 94 | int quant_comp; |
| 95 | int quant_comp_short; |
| 96 | int experimentalY; |
| 97 | int experimentalZ; |
| 98 | int exp_nspsytune; |
| 99 | |
| 100 | int preset; |
| 101 | |
| 102 | /* VBR control */ |
| 103 | vbr_mode VBR; |
| 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 |
| 111 | silence */ |
| 112 | |
| 113 | |
| 114 | /* resampling and filtering */ |
| 115 | int lowpassfreq; /* freq in Hz. 0=lame choses. |
| 116 | -1=no filter */ |
| 117 | int highpassfreq; /* freq in Hz. 0=lame choses. |
| 118 | -1=no filter */ |
| 119 | int lowpasswidth; /* freq width of filter, in Hz |
| 120 | (default=15%) */ |
| 121 | int highpasswidth; /* freq width of filter, in Hz |
| 122 | (default=15%) */ |
| 123 | |
| 124 | |
| 125 | |
| 126 | /* |
| 127 | * psycho acoustics and other arguments which you should not change |
| 128 | * unless you know what you are doing |
| 129 | */ |
| 130 | float maskingadjust; |
| 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 */ |
| 142 | float interChRatio; |
| 143 | float msfix; /* Naoki's adjustment of Mid/Side maskings */ |
| 144 | |
| 145 | int tune; /* 0 off, 1 on */ |
| 146 | float tune_value_a; /* used to pass values for debugging and stuff */ |
| 147 | |
| 148 | float attackthre; /* attack threshold for L/R/M channel */ |
| 149 | float attackthre_s; /* attack threshold for S channel */ |
| 150 | |
| 151 | |
| 152 | struct { |
| 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); |
| 156 | } report; |
| 157 | |
| 158 | /************************************************************************/ |
| 159 | /* internal variables, do not set... */ |
| 160 | /* provided because they may be of use to calling application */ |
| 161 | /************************************************************************/ |
| 162 | |
| 163 | int lame_allocated_gfp; /* is this struct owned by calling |
| 164 | program or lame? */ |
| 165 | |
| 166 | |
| 167 | |
| 168 | /**************************************************************************/ |
| 169 | /* more internal variables are stored in this structure: */ |
| 170 | /**************************************************************************/ |
| 171 | lame_internal_flags *internal_flags; |
| 172 | |
| 173 | |
| 174 | struct { |
| 175 | int mmx; |
| 176 | int amd3dnow; |
| 177 | int sse; |
| 178 | |
| 179 | } asm_optimizations; |
| 180 | }; |
| 181 | |
| 182 | int is_lame_global_flags_valid(const lame_global_flags * gfp); |
| 183 | |
| 184 | #endif /* LAME_GLOBAL_FLAGS_H */ |