📄 lame.h
字号:
/* * Interface to MP3 LAME encoding engine * * Copyright (c) 1999 Mark Taylor * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. *//* $Id: lame.h,v 1.154 2004/04/11 15:39:53 glessard Exp $ */#ifndef LAME_LAME_H#define LAME_LAME_H#include <stdio.h>#include <stdarg.h>#if defined(__cplusplus)extern "C" {#endif#if defined(WIN32)#undef CDECL#define CDECL _cdecl#else#define CDECL#endiftypedef enum vbr_mode_e { vbr_off=0, vbr_mt, /* obsolete, same as vbr_mtrh */ vbr_rh, vbr_abr, vbr_mtrh, vbr_max_indicator, /* Don't use this! It's used for sanity checks. */ vbr_default=vbr_rh /* change this to change the default VBR mode of LAME */} vbr_mode;/* MPEG modes */typedef enum MPEG_mode_e { STEREO = 0, JOINT_STEREO, DUAL_CHANNEL, /* LAME doesn't supports this! */ MONO, NOT_SET, MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ } MPEG_mode;/* Padding types */typedef enum Padding_type_e { PAD_NO = 0, PAD_ALL, PAD_ADJUST, PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */} Padding_type;/*presets*/typedef enum preset_mode_e { /*values from 8 to 320 should be reserved for abr bitrates*/ /*for abr I'd suggest to directly use the targeted bitrate as a value*/ ABR_8 = 8, ABR_320 = 320, V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/ VBR_10 = 410, V8 = 420, VBR_20 = 420, V7 = 430, VBR_30 = 430, V6 = 440, VBR_40 = 440, V5 = 450, VBR_50 = 450, V4 = 460, VBR_60 = 460, V3 = 470, VBR_70 = 470, V2 = 480, VBR_80 = 480, V1 = 490, VBR_90 = 490, V0 = 500, VBR_100 = 500, /*still there for compatibility*/ R3MIX = 1000, STANDARD = 1001, EXTREME = 1002, INSANE = 1003, STANDARD_FAST = 1004, EXTREME_FAST = 1005, MEDIUM = 1006, MEDIUM_FAST = 1007} preset_mode;/*asm optimizations*/typedef enum asm_optimizations_e { MMX = 1, AMD_3DNOW = 2, SSE = 3} asm_optimizations;/* psychoacoustic model */typedef enum Psy_model_e { PSY_GPSYCHO = 1, PSY_NSPSYTUNE = 2} Psy_model;struct lame_global_struct;typedef struct lame_global_struct lame_global_flags;typedef lame_global_flags *lame_t;/*********************************************************************** * * The LAME API * These functions should be called, in this order, for each * MP3 file to be encoded. See the file "API" for more documentation * ***********************************************************************//* * REQUIRED: * initialize the encoder. sets default for all encoder parameters, * returns NULL if some malloc()'s failed * otherwise returns pointer to structure needed for all future * API calls. */lame_global_flags * CDECL lame_init(void);/* obsolete version */int CDECL lame_init_old(lame_global_flags *);/* * OPTIONAL: * set as needed to override defaults *//******************************************************************** * input stream description ***********************************************************************//* number of samples. default = 2^32-1 */int CDECL lame_set_num_samples(lame_global_flags *, unsigned long);unsigned long CDECL lame_get_num_samples(const lame_global_flags *);/* input sample rate in Hz. default = 44100hz */int CDECL lame_set_in_samplerate(lame_global_flags *, int);int CDECL lame_get_in_samplerate(const lame_global_flags *);/* number of channels in input stream. default=2 */int CDECL lame_set_num_channels(lame_global_flags *, int);int CDECL lame_get_num_channels(const lame_global_flags *);/* scale the input by this amount before encoding. default=0 (disabled) (not used by decoding routines)*/int CDECL lame_set_scale(lame_global_flags *, float);float CDECL lame_get_scale(const lame_global_flags *); /* scale the channel 0 (left) input by this amount before encoding. default=0 (disabled) (not used by decoding routines)*/int CDECL lame_set_scale_left(lame_global_flags *, float);float CDECL lame_get_scale_left(const lame_global_flags *);/* scale the channel 1 (right) input by this amount before encoding. default=0 (disabled) (not used by decoding routines)*/int CDECL lame_set_scale_right(lame_global_flags *, float);float CDECL lame_get_scale_right(const lame_global_flags *);/* output sample rate in Hz. default = 0, which means LAME picks best value based on the amount of compression. MPEG only allows: MPEG1 32, 44.1, 48khz MPEG2 16, 22.05, 24 MPEG2.5 8, 11.025, 12 (not used by decoding routines)*/int CDECL lame_set_out_samplerate(lame_global_flags *, int);int CDECL lame_get_out_samplerate(const lame_global_flags *);/******************************************************************** * general control parameters ***********************************************************************//* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */int CDECL lame_set_analysis(lame_global_flags *, int);int CDECL lame_get_analysis(const lame_global_flags *);/* 1 = write a Xing VBR header frame. default = 1 this variable must have been added by a Hungarian notation Windows programmer :-)*/int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int);int CDECL lame_get_bWriteVbrTag(const lame_global_flags *);/* 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 */int CDECL lame_set_decode_only(lame_global_flags *, int);int CDECL lame_get_decode_only(const lame_global_flags *);/* 1=encode a Vorbis .ogg file. default=0 *//* DEPRECATED */int CDECL lame_set_ogg(lame_global_flags *, int);int CDECL lame_get_ogg(const lame_global_flags *);/* internal algorithm selection. True quality is determined by the bitrate but this variable will effect quality by selecting expensive or cheap algorithms. quality=0..9. 0=best (very slow). 9=worst. recommended: 2 near-best quality, not too slow 5 good quality, fast 7 ok quality, really fast*/int CDECL lame_set_quality(lame_global_flags *, int);int CDECL lame_get_quality(const lame_global_flags *);/* mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono default: lame picks based on compression ration and input channels*/int CDECL lame_set_mode(lame_global_flags *, MPEG_mode);MPEG_mode CDECL lame_get_mode(const lame_global_flags *);/* mode_automs. Use a M/S mode with a switching threshold based on compression ratio DEPRECATED*/int CDECL lame_set_mode_automs(lame_global_flags *, int);int CDECL lame_get_mode_automs(const lame_global_flags *);/* force_ms. Force M/S for all frames. For testing only. default = 0 (disabled)*/int CDECL lame_set_force_ms(lame_global_flags *, int);int CDECL lame_get_force_ms(const lame_global_flags *);/* use free_format? default = 0 (disabled) */int CDECL lame_set_free_format(lame_global_flags *, int);int CDECL lame_get_free_format(const lame_global_flags *);/* perform ReplayGain analysis? default = 0 (disabled) */int CDECL lame_set_findReplayGain(lame_global_flags *, int);int CDECL lame_get_findReplayGain(const lame_global_flags *);/* decode on the fly. Search for the peak sample. If the ReplayGain * analysis is enabled then perform the analysis on the decoded data * stream. default = 0 (disabled) * NOTE: if this option is set the build-in decoder should not be used */int CDECL lame_set_decode_on_the_fly(lame_global_flags *, int);int CDECL lame_get_decode_on_the_fly(const lame_global_flags *);/* DEPRECATED: now does the same as lame_set_findReplayGain() default = 0 (disabled) */int CDECL lame_set_ReplayGain_input(lame_global_flags *, int);int CDECL lame_get_ReplayGain_input(const lame_global_flags *);/* DEPRECATED: now does the same as lame_set_decode_on_the_fly() && lame_set_findReplayGain() default = 0 (disabled) */int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int);int CDECL lame_get_ReplayGain_decode(const lame_global_flags *);/* DEPRECATED: now does the same as lame_set_decode_on_the_fly() default = 0 (disabled) */int CDECL lame_set_findPeakSample(lame_global_flags *, int);int CDECL lame_get_findPeakSample(const lame_global_flags *);/* counters for gapless encoding */int CDECL lame_set_nogap_total(lame_global_flags*, int);int CDECL lame_get_nogap_total(const lame_global_flags*);int CDECL lame_set_nogap_currentindex(lame_global_flags* , int);int CDECL lame_get_nogap_currentindex(const lame_global_flags*);/* * OPTIONAL: * Set printf like error/debug/message reporting functions. * The second argument has to be a pointer to a function which looks like * void my_debugf(const char *format, va_list ap) * { * (void) vfprintf(stdout, format, ap); * } * If you use NULL as the value of the pointer in the set function, the * lame buildin function will be used (prints to stderr). * To quiet any output you have to replace the body of the example function * with just "return;" and use it in the set function. */int CDECL lame_set_errorf(lame_global_flags *, void (*func)(const char *, va_list));int CDECL lame_set_debugf(lame_global_flags *, void (*func)(const char *, va_list));int CDECL lame_set_msgf (lame_global_flags *, void (*func)(const char *, va_list));/* set one of brate compression ratio. default is compression ratio of 11. */int CDECL lame_set_brate(lame_global_flags *, int);int CDECL lame_get_brate(const lame_global_flags *);int CDECL lame_set_compression_ratio(lame_global_flags *, float);float CDECL lame_get_compression_ratio(const lame_global_flags *);int CDECL lame_set_preset( lame_global_flags* gfp, int );int CDECL lame_set_asm_optimizations( lame_global_flags* gfp, int, int );/******************************************************************** * frame params ***********************************************************************//* mark as copyright. default=0 */int CDECL lame_set_copyright(lame_global_flags *, int);int CDECL lame_get_copyright(const lame_global_flags *);/* mark as original. default=1 */int CDECL lame_set_original(lame_global_flags *, int);int CDECL lame_get_original(const lame_global_flags *);/* error_protection. Use 2 bytes from each frame for CRC checksum. default=0 */int CDECL lame_set_error_protection(lame_global_flags *, int);int CDECL lame_get_error_protection(const lame_global_flags *);/* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */int CDECL lame_set_padding_type(lame_global_flags *, Padding_type);Padding_type CDECL lame_get_padding_type(const lame_global_flags *);/* MP3 'private extension' bit Meaningless. default=0 */int CDECL lame_set_extension(lame_global_flags *, int);int CDECL lame_get_extension(const lame_global_flags *);/* enforce strict ISO compliance. default=0 */int CDECL lame_set_strict_ISO(lame_global_flags *, int);int CDECL lame_get_strict_ISO(const lame_global_flags *); /******************************************************************** * quantization/noise shaping
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -