/src/lame/libmp3lame/set_get.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: C; mode: fold -*- */ |
2 | | /* |
3 | | * set/get functions for lame_global_flags |
4 | | * |
5 | | * Copyright (c) 2001-2005 Alexander Leidinger |
6 | | * |
7 | | * This library is free software; you can redistribute it and/or |
8 | | * modify it under the terms of the GNU Library General Public |
9 | | * License as published by the Free Software Foundation; either |
10 | | * version 2 of the License, or (at your option) any later version. |
11 | | * |
12 | | * This library is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | | * Library General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Library General Public |
18 | | * License along with this library; if not, write to the |
19 | | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | | * Boston, MA 02111-1307, USA. |
21 | | */ |
22 | | |
23 | | /* $Id$ */ |
24 | | |
25 | | #ifdef HAVE_CONFIG_H |
26 | | # include <config.h> |
27 | | #endif |
28 | | |
29 | | #include "lame.h" |
30 | | #include "machine.h" |
31 | | #include "encoder.h" |
32 | | #include "util.h" |
33 | | #include "bitstream.h" /* because of compute_flushbits */ |
34 | | |
35 | | #include "set_get.h" |
36 | | #include "lame_global_flags.h" |
37 | | |
38 | | /* |
39 | | * input stream description |
40 | | */ |
41 | | |
42 | | |
43 | | /* number of samples */ |
44 | | /* it's unlikely for this function to return an error */ |
45 | | int |
46 | | lame_set_num_samples(lame_global_flags * gfp, unsigned long num_samples) |
47 | 0 | { |
48 | 0 | if (is_lame_global_flags_valid(gfp)) { |
49 | | /* default = 2^32-1 */ |
50 | 0 | gfp->num_samples = num_samples; |
51 | 0 | return 0; |
52 | 0 | } |
53 | 0 | return -1; |
54 | 0 | } |
55 | | |
56 | | unsigned long |
57 | | lame_get_num_samples(const lame_global_flags * gfp) |
58 | 0 | { |
59 | 0 | if (is_lame_global_flags_valid(gfp)) { |
60 | 0 | return gfp->num_samples; |
61 | 0 | } |
62 | 0 | return 0; |
63 | 0 | } |
64 | | |
65 | | |
66 | | /* input samplerate */ |
67 | | int |
68 | | lame_set_in_samplerate(lame_global_flags * gfp, int in_samplerate) |
69 | 0 | { |
70 | 0 | if (is_lame_global_flags_valid(gfp)) { |
71 | 0 | if (in_samplerate < 1) |
72 | 0 | return -1; |
73 | | /* input sample rate in Hz, default = 44100 Hz */ |
74 | 0 | gfp->samplerate_in = in_samplerate; |
75 | 0 | return 0; |
76 | 0 | } |
77 | 0 | return -1; |
78 | 0 | } |
79 | | |
80 | | int |
81 | | lame_get_in_samplerate(const lame_global_flags * gfp) |
82 | 0 | { |
83 | 0 | if (is_lame_global_flags_valid(gfp)) { |
84 | 0 | return gfp->samplerate_in; |
85 | 0 | } |
86 | 0 | return 0; |
87 | 0 | } |
88 | | |
89 | | |
90 | | /* number of channels in input stream */ |
91 | | int |
92 | | lame_set_num_channels(lame_global_flags * gfp, int num_channels) |
93 | 6.79k | { |
94 | 6.79k | if (is_lame_global_flags_valid(gfp)) { |
95 | | /* default = 2 */ |
96 | 6.79k | if (2 < num_channels || 0 >= num_channels) { |
97 | 0 | return -1; /* we don't support more than 2 channels */ |
98 | 0 | } |
99 | 6.79k | gfp->num_channels = num_channels; |
100 | 6.79k | return 0; |
101 | 6.79k | } |
102 | 0 | return -1; |
103 | 6.79k | } |
104 | | |
105 | | int |
106 | | lame_get_num_channels(const lame_global_flags * gfp) |
107 | 0 | { |
108 | 0 | if (is_lame_global_flags_valid(gfp)) { |
109 | 0 | return gfp->num_channels; |
110 | 0 | } |
111 | 0 | return 0; |
112 | 0 | } |
113 | | |
114 | | |
115 | | /* scale the input by this amount before encoding (not used for decoding) */ |
116 | | int |
117 | | lame_set_scale(lame_global_flags * gfp, float scale) |
118 | 2.93k | { |
119 | 2.93k | if (is_lame_global_flags_valid(gfp)) { |
120 | | /* default = 1 */ |
121 | 2.93k | gfp->scale = scale; |
122 | 2.93k | return 0; |
123 | 2.93k | } |
124 | 0 | return -1; |
125 | 2.93k | } |
126 | | |
127 | | float |
128 | | lame_get_scale(const lame_global_flags * gfp) |
129 | 2.93k | { |
130 | 2.93k | if (is_lame_global_flags_valid(gfp)) { |
131 | 2.93k | return gfp->scale; |
132 | 2.93k | } |
133 | 0 | return 0; |
134 | 2.93k | } |
135 | | |
136 | | |
137 | | /* scale the channel 0 (left) input by this amount before |
138 | | encoding (not used for decoding) */ |
139 | | int |
140 | | lame_set_scale_left(lame_global_flags * gfp, float scale) |
141 | 0 | { |
142 | 0 | if (is_lame_global_flags_valid(gfp)) { |
143 | | /* default = 1 */ |
144 | 0 | gfp->scale_left = scale; |
145 | 0 | return 0; |
146 | 0 | } |
147 | 0 | return -1; |
148 | 0 | } |
149 | | |
150 | | float |
151 | | lame_get_scale_left(const lame_global_flags * gfp) |
152 | 0 | { |
153 | 0 | if (is_lame_global_flags_valid(gfp)) { |
154 | 0 | return gfp->scale_left; |
155 | 0 | } |
156 | 0 | return 0; |
157 | 0 | } |
158 | | |
159 | | |
160 | | /* scale the channel 1 (right) input by this amount before |
161 | | encoding (not used for decoding) */ |
162 | | int |
163 | | lame_set_scale_right(lame_global_flags * gfp, float scale) |
164 | 0 | { |
165 | 0 | if (is_lame_global_flags_valid(gfp)) { |
166 | | /* default = 1 */ |
167 | 0 | gfp->scale_right = scale; |
168 | 0 | return 0; |
169 | 0 | } |
170 | 0 | return -1; |
171 | 0 | } |
172 | | |
173 | | float |
174 | | lame_get_scale_right(const lame_global_flags * gfp) |
175 | 0 | { |
176 | 0 | if (is_lame_global_flags_valid(gfp)) { |
177 | 0 | return gfp->scale_right; |
178 | 0 | } |
179 | 0 | return 0; |
180 | 0 | } |
181 | | |
182 | | |
183 | | /* output sample rate in Hz */ |
184 | | int |
185 | | lame_set_out_samplerate(lame_global_flags * gfp, int out_samplerate) |
186 | 6.56k | { |
187 | 6.56k | if (is_lame_global_flags_valid(gfp)) { |
188 | | /* |
189 | | * default = 0: LAME picks best value based on the amount |
190 | | * of compression |
191 | | * MPEG only allows: |
192 | | * MPEG1 32, 44.1, 48khz |
193 | | * MPEG2 16, 22.05, 24 |
194 | | * MPEG2.5 8, 11.025, 12 |
195 | | * |
196 | | * (not used by decoding routines) |
197 | | */ |
198 | 6.56k | if (out_samplerate != 0) { |
199 | 6.56k | int v=0; |
200 | 6.56k | if (SmpFrqIndex(out_samplerate, &v) < 0) |
201 | 5.24k | return -1; |
202 | 6.56k | } |
203 | 1.32k | gfp->samplerate_out = out_samplerate; |
204 | 1.32k | return 0; |
205 | 6.56k | } |
206 | 0 | return -1; |
207 | 6.56k | } |
208 | | |
209 | | int |
210 | | lame_get_out_samplerate(const lame_global_flags * gfp) |
211 | 0 | { |
212 | 0 | if (is_lame_global_flags_valid(gfp)) { |
213 | 0 | return gfp->samplerate_out; |
214 | 0 | } |
215 | 0 | return 0; |
216 | 0 | } |
217 | | |
218 | | |
219 | | |
220 | | |
221 | | /* |
222 | | * general control parameters |
223 | | */ |
224 | | |
225 | | /* collect data for an MP3 frame analzyer */ |
226 | | int |
227 | | lame_set_analysis(lame_global_flags * gfp, int analysis) |
228 | 0 | { |
229 | 0 | if (is_lame_global_flags_valid(gfp)) { |
230 | | /* default = 0 */ |
231 | | |
232 | | /* enforce disable/enable meaning, if we need more than two values |
233 | | we need to switch to an enum to have an apropriate representation |
234 | | of the possible meanings of the value */ |
235 | 0 | if (0 > analysis || 1 < analysis) |
236 | 0 | return -1; |
237 | 0 | gfp->analysis = analysis; |
238 | 0 | return 0; |
239 | 0 | } |
240 | 0 | return -1; |
241 | 0 | } |
242 | | |
243 | | int |
244 | | lame_get_analysis(const lame_global_flags * gfp) |
245 | 0 | { |
246 | 0 | if (is_lame_global_flags_valid(gfp)) { |
247 | 0 | assert(0 <= gfp->analysis && 1 >= gfp->analysis); |
248 | 0 | return gfp->analysis; |
249 | 0 | } |
250 | 0 | return 0; |
251 | 0 | } |
252 | | |
253 | | |
254 | | /* write a Xing VBR header frame */ |
255 | | int |
256 | | lame_set_bWriteVbrTag(lame_global_flags * gfp, int bWriteVbrTag) |
257 | 1.73k | { |
258 | 1.73k | if (is_lame_global_flags_valid(gfp)) { |
259 | | /* default = 1 (on) for VBR/ABR modes, 0 (off) for CBR mode */ |
260 | | |
261 | | /* enforce disable/enable meaning, if we need more than two values |
262 | | we need to switch to an enum to have an apropriate representation |
263 | | of the possible meanings of the value */ |
264 | 1.73k | if (0 > bWriteVbrTag || 1 < bWriteVbrTag) |
265 | 0 | return -1; |
266 | 1.73k | gfp->write_lame_tag = bWriteVbrTag; |
267 | 1.73k | return 0; |
268 | 1.73k | } |
269 | 0 | return -1; |
270 | 1.73k | } |
271 | | |
272 | | int |
273 | | lame_get_bWriteVbrTag(const lame_global_flags * gfp) |
274 | 0 | { |
275 | 0 | if (is_lame_global_flags_valid(gfp)) { |
276 | 0 | assert(0 <= gfp->write_lame_tag && 1 >= gfp->write_lame_tag); |
277 | 0 | return gfp->write_lame_tag; |
278 | 0 | } |
279 | 0 | return 0; |
280 | 0 | } |
281 | | |
282 | | |
283 | | |
284 | | /* decode only, use lame/mpglib to convert mp3 to wav */ |
285 | | int |
286 | | lame_set_decode_only(lame_global_flags * gfp, int decode_only) |
287 | 0 | { |
288 | 0 | if (is_lame_global_flags_valid(gfp)) { |
289 | | /* default = 0 (disabled) */ |
290 | | |
291 | | /* enforce disable/enable meaning, if we need more than two values |
292 | | we need to switch to an enum to have an apropriate representation |
293 | | of the possible meanings of the value */ |
294 | 0 | if (0 > decode_only || 1 < decode_only) |
295 | 0 | return -1; |
296 | 0 | gfp->decode_only = decode_only; |
297 | 0 | return 0; |
298 | 0 | } |
299 | 0 | return -1; |
300 | 0 | } |
301 | | |
302 | | int |
303 | | lame_get_decode_only(const lame_global_flags * gfp) |
304 | 0 | { |
305 | 0 | if (is_lame_global_flags_valid(gfp)) { |
306 | 0 | assert(0 <= gfp->decode_only && 1 >= gfp->decode_only); |
307 | 0 | return gfp->decode_only; |
308 | 0 | } |
309 | 0 | return 0; |
310 | 0 | } |
311 | | |
312 | | |
313 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
314 | | /* 1=encode a Vorbis .ogg file. default=0 */ |
315 | | /* DEPRECATED */ |
316 | | int CDECL lame_set_ogg(lame_global_flags *, int); |
317 | | int CDECL lame_get_ogg(const lame_global_flags *); |
318 | | #else |
319 | | #endif |
320 | | |
321 | | /* encode a Vorbis .ogg file */ |
322 | | /* DEPRECATED */ |
323 | | int |
324 | | lame_set_ogg(lame_global_flags * gfp, int ogg) |
325 | 0 | { |
326 | 0 | (void) gfp; |
327 | 0 | (void) ogg; |
328 | 0 | return -1; |
329 | 0 | } |
330 | | |
331 | | int |
332 | | lame_get_ogg(const lame_global_flags * gfp) |
333 | 0 | { |
334 | 0 | (void) gfp; |
335 | 0 | return 0; |
336 | 0 | } |
337 | | |
338 | | |
339 | | /* |
340 | | * Internal algorithm selection. |
341 | | * True quality is determined by the bitrate but this variable will effect |
342 | | * quality by selecting expensive or cheap algorithms. |
343 | | * quality=0..9. 0=best (very slow). 9=worst. |
344 | | * recommended: 3 near-best quality, not too slow |
345 | | * 5 good quality, fast |
346 | | * 7 ok quality, really fast |
347 | | */ |
348 | | int |
349 | | lame_set_quality(lame_global_flags * gfp, int quality) |
350 | 6.57k | { |
351 | 6.57k | if (is_lame_global_flags_valid(gfp)) { |
352 | 6.57k | if (quality < 0) { |
353 | 0 | gfp->quality = 0; |
354 | 0 | } |
355 | 6.57k | else if (quality > 9) { |
356 | 0 | gfp->quality = 9; |
357 | 0 | } |
358 | 6.57k | else { |
359 | 6.57k | gfp->quality = quality; |
360 | 6.57k | } |
361 | 6.57k | return 0; |
362 | 6.57k | } |
363 | 0 | return -1; |
364 | 6.57k | } |
365 | | |
366 | | int |
367 | | lame_get_quality(const lame_global_flags * gfp) |
368 | 0 | { |
369 | 0 | if (is_lame_global_flags_valid(gfp)) { |
370 | 0 | return gfp->quality; |
371 | 0 | } |
372 | 0 | return 0; |
373 | 0 | } |
374 | | |
375 | | |
376 | | /* mode = STEREO, JOINT_STEREO, DUAL_CHANNEL (not supported), MONO */ |
377 | | int |
378 | | lame_set_mode(lame_global_flags * gfp, MPEG_mode mode) |
379 | 6.57k | { |
380 | 6.57k | if (is_lame_global_flags_valid(gfp)) { |
381 | 6.57k | int mpg_mode = mode; |
382 | | /* default: lame chooses based on compression ratio and input channels */ |
383 | 6.57k | if (mpg_mode < 0 || MAX_INDICATOR <= mpg_mode) |
384 | 0 | return -1; /* Unknown MPEG mode! */ |
385 | 6.57k | gfp->mode = mode; |
386 | 6.57k | return 0; |
387 | 6.57k | } |
388 | 0 | return -1; |
389 | 6.57k | } |
390 | | |
391 | | MPEG_mode |
392 | | lame_get_mode(const lame_global_flags * gfp) |
393 | 0 | { |
394 | 0 | if (is_lame_global_flags_valid(gfp)) { |
395 | 0 | assert(gfp->mode < MAX_INDICATOR); |
396 | 0 | return gfp->mode; |
397 | 0 | } |
398 | 0 | return NOT_SET; |
399 | 0 | } |
400 | | |
401 | | |
402 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
403 | | /* |
404 | | mode_automs. Use a M/S mode with a switching threshold based on |
405 | | compression ratio |
406 | | DEPRECATED |
407 | | */ |
408 | | int CDECL lame_set_mode_automs(lame_global_flags *, int); |
409 | | int CDECL lame_get_mode_automs(const lame_global_flags *); |
410 | | #else |
411 | | #endif |
412 | | |
413 | | /* Us a M/S mode with a switching threshold based on compression ratio */ |
414 | | /* DEPRECATED */ |
415 | | int |
416 | | lame_set_mode_automs(lame_global_flags * gfp, int mode_automs) |
417 | 0 | { |
418 | 0 | if (is_lame_global_flags_valid(gfp)) { |
419 | | /* default = 0 (disabled) */ |
420 | | |
421 | | /* enforce disable/enable meaning, if we need more than two values |
422 | | we need to switch to an enum to have an apropriate representation |
423 | | of the possible meanings of the value */ |
424 | 0 | if (0 > mode_automs || 1 < mode_automs) |
425 | 0 | return -1; |
426 | 0 | lame_set_mode(gfp, JOINT_STEREO); |
427 | 0 | return 0; |
428 | 0 | } |
429 | 0 | return -1; |
430 | 0 | } |
431 | | |
432 | | int |
433 | | lame_get_mode_automs(const lame_global_flags * gfp) |
434 | 0 | { |
435 | 0 | (void) gfp; |
436 | 0 | return 1; |
437 | 0 | } |
438 | | |
439 | | |
440 | | /* |
441 | | * Force M/S for all frames. For testing only. |
442 | | * Requires mode = 1. |
443 | | */ |
444 | | int |
445 | | lame_set_force_ms(lame_global_flags * gfp, int force_ms) |
446 | 0 | { |
447 | 0 | if (is_lame_global_flags_valid(gfp)) { |
448 | | /* default = 0 (disabled) */ |
449 | | |
450 | | /* enforce disable/enable meaning, if we need more than two values |
451 | | we need to switch to an enum to have an apropriate representation |
452 | | of the possible meanings of the value */ |
453 | 0 | if (0 > force_ms || 1 < force_ms) |
454 | 0 | return -1; |
455 | 0 | gfp->force_ms = force_ms; |
456 | 0 | return 0; |
457 | 0 | } |
458 | 0 | return -1; |
459 | 0 | } |
460 | | |
461 | | int |
462 | | lame_get_force_ms(const lame_global_flags * gfp) |
463 | 0 | { |
464 | 0 | if (is_lame_global_flags_valid(gfp)) { |
465 | 0 | assert(0 <= gfp->force_ms && 1 >= gfp->force_ms); |
466 | 0 | return gfp->force_ms; |
467 | 0 | } |
468 | 0 | return 0; |
469 | 0 | } |
470 | | |
471 | | |
472 | | /* Use free_format. */ |
473 | | int |
474 | | lame_set_free_format(lame_global_flags * gfp, int free_format) |
475 | 0 | { |
476 | 0 | if (is_lame_global_flags_valid(gfp)) { |
477 | | /* default = 0 (disabled) */ |
478 | | |
479 | | /* enforce disable/enable meaning, if we need more than two values |
480 | | we need to switch to an enum to have an apropriate representation |
481 | | of the possible meanings of the value */ |
482 | 0 | if (0 > free_format || 1 < free_format) |
483 | 0 | return -1; |
484 | 0 | gfp->free_format = free_format; |
485 | 0 | return 0; |
486 | 0 | } |
487 | 0 | return -1; |
488 | 0 | } |
489 | | |
490 | | int |
491 | | lame_get_free_format(const lame_global_flags * gfp) |
492 | 0 | { |
493 | 0 | if (is_lame_global_flags_valid(gfp)) { |
494 | 0 | assert(0 <= gfp->free_format && 1 >= gfp->free_format); |
495 | 0 | return gfp->free_format; |
496 | 0 | } |
497 | 0 | return 0; |
498 | 0 | } |
499 | | |
500 | | |
501 | | |
502 | | /* Perform ReplayGain analysis */ |
503 | | int |
504 | | lame_set_findReplayGain(lame_global_flags * gfp, int findReplayGain) |
505 | 0 | { |
506 | 0 | if (is_lame_global_flags_valid(gfp)) { |
507 | | /* default = 0 (disabled) */ |
508 | | |
509 | | /* enforce disable/enable meaning, if we need more than two values |
510 | | we need to switch to an enum to have an apropriate representation |
511 | | of the possible meanings of the value */ |
512 | 0 | if (0 > findReplayGain || 1 < findReplayGain) |
513 | 0 | return -1; |
514 | 0 | gfp->findReplayGain = findReplayGain; |
515 | 0 | return 0; |
516 | 0 | } |
517 | 0 | return -1; |
518 | 0 | } |
519 | | |
520 | | int |
521 | | lame_get_findReplayGain(const lame_global_flags * gfp) |
522 | 0 | { |
523 | 0 | if (is_lame_global_flags_valid(gfp)) { |
524 | 0 | assert(0 <= gfp->findReplayGain && 1 >= gfp->findReplayGain); |
525 | 0 | return gfp->findReplayGain; |
526 | 0 | } |
527 | 0 | return 0; |
528 | 0 | } |
529 | | |
530 | | |
531 | | /* Decode on the fly. Find the peak sample. If ReplayGain analysis is |
532 | | enabled then perform it on the decoded data. */ |
533 | | int |
534 | | lame_set_decode_on_the_fly(lame_global_flags * gfp, int decode_on_the_fly) |
535 | 0 | { |
536 | 0 | if (is_lame_global_flags_valid(gfp)) { |
537 | | #ifndef DECODE_ON_THE_FLY |
538 | | return -1; |
539 | | #else |
540 | | /* default = 0 (disabled) */ |
541 | | |
542 | | /* enforce disable/enable meaning, if we need more than two values |
543 | | we need to switch to an enum to have an apropriate representation |
544 | | of the possible meanings of the value */ |
545 | 0 | if (0 > decode_on_the_fly || 1 < decode_on_the_fly) |
546 | 0 | return -1; |
547 | | |
548 | 0 | gfp->decode_on_the_fly = decode_on_the_fly; |
549 | |
|
550 | 0 | return 0; |
551 | 0 | #endif |
552 | 0 | } |
553 | 0 | return -1; |
554 | 0 | } |
555 | | |
556 | | int |
557 | | lame_get_decode_on_the_fly(const lame_global_flags * gfp) |
558 | 0 | { |
559 | 0 | if (is_lame_global_flags_valid(gfp)) { |
560 | 0 | assert(0 <= gfp->decode_on_the_fly && 1 >= gfp->decode_on_the_fly); |
561 | 0 | return gfp->decode_on_the_fly; |
562 | 0 | } |
563 | 0 | return 0; |
564 | 0 | } |
565 | | |
566 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
567 | | /* DEPRECATED: now does the same as lame_set_findReplayGain() |
568 | | default = 0 (disabled) */ |
569 | | int CDECL lame_set_ReplayGain_input(lame_global_flags *, int); |
570 | | int CDECL lame_get_ReplayGain_input(const lame_global_flags *); |
571 | | |
572 | | /* DEPRECATED: now does the same as |
573 | | lame_set_decode_on_the_fly() && lame_set_findReplayGain() |
574 | | default = 0 (disabled) */ |
575 | | int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int); |
576 | | int CDECL lame_get_ReplayGain_decode(const lame_global_flags *); |
577 | | |
578 | | /* DEPRECATED: now does the same as lame_set_decode_on_the_fly() |
579 | | default = 0 (disabled) */ |
580 | | int CDECL lame_set_findPeakSample(lame_global_flags *, int); |
581 | | int CDECL lame_get_findPeakSample(const lame_global_flags *); |
582 | | #else |
583 | | #endif |
584 | | |
585 | | /* DEPRECATED. same as lame_set_decode_on_the_fly() */ |
586 | | int |
587 | | lame_set_findPeakSample(lame_global_flags * gfp, int arg) |
588 | 0 | { |
589 | 0 | return lame_set_decode_on_the_fly(gfp, arg); |
590 | 0 | } |
591 | | |
592 | | int |
593 | | lame_get_findPeakSample(const lame_global_flags * gfp) |
594 | 0 | { |
595 | 0 | return lame_get_decode_on_the_fly(gfp); |
596 | 0 | } |
597 | | |
598 | | /* DEPRECATED. same as lame_set_findReplayGain() */ |
599 | | int |
600 | | lame_set_ReplayGain_input(lame_global_flags * gfp, int arg) |
601 | 0 | { |
602 | 0 | return lame_set_findReplayGain(gfp, arg); |
603 | 0 | } |
604 | | |
605 | | int |
606 | | lame_get_ReplayGain_input(const lame_global_flags * gfp) |
607 | 0 | { |
608 | 0 | return lame_get_findReplayGain(gfp); |
609 | 0 | } |
610 | | |
611 | | /* DEPRECATED. same as lame_set_decode_on_the_fly() && |
612 | | lame_set_findReplayGain() */ |
613 | | int |
614 | | lame_set_ReplayGain_decode(lame_global_flags * gfp, int arg) |
615 | 0 | { |
616 | 0 | if (lame_set_decode_on_the_fly(gfp, arg) < 0 || lame_set_findReplayGain(gfp, arg) < 0) |
617 | 0 | return -1; |
618 | 0 | else |
619 | 0 | return 0; |
620 | 0 | } |
621 | | |
622 | | int |
623 | | lame_get_ReplayGain_decode(const lame_global_flags * gfp) |
624 | 0 | { |
625 | 0 | if (lame_get_decode_on_the_fly(gfp) > 0 && lame_get_findReplayGain(gfp) > 0) |
626 | 0 | return 1; |
627 | 0 | else |
628 | 0 | return 0; |
629 | 0 | } |
630 | | |
631 | | |
632 | | /* set and get some gapless encoding flags */ |
633 | | |
634 | | int |
635 | | lame_set_nogap_total(lame_global_flags * gfp, int the_nogap_total) |
636 | 0 | { |
637 | 0 | if (is_lame_global_flags_valid(gfp)) { |
638 | 0 | gfp->nogap_total = the_nogap_total; |
639 | 0 | return 0; |
640 | 0 | } |
641 | 0 | return -1; |
642 | 0 | } |
643 | | |
644 | | int |
645 | | lame_get_nogap_total(const lame_global_flags * gfp) |
646 | 0 | { |
647 | 0 | if (is_lame_global_flags_valid(gfp)) { |
648 | 0 | return gfp->nogap_total; |
649 | 0 | } |
650 | 0 | return 0; |
651 | 0 | } |
652 | | |
653 | | int |
654 | | lame_set_nogap_currentindex(lame_global_flags * gfp, int the_nogap_index) |
655 | 0 | { |
656 | 0 | if (is_lame_global_flags_valid(gfp)) { |
657 | 0 | gfp->nogap_current = the_nogap_index; |
658 | 0 | return 0; |
659 | 0 | } |
660 | 0 | return -1; |
661 | 0 | } |
662 | | |
663 | | int |
664 | | lame_get_nogap_currentindex(const lame_global_flags * gfp) |
665 | 0 | { |
666 | 0 | if (is_lame_global_flags_valid(gfp)) { |
667 | 0 | return gfp->nogap_current; |
668 | 0 | } |
669 | 0 | return 0; |
670 | 0 | } |
671 | | |
672 | | |
673 | | /* message handlers */ |
674 | | int |
675 | | lame_set_errorf(lame_global_flags * gfp, void (*func) (const char *, va_list)) |
676 | 0 | { |
677 | 0 | if (is_lame_global_flags_valid(gfp)) { |
678 | 0 | gfp->report.errorf = func; |
679 | 0 | return 0; |
680 | 0 | } |
681 | 0 | return -1; |
682 | 0 | } |
683 | | |
684 | | int |
685 | | lame_set_debugf(lame_global_flags * gfp, void (*func) (const char *, va_list)) |
686 | 0 | { |
687 | 0 | if (is_lame_global_flags_valid(gfp)) { |
688 | 0 | gfp->report.debugf = func; |
689 | 0 | return 0; |
690 | 0 | } |
691 | 0 | return -1; |
692 | 0 | } |
693 | | |
694 | | int |
695 | | lame_set_msgf(lame_global_flags * gfp, void (*func) (const char *, va_list)) |
696 | 0 | { |
697 | 0 | if (is_lame_global_flags_valid(gfp)) { |
698 | 0 | gfp->report.msgf = func; |
699 | 0 | return 0; |
700 | 0 | } |
701 | 0 | return -1; |
702 | 0 | } |
703 | | |
704 | | |
705 | | /* |
706 | | * Set one of |
707 | | * - brate |
708 | | * - compression ratio. |
709 | | * |
710 | | * Default is compression ratio of 11. |
711 | | */ |
712 | | int |
713 | | lame_set_brate(lame_global_flags * gfp, int brate) |
714 | 7.33k | { |
715 | 7.33k | if (is_lame_global_flags_valid(gfp)) { |
716 | 7.33k | gfp->brate = brate; |
717 | 7.33k | if (brate > 320) { |
718 | 297 | gfp->disable_reservoir = 1; |
719 | 297 | } |
720 | 7.33k | return 0; |
721 | 7.33k | } |
722 | 0 | return -1; |
723 | 7.33k | } |
724 | | |
725 | | int |
726 | | lame_get_brate(const lame_global_flags * gfp) |
727 | 0 | { |
728 | 0 | if (is_lame_global_flags_valid(gfp)) { |
729 | 0 | return gfp->brate; |
730 | 0 | } |
731 | 0 | return 0; |
732 | 0 | } |
733 | | |
734 | | int |
735 | | lame_set_compression_ratio(lame_global_flags * gfp, float compression_ratio) |
736 | 0 | { |
737 | 0 | if (is_lame_global_flags_valid(gfp)) { |
738 | 0 | gfp->compression_ratio = compression_ratio; |
739 | 0 | return 0; |
740 | 0 | } |
741 | 0 | return -1; |
742 | 0 | } |
743 | | |
744 | | float |
745 | | lame_get_compression_ratio(const lame_global_flags * gfp) |
746 | 0 | { |
747 | 0 | if (is_lame_global_flags_valid(gfp)) { |
748 | 0 | return gfp->compression_ratio; |
749 | 0 | } |
750 | 0 | return 0; |
751 | 0 | } |
752 | | |
753 | | |
754 | | |
755 | | |
756 | | /* |
757 | | * frame parameters |
758 | | */ |
759 | | |
760 | | /* Mark as copyright protected. */ |
761 | | int |
762 | | lame_set_copyright(lame_global_flags * gfp, int copyright) |
763 | 1.79k | { |
764 | 1.79k | if (is_lame_global_flags_valid(gfp)) { |
765 | | /* default = 0 (disabled) */ |
766 | | |
767 | | /* enforce disable/enable meaning, if we need more than two values |
768 | | we need to switch to an enum to have an apropriate representation |
769 | | of the possible meanings of the value */ |
770 | 1.79k | if (0 > copyright || 1 < copyright) |
771 | 0 | return -1; |
772 | 1.79k | gfp->copyright = copyright; |
773 | 1.79k | return 0; |
774 | 1.79k | } |
775 | 0 | return -1; |
776 | 1.79k | } |
777 | | |
778 | | int |
779 | | lame_get_copyright(const lame_global_flags * gfp) |
780 | 0 | { |
781 | 0 | if (is_lame_global_flags_valid(gfp)) { |
782 | 0 | assert(0 <= gfp->copyright && 1 >= gfp->copyright); |
783 | 0 | return gfp->copyright; |
784 | 0 | } |
785 | 0 | return 0; |
786 | 0 | } |
787 | | |
788 | | |
789 | | /* Mark as original. */ |
790 | | int |
791 | | lame_set_original(lame_global_flags * gfp, int original) |
792 | 1.79k | { |
793 | 1.79k | if (is_lame_global_flags_valid(gfp)) { |
794 | | /* default = 1 (enabled) */ |
795 | | |
796 | | /* enforce disable/enable meaning, if we need more than two values |
797 | | we need to switch to an enum to have an apropriate representation |
798 | | of the possible meanings of the value */ |
799 | 1.79k | if (0 > original || 1 < original) |
800 | 0 | return -1; |
801 | 1.79k | gfp->original = original; |
802 | 1.79k | return 0; |
803 | 1.79k | } |
804 | 0 | return -1; |
805 | 1.79k | } |
806 | | |
807 | | int |
808 | | lame_get_original(const lame_global_flags * gfp) |
809 | 0 | { |
810 | 0 | if (is_lame_global_flags_valid(gfp)) { |
811 | 0 | assert(0 <= gfp->original && 1 >= gfp->original); |
812 | 0 | return gfp->original; |
813 | 0 | } |
814 | 0 | return 0; |
815 | 0 | } |
816 | | |
817 | | |
818 | | /* |
819 | | * error_protection. |
820 | | * Use 2 bytes from each frame for CRC checksum. |
821 | | */ |
822 | | int |
823 | | lame_set_error_protection(lame_global_flags * gfp, int error_protection) |
824 | 2.10k | { |
825 | 2.10k | if (is_lame_global_flags_valid(gfp)) { |
826 | | /* default = 0 (disabled) */ |
827 | | |
828 | | /* enforce disable/enable meaning, if we need more than two values |
829 | | we need to switch to an enum to have an apropriate representation |
830 | | of the possible meanings of the value */ |
831 | 2.10k | if (0 > error_protection || 1 < error_protection) |
832 | 0 | return -1; |
833 | 2.10k | gfp->error_protection = error_protection; |
834 | 2.10k | return 0; |
835 | 2.10k | } |
836 | 0 | return -1; |
837 | 2.10k | } |
838 | | |
839 | | int |
840 | | lame_get_error_protection(const lame_global_flags * gfp) |
841 | 0 | { |
842 | 0 | if (is_lame_global_flags_valid(gfp)) { |
843 | 0 | assert(0 <= gfp->error_protection && 1 >= gfp->error_protection); |
844 | 0 | return gfp->error_protection; |
845 | 0 | } |
846 | 0 | return 0; |
847 | 0 | } |
848 | | |
849 | | |
850 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
851 | | /* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */ |
852 | | int CDECL lame_set_padding_type(lame_global_flags *, Padding_type); |
853 | | Padding_type CDECL lame_get_padding_type(const lame_global_flags *); |
854 | | #else |
855 | | #endif |
856 | | |
857 | | /* |
858 | | * padding_type. |
859 | | * PAD_NO = pad no frames |
860 | | * PAD_ALL = pad all frames |
861 | | * PAD_ADJUST = adjust padding |
862 | | */ |
863 | | int |
864 | | lame_set_padding_type(lame_global_flags * gfp, Padding_type padding_type) |
865 | 0 | { |
866 | 0 | (void) gfp; |
867 | 0 | (void) padding_type; |
868 | 0 | return 0; |
869 | 0 | } |
870 | | |
871 | | Padding_type |
872 | | lame_get_padding_type(const lame_global_flags * gfp) |
873 | 0 | { |
874 | 0 | (void) gfp; |
875 | 0 | return PAD_ADJUST; |
876 | 0 | } |
877 | | |
878 | | |
879 | | /* MP3 'private extension' bit. Meaningless. */ |
880 | | int |
881 | | lame_set_extension(lame_global_flags * gfp, int extension) |
882 | 1.92k | { |
883 | 1.92k | if (is_lame_global_flags_valid(gfp)) { |
884 | | /* default = 0 (disabled) */ |
885 | | /* enforce disable/enable meaning, if we need more than two values |
886 | | we need to switch to an enum to have an apropriate representation |
887 | | of the possible meanings of the value */ |
888 | 1.92k | if (0 > extension || 1 < extension) |
889 | 0 | return -1; |
890 | 1.92k | gfp->extension = extension; |
891 | 1.92k | return 0; |
892 | 1.92k | } |
893 | 0 | return -1; |
894 | 1.92k | } |
895 | | |
896 | | int |
897 | | lame_get_extension(const lame_global_flags * gfp) |
898 | 0 | { |
899 | 0 | if (is_lame_global_flags_valid(gfp)) { |
900 | 0 | assert(0 <= gfp->extension && 1 >= gfp->extension); |
901 | 0 | return gfp->extension; |
902 | 0 | } |
903 | 0 | return 0; |
904 | 0 | } |
905 | | |
906 | | |
907 | | /* Enforce strict ISO compliance. */ |
908 | | int |
909 | | lame_set_strict_ISO(lame_global_flags * gfp, int val) |
910 | 1.69k | { |
911 | 1.69k | if (is_lame_global_flags_valid(gfp)) { |
912 | | /* default = 0 (disabled) */ |
913 | | /* enforce disable/enable meaning, if we need more than two values |
914 | | we need to switch to an enum to have an apropriate representation |
915 | | of the possible meanings of the value */ |
916 | 1.69k | if (val < MDB_DEFAULT || MDB_MAXIMUM < val) |
917 | 0 | return -1; |
918 | 1.69k | gfp->strict_ISO = val; |
919 | 1.69k | return 0; |
920 | 1.69k | } |
921 | 0 | return -1; |
922 | 1.69k | } |
923 | | |
924 | | int |
925 | | lame_get_strict_ISO(const lame_global_flags * gfp) |
926 | 0 | { |
927 | 0 | if (is_lame_global_flags_valid(gfp)) { |
928 | 0 | return gfp->strict_ISO; |
929 | 0 | } |
930 | 0 | return 0; |
931 | 0 | } |
932 | | |
933 | | |
934 | | |
935 | | |
936 | | /******************************************************************** |
937 | | * quantization/noise shaping |
938 | | ***********************************************************************/ |
939 | | |
940 | | /* Disable the bit reservoir. For testing only. */ |
941 | | int |
942 | | lame_set_disable_reservoir(lame_global_flags * gfp, int disable_reservoir) |
943 | 0 | { |
944 | 0 | if (is_lame_global_flags_valid(gfp)) { |
945 | | /* default = 0 (disabled) */ |
946 | | |
947 | | /* enforce disable/enable meaning, if we need more than two values |
948 | | we need to switch to an enum to have an apropriate representation |
949 | | of the possible meanings of the value */ |
950 | 0 | if (0 > disable_reservoir || 1 < disable_reservoir) |
951 | 0 | return -1; |
952 | 0 | gfp->disable_reservoir = disable_reservoir; |
953 | 0 | return 0; |
954 | 0 | } |
955 | 0 | return -1; |
956 | 0 | } |
957 | | |
958 | | int |
959 | | lame_get_disable_reservoir(const lame_global_flags * gfp) |
960 | 0 | { |
961 | 0 | if (is_lame_global_flags_valid(gfp)) { |
962 | 0 | assert(0 <= gfp->disable_reservoir && 1 >= gfp->disable_reservoir); |
963 | 0 | return gfp->disable_reservoir; |
964 | 0 | } |
965 | 0 | return 0; |
966 | 0 | } |
967 | | |
968 | | |
969 | | |
970 | | |
971 | | int |
972 | | lame_set_experimentalX(lame_global_flags * gfp, int experimentalX) |
973 | 0 | { |
974 | 0 | if (is_lame_global_flags_valid(gfp)) { |
975 | 0 | lame_set_quant_comp(gfp, experimentalX); |
976 | 0 | lame_set_quant_comp_short(gfp, experimentalX); |
977 | 0 | return 0; |
978 | 0 | } |
979 | 0 | return -1; |
980 | 0 | } |
981 | | |
982 | | int |
983 | | lame_get_experimentalX(const lame_global_flags * gfp) |
984 | 0 | { |
985 | 0 | return lame_get_quant_comp(gfp); |
986 | 0 | } |
987 | | |
988 | | |
989 | | /* Select a different "best quantization" function. default = 0 */ |
990 | | int |
991 | | lame_set_quant_comp(lame_global_flags * gfp, int quant_type) |
992 | 5.16k | { |
993 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
994 | 5.16k | gfp->quant_comp = quant_type; |
995 | 5.16k | return 0; |
996 | 5.16k | } |
997 | 0 | return -1; |
998 | 5.16k | } |
999 | | |
1000 | | int |
1001 | | lame_get_quant_comp(const lame_global_flags * gfp) |
1002 | 10.3k | { |
1003 | 10.3k | if (is_lame_global_flags_valid(gfp)) { |
1004 | 10.3k | return gfp->quant_comp; |
1005 | 10.3k | } |
1006 | 0 | return 0; |
1007 | 10.3k | } |
1008 | | |
1009 | | |
1010 | | /* Select a different "best quantization" function. default = 0 */ |
1011 | | int |
1012 | | lame_set_quant_comp_short(lame_global_flags * gfp, int quant_type) |
1013 | 5.16k | { |
1014 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1015 | 5.16k | gfp->quant_comp_short = quant_type; |
1016 | 5.16k | return 0; |
1017 | 5.16k | } |
1018 | 0 | return -1; |
1019 | 5.16k | } |
1020 | | |
1021 | | int |
1022 | | lame_get_quant_comp_short(const lame_global_flags * gfp) |
1023 | 10.3k | { |
1024 | 10.3k | if (is_lame_global_flags_valid(gfp)) { |
1025 | 10.3k | return gfp->quant_comp_short; |
1026 | 10.3k | } |
1027 | 0 | return 0; |
1028 | 10.3k | } |
1029 | | |
1030 | | |
1031 | | /* Another experimental option. For testing only. */ |
1032 | | int |
1033 | | lame_set_experimentalY(lame_global_flags * gfp, int experimentalY) |
1034 | 1.50k | { |
1035 | 1.50k | if (is_lame_global_flags_valid(gfp)) { |
1036 | 1.50k | gfp->experimentalY = experimentalY; |
1037 | 1.50k | return 0; |
1038 | 1.50k | } |
1039 | 0 | return -1; |
1040 | 1.50k | } |
1041 | | |
1042 | | int |
1043 | | lame_get_experimentalY(const lame_global_flags * gfp) |
1044 | 0 | { |
1045 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1046 | 0 | return gfp->experimentalY; |
1047 | 0 | } |
1048 | 0 | return 0; |
1049 | 0 | } |
1050 | | |
1051 | | |
1052 | | int |
1053 | | lame_set_experimentalZ(lame_global_flags * gfp, int experimentalZ) |
1054 | 0 | { |
1055 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1056 | 0 | gfp->experimentalZ = experimentalZ; |
1057 | 0 | return 0; |
1058 | 0 | } |
1059 | 0 | return -1; |
1060 | 0 | } |
1061 | | |
1062 | | int |
1063 | | lame_get_experimentalZ(const lame_global_flags * gfp) |
1064 | 0 | { |
1065 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1066 | 0 | return gfp->experimentalZ; |
1067 | 0 | } |
1068 | 0 | return 0; |
1069 | 0 | } |
1070 | | |
1071 | | |
1072 | | /* Naoki's psycho acoustic model. */ |
1073 | | int |
1074 | | lame_set_exp_nspsytune(lame_global_flags * gfp, int exp_nspsytune) |
1075 | 9.30k | { |
1076 | 9.30k | if (is_lame_global_flags_valid(gfp)) { |
1077 | | /* default = 0 (disabled) */ |
1078 | 9.30k | gfp->exp_nspsytune = exp_nspsytune; |
1079 | 9.30k | return 0; |
1080 | 9.30k | } |
1081 | 0 | return -1; |
1082 | 9.30k | } |
1083 | | |
1084 | | int |
1085 | | lame_get_exp_nspsytune(const lame_global_flags * gfp) |
1086 | 9.30k | { |
1087 | 9.30k | if (is_lame_global_flags_valid(gfp)) { |
1088 | 9.30k | return gfp->exp_nspsytune; |
1089 | 9.30k | } |
1090 | 0 | return 0; |
1091 | 9.30k | } |
1092 | | |
1093 | | |
1094 | | |
1095 | | |
1096 | | /******************************************************************** |
1097 | | * VBR control |
1098 | | ***********************************************************************/ |
1099 | | |
1100 | | /* Types of VBR. default = vbr_off = CBR */ |
1101 | | int |
1102 | | lame_set_VBR(lame_global_flags * gfp, vbr_mode VBR) |
1103 | 9.72k | { |
1104 | 9.72k | if (is_lame_global_flags_valid(gfp)) { |
1105 | 9.72k | int vbr_q = VBR; |
1106 | 9.72k | if (0 > vbr_q || vbr_max_indicator <= vbr_q) |
1107 | 0 | return -1; /* Unknown VBR mode! */ |
1108 | 9.72k | gfp->VBR = VBR; |
1109 | 9.72k | return 0; |
1110 | 9.72k | } |
1111 | 0 | return -1; |
1112 | 9.72k | } |
1113 | | |
1114 | | vbr_mode |
1115 | | lame_get_VBR(const lame_global_flags * gfp) |
1116 | 6.69k | { |
1117 | 6.69k | if (is_lame_global_flags_valid(gfp)) { |
1118 | 6.69k | assert(gfp->VBR < vbr_max_indicator); |
1119 | 6.69k | return gfp->VBR; |
1120 | 6.69k | } |
1121 | 0 | return vbr_off; |
1122 | 6.69k | } |
1123 | | |
1124 | | |
1125 | | /* |
1126 | | * VBR quality level. |
1127 | | * 0 = highest |
1128 | | * 9 = lowest |
1129 | | */ |
1130 | | int |
1131 | | lame_set_VBR_q(lame_global_flags * gfp, int VBR_q) |
1132 | 3.50k | { |
1133 | 3.50k | if (is_lame_global_flags_valid(gfp)) { |
1134 | 3.50k | int ret = 0; |
1135 | | |
1136 | 3.50k | if (0 > VBR_q) { |
1137 | 0 | ret = -1; /* Unknown VBR quality level! */ |
1138 | 0 | VBR_q = 0; |
1139 | 0 | } |
1140 | 3.50k | if (9 < VBR_q) { |
1141 | 475 | ret = -1; |
1142 | 475 | VBR_q = 9; |
1143 | 475 | } |
1144 | 3.50k | gfp->VBR_q = VBR_q; |
1145 | 3.50k | gfp->VBR_q_frac = 0; |
1146 | 3.50k | return ret; |
1147 | 3.50k | } |
1148 | 0 | return -1; |
1149 | 3.50k | } |
1150 | | |
1151 | | int |
1152 | | lame_get_VBR_q(const lame_global_flags * gfp) |
1153 | 0 | { |
1154 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1155 | 0 | assert(0 <= gfp->VBR_q && 10 > gfp->VBR_q); |
1156 | 0 | return gfp->VBR_q; |
1157 | 0 | } |
1158 | 0 | return 0; |
1159 | 0 | } |
1160 | | |
1161 | | int |
1162 | | lame_set_VBR_quality(lame_global_flags * gfp, float VBR_q) |
1163 | 0 | { |
1164 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1165 | 0 | int ret = 0; |
1166 | |
|
1167 | 0 | if (0 > VBR_q) { |
1168 | 0 | ret = -1; /* Unknown VBR quality level! */ |
1169 | 0 | VBR_q = 0; |
1170 | 0 | } |
1171 | 0 | if (9.999 < VBR_q) { |
1172 | 0 | ret = -1; |
1173 | 0 | VBR_q = 9.999; |
1174 | 0 | } |
1175 | |
|
1176 | 0 | gfp->VBR_q = (int) VBR_q; |
1177 | 0 | gfp->VBR_q_frac = VBR_q - gfp->VBR_q; |
1178 | |
|
1179 | 0 | return ret; |
1180 | 0 | } |
1181 | 0 | return -1; |
1182 | 0 | } |
1183 | | |
1184 | | float |
1185 | | lame_get_VBR_quality(const lame_global_flags * gfp) |
1186 | 0 | { |
1187 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1188 | 0 | return gfp->VBR_q + gfp->VBR_q_frac; |
1189 | 0 | } |
1190 | 0 | return 0; |
1191 | 0 | } |
1192 | | |
1193 | | |
1194 | | /* Ignored except for VBR = vbr_abr (ABR mode) */ |
1195 | | int |
1196 | | lame_set_VBR_mean_bitrate_kbps(lame_global_flags * gfp, int VBR_mean_bitrate_kbps) |
1197 | 11.7k | { |
1198 | 11.7k | if (is_lame_global_flags_valid(gfp)) { |
1199 | 11.7k | gfp->VBR_mean_bitrate_kbps = VBR_mean_bitrate_kbps; |
1200 | 11.7k | return 0; |
1201 | 11.7k | } |
1202 | 0 | return -1; |
1203 | 11.7k | } |
1204 | | |
1205 | | int |
1206 | | lame_get_VBR_mean_bitrate_kbps(const lame_global_flags * gfp) |
1207 | 8.81k | { |
1208 | 8.81k | if (is_lame_global_flags_valid(gfp)) { |
1209 | 8.81k | return gfp->VBR_mean_bitrate_kbps; |
1210 | 8.81k | } |
1211 | 0 | return 0; |
1212 | 8.81k | } |
1213 | | |
1214 | | int |
1215 | | lame_set_VBR_min_bitrate_kbps(lame_global_flags * gfp, int VBR_min_bitrate_kbps) |
1216 | 709 | { |
1217 | 709 | if (is_lame_global_flags_valid(gfp)) { |
1218 | 709 | gfp->VBR_min_bitrate_kbps = VBR_min_bitrate_kbps; |
1219 | 709 | return 0; |
1220 | 709 | } |
1221 | 0 | return -1; |
1222 | 709 | } |
1223 | | |
1224 | | int |
1225 | | lame_get_VBR_min_bitrate_kbps(const lame_global_flags * gfp) |
1226 | 0 | { |
1227 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1228 | 0 | return gfp->VBR_min_bitrate_kbps; |
1229 | 0 | } |
1230 | 0 | return 0; |
1231 | 0 | } |
1232 | | |
1233 | | int |
1234 | | lame_set_VBR_max_bitrate_kbps(lame_global_flags * gfp, int VBR_max_bitrate_kbps) |
1235 | 831 | { |
1236 | 831 | if (is_lame_global_flags_valid(gfp)) { |
1237 | 831 | gfp->VBR_max_bitrate_kbps = VBR_max_bitrate_kbps; |
1238 | 831 | return 0; |
1239 | 831 | } |
1240 | 0 | return -1; |
1241 | 831 | } |
1242 | | |
1243 | | int |
1244 | | lame_get_VBR_max_bitrate_kbps(const lame_global_flags * gfp) |
1245 | 0 | { |
1246 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1247 | 0 | return gfp->VBR_max_bitrate_kbps; |
1248 | 0 | } |
1249 | 0 | return 0; |
1250 | 0 | } |
1251 | | |
1252 | | |
1253 | | /* |
1254 | | * Strictly enforce VBR_min_bitrate. |
1255 | | * Normally it will be violated for analog silence. |
1256 | | */ |
1257 | | int |
1258 | | lame_set_VBR_hard_min(lame_global_flags * gfp, int VBR_hard_min) |
1259 | 0 | { |
1260 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1261 | | /* default = 0 (disabled) */ |
1262 | | |
1263 | | /* enforce disable/enable meaning, if we need more than two values |
1264 | | we need to switch to an enum to have an apropriate representation |
1265 | | of the possible meanings of the value */ |
1266 | 0 | if (0 > VBR_hard_min || 1 < VBR_hard_min) |
1267 | 0 | return -1; |
1268 | | |
1269 | 0 | gfp->VBR_hard_min = VBR_hard_min; |
1270 | |
|
1271 | 0 | return 0; |
1272 | 0 | } |
1273 | 0 | return -1; |
1274 | 0 | } |
1275 | | |
1276 | | int |
1277 | | lame_get_VBR_hard_min(const lame_global_flags * gfp) |
1278 | 0 | { |
1279 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1280 | 0 | assert(0 <= gfp->VBR_hard_min && 1 >= gfp->VBR_hard_min); |
1281 | 0 | return gfp->VBR_hard_min; |
1282 | 0 | } |
1283 | 0 | return 0; |
1284 | 0 | } |
1285 | | |
1286 | | |
1287 | | /******************************************************************** |
1288 | | * Filtering control |
1289 | | ***********************************************************************/ |
1290 | | |
1291 | | /* |
1292 | | * Freqency in Hz to apply lowpass. |
1293 | | * 0 = default = lame chooses |
1294 | | * -1 = disabled |
1295 | | */ |
1296 | | int |
1297 | | lame_set_lowpassfreq(lame_global_flags * gfp, int lowpassfreq) |
1298 | 775 | { |
1299 | 775 | if (is_lame_global_flags_valid(gfp)) { |
1300 | 775 | gfp->lowpassfreq = lowpassfreq; |
1301 | 775 | return 0; |
1302 | 775 | } |
1303 | 0 | return -1; |
1304 | 775 | } |
1305 | | |
1306 | | int |
1307 | | lame_get_lowpassfreq(const lame_global_flags * gfp) |
1308 | 0 | { |
1309 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1310 | 0 | return gfp->lowpassfreq; |
1311 | 0 | } |
1312 | 0 | return 0; |
1313 | 0 | } |
1314 | | |
1315 | | |
1316 | | /* |
1317 | | * Width of transition band (in Hz). |
1318 | | * default = one polyphase filter band |
1319 | | */ |
1320 | | int |
1321 | | lame_set_lowpasswidth(lame_global_flags * gfp, int lowpasswidth) |
1322 | 495 | { |
1323 | 495 | if (is_lame_global_flags_valid(gfp)) { |
1324 | 495 | gfp->lowpasswidth = lowpasswidth; |
1325 | 495 | return 0; |
1326 | 495 | } |
1327 | 0 | return -1; |
1328 | 495 | } |
1329 | | |
1330 | | int |
1331 | | lame_get_lowpasswidth(const lame_global_flags * gfp) |
1332 | 0 | { |
1333 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1334 | 0 | return gfp->lowpasswidth; |
1335 | 0 | } |
1336 | 0 | return 0; |
1337 | 0 | } |
1338 | | |
1339 | | |
1340 | | /* |
1341 | | * Frequency in Hz to apply highpass. |
1342 | | * 0 = default = lame chooses |
1343 | | * -1 = disabled |
1344 | | */ |
1345 | | int |
1346 | | lame_set_highpassfreq(lame_global_flags * gfp, int highpassfreq) |
1347 | 612 | { |
1348 | 612 | if (is_lame_global_flags_valid(gfp)) { |
1349 | 612 | gfp->highpassfreq = highpassfreq; |
1350 | 612 | return 0; |
1351 | 612 | } |
1352 | 0 | return -1; |
1353 | 612 | } |
1354 | | |
1355 | | int |
1356 | | lame_get_highpassfreq(const lame_global_flags * gfp) |
1357 | 0 | { |
1358 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1359 | 0 | return gfp->highpassfreq; |
1360 | 0 | } |
1361 | 0 | return 0; |
1362 | 0 | } |
1363 | | |
1364 | | |
1365 | | /* |
1366 | | * Width of transition band (in Hz). |
1367 | | * default = one polyphase filter band |
1368 | | */ |
1369 | | int |
1370 | | lame_set_highpasswidth(lame_global_flags * gfp, int highpasswidth) |
1371 | 442 | { |
1372 | 442 | if (is_lame_global_flags_valid(gfp)) { |
1373 | 442 | gfp->highpasswidth = highpasswidth; |
1374 | 442 | return 0; |
1375 | 442 | } |
1376 | 0 | return -1; |
1377 | 442 | } |
1378 | | |
1379 | | int |
1380 | | lame_get_highpasswidth(const lame_global_flags * gfp) |
1381 | 0 | { |
1382 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1383 | 0 | return gfp->highpasswidth; |
1384 | 0 | } |
1385 | 0 | return 0; |
1386 | 0 | } |
1387 | | |
1388 | | |
1389 | | |
1390 | | |
1391 | | /* |
1392 | | * psycho acoustics and other arguments which you should not change |
1393 | | * unless you know what you are doing |
1394 | | */ |
1395 | | |
1396 | | |
1397 | | /* Adjust masking values. */ |
1398 | | int |
1399 | | lame_set_maskingadjust(lame_global_flags * gfp, float adjust) |
1400 | 5.16k | { |
1401 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1402 | 5.16k | gfp->maskingadjust = adjust; |
1403 | 5.16k | return 0; |
1404 | 5.16k | } |
1405 | 0 | return -1; |
1406 | 5.16k | } |
1407 | | |
1408 | | float |
1409 | | lame_get_maskingadjust(const lame_global_flags * gfp) |
1410 | 5.16k | { |
1411 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1412 | 5.16k | return gfp->maskingadjust; |
1413 | 5.16k | } |
1414 | 0 | return 0; |
1415 | 5.16k | } |
1416 | | |
1417 | | int |
1418 | | lame_set_maskingadjust_short(lame_global_flags * gfp, float adjust) |
1419 | 5.16k | { |
1420 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1421 | 5.16k | gfp->maskingadjust_short = adjust; |
1422 | 5.16k | return 0; |
1423 | 5.16k | } |
1424 | 0 | return -1; |
1425 | 5.16k | } |
1426 | | |
1427 | | float |
1428 | | lame_get_maskingadjust_short(const lame_global_flags * gfp) |
1429 | 5.16k | { |
1430 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1431 | 5.16k | return gfp->maskingadjust_short; |
1432 | 5.16k | } |
1433 | 0 | return 0; |
1434 | 5.16k | } |
1435 | | |
1436 | | /* Only use ATH for masking. */ |
1437 | | int |
1438 | | lame_set_ATHonly(lame_global_flags * gfp, int ATHonly) |
1439 | 0 | { |
1440 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1441 | 0 | gfp->ATHonly = ATHonly; |
1442 | 0 | return 0; |
1443 | 0 | } |
1444 | 0 | return -1; |
1445 | 0 | } |
1446 | | |
1447 | | int |
1448 | | lame_get_ATHonly(const lame_global_flags * gfp) |
1449 | 0 | { |
1450 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1451 | 0 | return gfp->ATHonly; |
1452 | 0 | } |
1453 | 0 | return 0; |
1454 | 0 | } |
1455 | | |
1456 | | |
1457 | | /* Only use ATH for short blocks. */ |
1458 | | int |
1459 | | lame_set_ATHshort(lame_global_flags * gfp, int ATHshort) |
1460 | 0 | { |
1461 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1462 | 0 | gfp->ATHshort = ATHshort; |
1463 | 0 | return 0; |
1464 | 0 | } |
1465 | 0 | return -1; |
1466 | 0 | } |
1467 | | |
1468 | | int |
1469 | | lame_get_ATHshort(const lame_global_flags * gfp) |
1470 | 0 | { |
1471 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1472 | 0 | return gfp->ATHshort; |
1473 | 0 | } |
1474 | 0 | return 0; |
1475 | 0 | } |
1476 | | |
1477 | | |
1478 | | /* Disable ATH. */ |
1479 | | int |
1480 | | lame_set_noATH(lame_global_flags * gfp, int noATH) |
1481 | 0 | { |
1482 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1483 | 0 | gfp->noATH = noATH; |
1484 | 0 | return 0; |
1485 | 0 | } |
1486 | 0 | return -1; |
1487 | 0 | } |
1488 | | |
1489 | | int |
1490 | | lame_get_noATH(const lame_global_flags * gfp) |
1491 | 0 | { |
1492 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1493 | 0 | return gfp->noATH; |
1494 | 0 | } |
1495 | 0 | return 0; |
1496 | 0 | } |
1497 | | |
1498 | | |
1499 | | /* Select ATH formula. */ |
1500 | | int |
1501 | | lame_set_ATHtype(lame_global_flags * gfp, int ATHtype) |
1502 | 1.42k | { |
1503 | 1.42k | if (is_lame_global_flags_valid(gfp)) { |
1504 | | /* XXX: ATHtype should be converted to an enum. */ |
1505 | 1.42k | gfp->ATHtype = ATHtype; |
1506 | 1.42k | return 0; |
1507 | 1.42k | } |
1508 | 0 | return -1; |
1509 | 1.42k | } |
1510 | | |
1511 | | int |
1512 | | lame_get_ATHtype(const lame_global_flags * gfp) |
1513 | 0 | { |
1514 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1515 | 0 | return gfp->ATHtype; |
1516 | 0 | } |
1517 | 0 | return 0; |
1518 | 0 | } |
1519 | | |
1520 | | |
1521 | | /* Select ATH formula 4 shape. */ |
1522 | | int |
1523 | | lame_set_ATHcurve(lame_global_flags * gfp, float ATHcurve) |
1524 | 5.16k | { |
1525 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1526 | 5.16k | gfp->ATHcurve = ATHcurve; |
1527 | 5.16k | return 0; |
1528 | 5.16k | } |
1529 | 0 | return -1; |
1530 | 5.16k | } |
1531 | | |
1532 | | float |
1533 | | lame_get_ATHcurve(const lame_global_flags * gfp) |
1534 | 5.16k | { |
1535 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1536 | 5.16k | return gfp->ATHcurve; |
1537 | 5.16k | } |
1538 | 0 | return 0; |
1539 | 5.16k | } |
1540 | | |
1541 | | |
1542 | | /* Lower ATH by this many db. */ |
1543 | | int |
1544 | | lame_set_ATHlower(lame_global_flags * gfp, float ATHlower) |
1545 | 5.16k | { |
1546 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1547 | 5.16k | gfp->ATH_lower_db = ATHlower; |
1548 | 5.16k | return 0; |
1549 | 5.16k | } |
1550 | 0 | return -1; |
1551 | 5.16k | } |
1552 | | |
1553 | | float |
1554 | | lame_get_ATHlower(const lame_global_flags * gfp) |
1555 | 5.16k | { |
1556 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1557 | 5.16k | return gfp->ATH_lower_db; |
1558 | 5.16k | } |
1559 | 0 | return 0; |
1560 | 5.16k | } |
1561 | | |
1562 | | |
1563 | | /* Select ATH adaptive adjustment scheme. */ |
1564 | | int |
1565 | | lame_set_athaa_type(lame_global_flags * gfp, int athaa_type) |
1566 | 0 | { |
1567 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1568 | 0 | gfp->athaa_type = athaa_type; |
1569 | 0 | return 0; |
1570 | 0 | } |
1571 | 0 | return -1; |
1572 | 0 | } |
1573 | | |
1574 | | int |
1575 | | lame_get_athaa_type(const lame_global_flags * gfp) |
1576 | 0 | { |
1577 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1578 | 0 | return gfp->athaa_type; |
1579 | 0 | } |
1580 | 0 | return 0; |
1581 | 0 | } |
1582 | | |
1583 | | |
1584 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
1585 | | int CDECL lame_set_athaa_loudapprox(lame_global_flags * gfp, int athaa_loudapprox); |
1586 | | int CDECL lame_get_athaa_loudapprox(const lame_global_flags * gfp); |
1587 | | #else |
1588 | | #endif |
1589 | | |
1590 | | /* Select the loudness approximation used by the ATH adaptive auto-leveling. */ |
1591 | | int |
1592 | | lame_set_athaa_loudapprox(lame_global_flags * gfp, int athaa_loudapprox) |
1593 | 0 | { |
1594 | 0 | (void) gfp; |
1595 | 0 | (void) athaa_loudapprox; |
1596 | 0 | return 0; |
1597 | 0 | } |
1598 | | |
1599 | | int |
1600 | | lame_get_athaa_loudapprox(const lame_global_flags * gfp) |
1601 | 0 | { |
1602 | 0 | (void) gfp; |
1603 | | /* obsolete, the type known under number 2 is the only survival */ |
1604 | 0 | return 2; |
1605 | 0 | } |
1606 | | |
1607 | | |
1608 | | /* Adjust (in dB) the point below which adaptive ATH level adjustment occurs. */ |
1609 | | int |
1610 | | lame_set_athaa_sensitivity(lame_global_flags * gfp, float athaa_sensitivity) |
1611 | 2.23k | { |
1612 | 2.23k | if (is_lame_global_flags_valid(gfp)) { |
1613 | 2.23k | gfp->athaa_sensitivity = athaa_sensitivity; |
1614 | 2.23k | return 0; |
1615 | 2.23k | } |
1616 | 0 | return -1; |
1617 | 2.23k | } |
1618 | | |
1619 | | float |
1620 | | lame_get_athaa_sensitivity(const lame_global_flags * gfp) |
1621 | 2.23k | { |
1622 | 2.23k | if (is_lame_global_flags_valid(gfp)) { |
1623 | 2.23k | return gfp->athaa_sensitivity; |
1624 | 2.23k | } |
1625 | 0 | return 0; |
1626 | 2.23k | } |
1627 | | |
1628 | | |
1629 | | /* Predictability limit (ISO tonality formula) */ |
1630 | | int lame_set_cwlimit(lame_global_flags * gfp, int cwlimit); |
1631 | | int lame_get_cwlimit(const lame_global_flags * gfp); |
1632 | | |
1633 | | int |
1634 | | lame_set_cwlimit(lame_global_flags * gfp, int cwlimit) |
1635 | 0 | { |
1636 | 0 | (void) gfp; |
1637 | 0 | (void) cwlimit; |
1638 | 0 | return 0; |
1639 | 0 | } |
1640 | | |
1641 | | int |
1642 | | lame_get_cwlimit(const lame_global_flags * gfp) |
1643 | 0 | { |
1644 | 0 | (void) gfp; |
1645 | 0 | return 0; |
1646 | 0 | } |
1647 | | |
1648 | | |
1649 | | |
1650 | | /* |
1651 | | * Allow blocktypes to differ between channels. |
1652 | | * default: |
1653 | | * 0 for jstereo => block types coupled |
1654 | | * 1 for stereo => block types may differ |
1655 | | */ |
1656 | | int |
1657 | | lame_set_allow_diff_short(lame_global_flags * gfp, int allow_diff_short) |
1658 | 0 | { |
1659 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1660 | 0 | gfp->short_blocks = allow_diff_short ? short_block_allowed : short_block_coupled; |
1661 | 0 | return 0; |
1662 | 0 | } |
1663 | 0 | return -1; |
1664 | 0 | } |
1665 | | |
1666 | | int |
1667 | | lame_get_allow_diff_short(const lame_global_flags * gfp) |
1668 | 0 | { |
1669 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1670 | 0 | if (gfp->short_blocks == short_block_allowed) |
1671 | 0 | return 1; /* short blocks allowed to differ */ |
1672 | 0 | else |
1673 | 0 | return 0; /* not set, dispensed, forced or coupled */ |
1674 | 0 | } |
1675 | 0 | return 0; |
1676 | 0 | } |
1677 | | |
1678 | | |
1679 | | /* Use temporal masking effect */ |
1680 | | int |
1681 | | lame_set_useTemporal(lame_global_flags * gfp, int useTemporal) |
1682 | 0 | { |
1683 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1684 | | /* default = 1 (enabled) */ |
1685 | | |
1686 | | /* enforce disable/enable meaning, if we need more than two values |
1687 | | we need to switch to an enum to have an apropriate representation |
1688 | | of the possible meanings of the value */ |
1689 | 0 | if (0 <= useTemporal && useTemporal <= 1) { |
1690 | 0 | gfp->useTemporal = useTemporal; |
1691 | 0 | return 0; |
1692 | 0 | } |
1693 | 0 | } |
1694 | 0 | return -1; |
1695 | 0 | } |
1696 | | |
1697 | | int |
1698 | | lame_get_useTemporal(const lame_global_flags * gfp) |
1699 | 0 | { |
1700 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1701 | 0 | assert(0 <= gfp->useTemporal && 1 >= gfp->useTemporal); |
1702 | 0 | return gfp->useTemporal; |
1703 | 0 | } |
1704 | 0 | return 0; |
1705 | 0 | } |
1706 | | |
1707 | | |
1708 | | /* Use inter-channel masking effect */ |
1709 | | int |
1710 | | lame_set_interChRatio(lame_global_flags * gfp, float ratio) |
1711 | 3.28k | { |
1712 | 3.28k | if (is_lame_global_flags_valid(gfp)) { |
1713 | | /* default = 0.0 (no inter-channel maskin) */ |
1714 | 3.28k | if (0 <= ratio && ratio <= 1.0) { |
1715 | 3.28k | gfp->interChRatio = ratio; |
1716 | 3.28k | return 0; |
1717 | 3.28k | } |
1718 | 3.28k | } |
1719 | 0 | return -1; |
1720 | 3.28k | } |
1721 | | |
1722 | | float |
1723 | | lame_get_interChRatio(const lame_global_flags * gfp) |
1724 | 3.28k | { |
1725 | 3.28k | if (is_lame_global_flags_valid(gfp)) { |
1726 | 3.28k | assert((0 <= gfp->interChRatio && gfp->interChRatio <= 1.0) || EQ(gfp->interChRatio, -1)); |
1727 | 3.28k | return gfp->interChRatio; |
1728 | 3.28k | } |
1729 | 0 | return 0; |
1730 | 3.28k | } |
1731 | | |
1732 | | |
1733 | | /* Use pseudo substep shaping method */ |
1734 | | int |
1735 | | lame_set_substep(lame_global_flags * gfp, int method) |
1736 | 0 | { |
1737 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1738 | | /* default = 0.0 (no substep noise shaping) */ |
1739 | 0 | if (0 <= method && method <= 7) { |
1740 | 0 | gfp->substep_shaping = method; |
1741 | 0 | return 0; |
1742 | 0 | } |
1743 | 0 | } |
1744 | 0 | return -1; |
1745 | 0 | } |
1746 | | |
1747 | | int |
1748 | | lame_get_substep(const lame_global_flags * gfp) |
1749 | 0 | { |
1750 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1751 | 0 | assert(0 <= gfp->substep_shaping && gfp->substep_shaping <= 7); |
1752 | 0 | return gfp->substep_shaping; |
1753 | 0 | } |
1754 | 0 | return 0; |
1755 | 0 | } |
1756 | | |
1757 | | /* scalefactors scale */ |
1758 | | int |
1759 | | lame_set_sfscale(lame_global_flags * gfp, int val) |
1760 | 2.34k | { |
1761 | 2.34k | if (is_lame_global_flags_valid(gfp)) { |
1762 | 2.34k | gfp->noise_shaping = (val != 0) ? 2 : 1; |
1763 | 2.34k | return 0; |
1764 | 2.34k | } |
1765 | 0 | return -1; |
1766 | 2.34k | } |
1767 | | |
1768 | | int |
1769 | | lame_get_sfscale(const lame_global_flags * gfp) |
1770 | 0 | { |
1771 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1772 | 0 | return (gfp->noise_shaping == 2) ? 1 : 0; |
1773 | 0 | } |
1774 | 0 | return 0; |
1775 | 0 | } |
1776 | | |
1777 | | /* subblock gain */ |
1778 | | int |
1779 | | lame_set_subblock_gain(lame_global_flags * gfp, int sbgain) |
1780 | 0 | { |
1781 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1782 | 0 | gfp->subblock_gain = sbgain; |
1783 | 0 | return 0; |
1784 | 0 | } |
1785 | 0 | return -1; |
1786 | 0 | } |
1787 | | |
1788 | | int |
1789 | | lame_get_subblock_gain(const lame_global_flags * gfp) |
1790 | 0 | { |
1791 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1792 | 0 | return gfp->subblock_gain; |
1793 | 0 | } |
1794 | 0 | return 0; |
1795 | 0 | } |
1796 | | |
1797 | | |
1798 | | /* Disable short blocks. */ |
1799 | | int |
1800 | | lame_set_no_short_blocks(lame_global_flags * gfp, int no_short_blocks) |
1801 | 0 | { |
1802 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1803 | | /* enforce disable/enable meaning, if we need more than two values |
1804 | | we need to switch to an enum to have an apropriate representation |
1805 | | of the possible meanings of the value */ |
1806 | 0 | if (0 <= no_short_blocks && no_short_blocks <= 1) { |
1807 | 0 | gfp->short_blocks = no_short_blocks ? short_block_dispensed : short_block_allowed; |
1808 | 0 | return 0; |
1809 | 0 | } |
1810 | 0 | } |
1811 | 0 | return -1; |
1812 | 0 | } |
1813 | | |
1814 | | int |
1815 | | lame_get_no_short_blocks(const lame_global_flags * gfp) |
1816 | 0 | { |
1817 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1818 | 0 | switch (gfp->short_blocks) { |
1819 | 0 | default: |
1820 | 0 | case short_block_not_set: |
1821 | 0 | return -1; |
1822 | 0 | case short_block_dispensed: |
1823 | 0 | return 1; |
1824 | 0 | case short_block_allowed: |
1825 | 0 | case short_block_coupled: |
1826 | 0 | case short_block_forced: |
1827 | 0 | return 0; |
1828 | 0 | } |
1829 | 0 | } |
1830 | 0 | return -1; |
1831 | 0 | } |
1832 | | |
1833 | | |
1834 | | /* Force short blocks. */ |
1835 | | int |
1836 | | lame_set_force_short_blocks(lame_global_flags * gfp, int short_blocks) |
1837 | 0 | { |
1838 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1839 | | /* enforce disable/enable meaning, if we need more than two values |
1840 | | we need to switch to an enum to have an apropriate representation |
1841 | | of the possible meanings of the value */ |
1842 | 0 | if (0 > short_blocks || 1 < short_blocks) |
1843 | 0 | return -1; |
1844 | | |
1845 | 0 | if (short_blocks == 1) |
1846 | 0 | gfp->short_blocks = short_block_forced; |
1847 | 0 | else if (gfp->short_blocks == short_block_forced) |
1848 | 0 | gfp->short_blocks = short_block_allowed; |
1849 | |
|
1850 | 0 | return 0; |
1851 | 0 | } |
1852 | 0 | return -1; |
1853 | 0 | } |
1854 | | |
1855 | | int |
1856 | | lame_get_force_short_blocks(const lame_global_flags * gfp) |
1857 | 0 | { |
1858 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1859 | 0 | switch (gfp->short_blocks) { |
1860 | 0 | default: |
1861 | 0 | case short_block_not_set: |
1862 | 0 | return -1; |
1863 | 0 | case short_block_dispensed: |
1864 | 0 | case short_block_allowed: |
1865 | 0 | case short_block_coupled: |
1866 | 0 | return 0; |
1867 | 0 | case short_block_forced: |
1868 | 0 | return 1; |
1869 | 0 | } |
1870 | 0 | } |
1871 | 0 | return -1; |
1872 | 0 | } |
1873 | | |
1874 | | int |
1875 | | lame_set_short_threshold_lrm(lame_global_flags * gfp, float lrm) |
1876 | 5.16k | { |
1877 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1878 | 5.16k | gfp->attackthre = lrm; |
1879 | 5.16k | return 0; |
1880 | 5.16k | } |
1881 | 0 | return -1; |
1882 | 5.16k | } |
1883 | | |
1884 | | float |
1885 | | lame_get_short_threshold_lrm(const lame_global_flags * gfp) |
1886 | 5.16k | { |
1887 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1888 | 5.16k | return gfp->attackthre; |
1889 | 5.16k | } |
1890 | 0 | return 0; |
1891 | 5.16k | } |
1892 | | |
1893 | | int |
1894 | | lame_set_short_threshold_s(lame_global_flags * gfp, float s) |
1895 | 5.16k | { |
1896 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1897 | 5.16k | gfp->attackthre_s = s; |
1898 | 5.16k | return 0; |
1899 | 5.16k | } |
1900 | 0 | return -1; |
1901 | 5.16k | } |
1902 | | |
1903 | | float |
1904 | | lame_get_short_threshold_s(const lame_global_flags * gfp) |
1905 | 5.16k | { |
1906 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
1907 | 5.16k | return gfp->attackthre_s; |
1908 | 5.16k | } |
1909 | 0 | return 0; |
1910 | 5.16k | } |
1911 | | |
1912 | | int |
1913 | | lame_set_short_threshold(lame_global_flags * gfp, float lrm, float s) |
1914 | 0 | { |
1915 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1916 | 0 | lame_set_short_threshold_lrm(gfp, lrm); |
1917 | 0 | lame_set_short_threshold_s(gfp, s); |
1918 | 0 | return 0; |
1919 | 0 | } |
1920 | 0 | return -1; |
1921 | 0 | } |
1922 | | |
1923 | | |
1924 | | /* |
1925 | | * Input PCM is emphased PCM |
1926 | | * (for instance from one of the rarely emphased CDs). |
1927 | | * |
1928 | | * It is STRONGLY not recommended to use this, because psycho does not |
1929 | | * take it into account, and last but not least many decoders |
1930 | | * ignore these bits |
1931 | | */ |
1932 | | int |
1933 | | lame_set_emphasis(lame_global_flags * gfp, int emphasis) |
1934 | 0 | { |
1935 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1936 | | /* XXX: emphasis should be converted to an enum */ |
1937 | 0 | if (0 <= emphasis && emphasis < 4) { |
1938 | 0 | gfp->emphasis = emphasis; |
1939 | 0 | return 0; |
1940 | 0 | } |
1941 | 0 | } |
1942 | 0 | return -1; |
1943 | 0 | } |
1944 | | |
1945 | | int |
1946 | | lame_get_emphasis(const lame_global_flags * gfp) |
1947 | 0 | { |
1948 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1949 | 0 | assert(0 <= gfp->emphasis && gfp->emphasis < 4); |
1950 | 0 | return gfp->emphasis; |
1951 | 0 | } |
1952 | 0 | return 0; |
1953 | 0 | } |
1954 | | |
1955 | | |
1956 | | |
1957 | | |
1958 | | /***************************************************************/ |
1959 | | /* internal variables, cannot be set... */ |
1960 | | /* provided because they may be of use to calling application */ |
1961 | | /***************************************************************/ |
1962 | | |
1963 | | /* MPEG version. |
1964 | | * 0 = MPEG-2 |
1965 | | * 1 = MPEG-1 |
1966 | | * (2 = MPEG-2.5) |
1967 | | */ |
1968 | | int |
1969 | | lame_get_version(const lame_global_flags * gfp) |
1970 | 0 | { |
1971 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1972 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
1973 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
1974 | 0 | return gfc->cfg.version; |
1975 | 0 | } |
1976 | 0 | } |
1977 | 0 | return 0; |
1978 | 0 | } |
1979 | | |
1980 | | |
1981 | | /* Encoder delay. */ |
1982 | | int |
1983 | | lame_get_encoder_delay(const lame_global_flags * gfp) |
1984 | 0 | { |
1985 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1986 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
1987 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
1988 | 0 | return gfc->ov_enc.encoder_delay; |
1989 | 0 | } |
1990 | 0 | } |
1991 | 0 | return 0; |
1992 | 0 | } |
1993 | | |
1994 | | /* padding added to the end of the input */ |
1995 | | int |
1996 | | lame_get_encoder_padding(const lame_global_flags * gfp) |
1997 | 0 | { |
1998 | 0 | if (is_lame_global_flags_valid(gfp)) { |
1999 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2000 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2001 | 0 | return gfc->ov_enc.encoder_padding; |
2002 | 0 | } |
2003 | 0 | } |
2004 | 0 | return 0; |
2005 | 0 | } |
2006 | | |
2007 | | |
2008 | | /* Size of MPEG frame. */ |
2009 | | int |
2010 | | lame_get_framesize(const lame_global_flags * gfp) |
2011 | 0 | { |
2012 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2013 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2014 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2015 | 0 | SessionConfig_t const *const cfg = &gfc->cfg; |
2016 | 0 | return 576 * cfg->mode_gr; |
2017 | 0 | } |
2018 | 0 | } |
2019 | 0 | return 0; |
2020 | 0 | } |
2021 | | |
2022 | | |
2023 | | /* Number of frames encoded so far. */ |
2024 | | int |
2025 | | lame_get_frameNum(const lame_global_flags * gfp) |
2026 | 0 | { |
2027 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2028 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2029 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2030 | 0 | return gfc->ov_enc.frame_number; |
2031 | 0 | } |
2032 | 0 | } |
2033 | 0 | return 0; |
2034 | 0 | } |
2035 | | |
2036 | | int |
2037 | | lame_get_mf_samples_to_encode(const lame_global_flags * gfp) |
2038 | 0 | { |
2039 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2040 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2041 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2042 | 0 | return gfc->sv_enc.mf_samples_to_encode; |
2043 | 0 | } |
2044 | 0 | } |
2045 | 0 | return 0; |
2046 | 0 | } |
2047 | | |
2048 | | int CDECL |
2049 | | lame_get_size_mp3buffer(const lame_global_flags * gfp) |
2050 | 0 | { |
2051 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2052 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2053 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2054 | 0 | int size; |
2055 | 0 | compute_flushbits(gfc, &size); |
2056 | 0 | return size; |
2057 | 0 | } |
2058 | 0 | } |
2059 | 0 | return 0; |
2060 | 0 | } |
2061 | | |
2062 | | int |
2063 | | lame_get_RadioGain(const lame_global_flags * gfp) |
2064 | 0 | { |
2065 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2066 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2067 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2068 | 0 | return gfc->ov_rpg.RadioGain; |
2069 | 0 | } |
2070 | 0 | } |
2071 | 0 | return 0; |
2072 | 0 | } |
2073 | | |
2074 | | int |
2075 | | lame_get_AudiophileGain(const lame_global_flags * gfp) |
2076 | 0 | { |
2077 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2078 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2079 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2080 | 0 | return 0; |
2081 | 0 | } |
2082 | 0 | } |
2083 | 0 | return 0; |
2084 | 0 | } |
2085 | | |
2086 | | float |
2087 | | lame_get_PeakSample(const lame_global_flags * gfp) |
2088 | 0 | { |
2089 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2090 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2091 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2092 | 0 | return (float) gfc->ov_rpg.PeakSample; |
2093 | 0 | } |
2094 | 0 | } |
2095 | 0 | return 0; |
2096 | 0 | } |
2097 | | |
2098 | | int |
2099 | | lame_get_noclipGainChange(const lame_global_flags * gfp) |
2100 | 0 | { |
2101 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2102 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2103 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2104 | 0 | return gfc->ov_rpg.noclipGainChange; |
2105 | 0 | } |
2106 | 0 | } |
2107 | 0 | return 0; |
2108 | 0 | } |
2109 | | |
2110 | | float |
2111 | | lame_get_noclipScale(const lame_global_flags * gfp) |
2112 | 0 | { |
2113 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2114 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2115 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2116 | 0 | return gfc->ov_rpg.noclipScale; |
2117 | 0 | } |
2118 | 0 | } |
2119 | 0 | return 0; |
2120 | 0 | } |
2121 | | |
2122 | | |
2123 | | /* |
2124 | | * LAME's estimate of the total number of frames to be encoded. |
2125 | | * Only valid if calling program set num_samples. |
2126 | | */ |
2127 | | int |
2128 | | lame_get_totalframes(const lame_global_flags * gfp) |
2129 | 0 | { |
2130 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2131 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2132 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2133 | 0 | SessionConfig_t const *const cfg = &gfc->cfg; |
2134 | 0 | unsigned long const pcm_samples_per_frame = 576ul * cfg->mode_gr; |
2135 | 0 | unsigned long pcm_samples_to_encode = gfp->num_samples; |
2136 | 0 | unsigned long end_padding = 0; |
2137 | 0 | int frames = 0; |
2138 | |
|
2139 | 0 | if (pcm_samples_to_encode == (0ul-1ul)) |
2140 | 0 | return 0; /* unknown */ |
2141 | | |
2142 | | /* estimate based on user set num_samples: */ |
2143 | 0 | if (cfg->samplerate_in != cfg->samplerate_out) { |
2144 | | /* resampling, estimate new samples_to_encode */ |
2145 | 0 | double resampled_samples_to_encode = 0.0, frames_f = 0.0; |
2146 | 0 | if (cfg->samplerate_in > 0) { |
2147 | 0 | resampled_samples_to_encode = pcm_samples_to_encode; |
2148 | 0 | resampled_samples_to_encode *= cfg->samplerate_out; |
2149 | 0 | resampled_samples_to_encode /= cfg->samplerate_in; |
2150 | 0 | } |
2151 | 0 | if (resampled_samples_to_encode <= 0.0) |
2152 | 0 | return 0; /* unlikely to happen, so what, no estimate! */ |
2153 | 0 | frames_f = floor(resampled_samples_to_encode / pcm_samples_per_frame); |
2154 | 0 | if (frames_f >= (INT_MAX-2)) |
2155 | 0 | return 0; /* overflow, happens eventually, no estimate! */ |
2156 | 0 | frames = frames_f; |
2157 | 0 | resampled_samples_to_encode -= frames * pcm_samples_per_frame; |
2158 | 0 | pcm_samples_to_encode = ceil(resampled_samples_to_encode); |
2159 | 0 | } |
2160 | 0 | else { |
2161 | 0 | frames = pcm_samples_to_encode / pcm_samples_per_frame; |
2162 | 0 | pcm_samples_to_encode -= frames * pcm_samples_per_frame; |
2163 | 0 | } |
2164 | 0 | pcm_samples_to_encode += 576ul; |
2165 | 0 | end_padding = pcm_samples_per_frame - (pcm_samples_to_encode % pcm_samples_per_frame); |
2166 | 0 | if (end_padding < 576ul) { |
2167 | 0 | end_padding += pcm_samples_per_frame; |
2168 | 0 | } |
2169 | 0 | pcm_samples_to_encode += end_padding; |
2170 | 0 | frames += (pcm_samples_to_encode / pcm_samples_per_frame); |
2171 | | /* check to see if we underestimated totalframes */ |
2172 | | /* if (totalframes < gfp->frameNum) */ |
2173 | | /* totalframes = gfp->frameNum; */ |
2174 | 0 | return frames; |
2175 | 0 | } |
2176 | 0 | } |
2177 | 0 | return 0; |
2178 | 0 | } |
2179 | | |
2180 | | |
2181 | | |
2182 | | |
2183 | | |
2184 | | int |
2185 | | lame_set_preset(lame_global_flags * gfp, int preset) |
2186 | 0 | { |
2187 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2188 | 0 | gfp->preset = preset; |
2189 | 0 | return apply_preset(gfp, preset, 1); |
2190 | 0 | } |
2191 | 0 | return -1; |
2192 | 0 | } |
2193 | | |
2194 | | |
2195 | | |
2196 | | int |
2197 | | lame_set_asm_optimizations(lame_global_flags * gfp, int optim, int mode) |
2198 | 0 | { |
2199 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2200 | 0 | mode = (mode == 1 ? 1 : 0); |
2201 | 0 | switch (optim) { |
2202 | 0 | case MMX:{ |
2203 | 0 | gfp->asm_optimizations.mmx = mode; |
2204 | 0 | return optim; |
2205 | 0 | } |
2206 | 0 | case AMD_3DNOW:{ |
2207 | 0 | gfp->asm_optimizations.amd3dnow = mode; |
2208 | 0 | return optim; |
2209 | 0 | } |
2210 | 0 | case SSE:{ |
2211 | 0 | gfp->asm_optimizations.sse = mode; |
2212 | 0 | return optim; |
2213 | 0 | } |
2214 | 0 | default: |
2215 | 0 | return optim; |
2216 | 0 | } |
2217 | 0 | } |
2218 | 0 | return -1; |
2219 | 0 | } |
2220 | | |
2221 | | |
2222 | | void |
2223 | | lame_set_write_id3tag_automatic(lame_global_flags * gfp, int v) |
2224 | 0 | { |
2225 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2226 | 0 | gfp->write_id3tag_automatic = v; |
2227 | 0 | } |
2228 | 0 | } |
2229 | | |
2230 | | |
2231 | | int |
2232 | | lame_get_write_id3tag_automatic(lame_global_flags const *gfp) |
2233 | 0 | { |
2234 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2235 | 0 | return gfp->write_id3tag_automatic; |
2236 | 0 | } |
2237 | 0 | return 1; |
2238 | 0 | } |
2239 | | |
2240 | | |
2241 | | /* |
2242 | | |
2243 | | UNDOCUMENTED, experimental settings. These routines are not prototyped |
2244 | | in lame.h. You should not use them, they are experimental and may |
2245 | | change. |
2246 | | |
2247 | | */ |
2248 | | |
2249 | | |
2250 | | /* |
2251 | | * just another daily changing developer switch |
2252 | | */ |
2253 | | void CDECL lame_set_tune(lame_global_flags *, float); |
2254 | | |
2255 | | void |
2256 | | lame_set_tune(lame_global_flags * gfp, float val) |
2257 | 0 | { |
2258 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2259 | 0 | gfp->tune_value_a = val; |
2260 | 0 | gfp->tune = 1; |
2261 | 0 | } |
2262 | 0 | } |
2263 | | |
2264 | | /* Custom msfix hack */ |
2265 | | void |
2266 | | lame_set_msfix(lame_global_flags * gfp, double msfix) |
2267 | 5.16k | { |
2268 | 5.16k | if (is_lame_global_flags_valid(gfp)) { |
2269 | | /* default = 0 */ |
2270 | 5.16k | gfp->msfix = msfix; |
2271 | 5.16k | } |
2272 | 5.16k | } |
2273 | | |
2274 | | float |
2275 | | lame_get_msfix(const lame_global_flags * gfp) |
2276 | 10.3k | { |
2277 | 10.3k | if (is_lame_global_flags_valid(gfp)) { |
2278 | 10.3k | return gfp->msfix; |
2279 | 10.3k | } |
2280 | 0 | return 0; |
2281 | 10.3k | } |
2282 | | |
2283 | | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED |
2284 | | int CDECL lame_set_preset_expopts(lame_global_flags *, int); |
2285 | | #else |
2286 | | #endif |
2287 | | |
2288 | | int |
2289 | | lame_set_preset_expopts(lame_global_flags * gfp, int preset_expopts) |
2290 | 0 | { |
2291 | 0 | (void) gfp; |
2292 | 0 | (void) preset_expopts; |
2293 | 0 | return 0; |
2294 | 0 | } |
2295 | | |
2296 | | |
2297 | | int |
2298 | | lame_set_preset_notune(lame_global_flags * gfp, int preset_notune) |
2299 | 0 | { |
2300 | 0 | (void) gfp; |
2301 | 0 | (void) preset_notune; |
2302 | 0 | return 0; |
2303 | 0 | } |
2304 | | |
2305 | | static int |
2306 | | calc_maximum_input_samples_for_buffer_size(lame_internal_flags const* gfc, size_t buffer_size) |
2307 | 0 | { |
2308 | 0 | SessionConfig_t const *const cfg = &gfc->cfg; |
2309 | 0 | int const pcm_samples_per_frame = 576 * cfg->mode_gr; |
2310 | 0 | int frames_per_buffer = 0, input_samples_per_buffer = 0; |
2311 | 0 | int kbps = 320; |
2312 | |
|
2313 | 0 | if (cfg->samplerate_out < 16000) |
2314 | 0 | kbps = 64; |
2315 | 0 | else if (cfg->samplerate_out < 32000) |
2316 | 0 | kbps = 160; |
2317 | 0 | else |
2318 | 0 | kbps = 320; |
2319 | 0 | if (cfg->free_format) |
2320 | 0 | kbps = cfg->avg_bitrate; |
2321 | 0 | else if (cfg->vbr == vbr_off) { |
2322 | 0 | kbps = cfg->avg_bitrate; |
2323 | 0 | } |
2324 | 0 | { |
2325 | 0 | int const pad = 1; |
2326 | 0 | int const bpf = ((cfg->version + 1) * 72000 * kbps / cfg->samplerate_out + pad); |
2327 | 0 | frames_per_buffer = buffer_size / bpf; |
2328 | 0 | } |
2329 | 0 | { |
2330 | 0 | double ratio = (double) cfg->samplerate_in / cfg->samplerate_out; |
2331 | 0 | input_samples_per_buffer = pcm_samples_per_frame * frames_per_buffer * ratio; |
2332 | 0 | } |
2333 | 0 | return input_samples_per_buffer; |
2334 | 0 | } |
2335 | | |
2336 | | int |
2337 | | lame_get_maximum_number_of_samples(lame_t gfp, size_t buffer_size) |
2338 | 0 | { |
2339 | 0 | if (is_lame_global_flags_valid(gfp)) { |
2340 | 0 | lame_internal_flags const *const gfc = gfp->internal_flags; |
2341 | 0 | if (is_lame_internal_flags_valid(gfc)) { |
2342 | 0 | return calc_maximum_input_samples_for_buffer_size(gfc, buffer_size); |
2343 | 0 | } |
2344 | 0 | } |
2345 | 0 | return LAME_GENERICERROR; |
2346 | 0 | } |