⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lame.h

📁 音频编码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Same as lame_encode_buffer_long(), but with correct scaling.  * !! NOTE: !! data must still be scaled to be in the same range as   * type 'long'.   Data should be in the range:  +/- 2^(8*size(long)-1) * */int CDECL lame_encode_buffer_long2(        lame_global_flags*  gfp,           /* global context handle         */        const long     buffer_l [],       /* PCM data for left channel     */        const long     buffer_r [],       /* PCM data for right channel    */        const int           nsamples,      /* number of samples per channel */        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */        const int           mp3buf_size ); /* number of valid octets in this                                              stream                        *//* as lame_encode_buffer, but for int's  * !! NOTE: !! input should be scaled to the maximum range of 'int' * If int is 4 bytes, then the values should range from * +/- 2147483648.   * * This routine does not (and cannot, without loosing precision) use * the same scaling as the rest of the lame_encode_buffer() routines. *  */   int CDECL lame_encode_buffer_int(        lame_global_flags*  gfp,           /* global context handle         */        const int      buffer_l [],       /* PCM data for left channel     */        const int      buffer_r [],       /* PCM data for right channel    */        const int           nsamples,      /* number of samples per channel */        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */        const int           mp3buf_size ); /* number of valid octets in this                                              stream                        *//* * REQUIRED: * lame_encode_flush will flush the intenal PCM buffers, padding with  * 0's to make sure the final frame is complete, and then flush * the internal MP3 buffers, and thus may return a  * final few mp3 frames.  'mp3buf' should be at least 7200 bytes long * to hold all possible emitted data. * * will also write id3v1 tags (if any) into the bitstream        * * return code = number of bytes output to mp3buf. Can be 0 */int CDECL lame_encode_flush(        lame_global_flags *  gfp,    /* global context handle                 */        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */        int                  size);  /* number of valid octets in this stream *//* * OPTIONAL: * lame_encode_flush_nogap will flush the internal mp3 buffers and pad * the last frame with ancillary data so it is a complete mp3 frame. *  * 'mp3buf' should be at least 7200 bytes long * to hold all possible emitted data. * * After a call to this routine, the outputed mp3 data is complete, but * you may continue to encode new PCM samples and write future mp3 data * to a different file.  The two mp3 files will play back with no gaps * if they are concatenated together. * * This routine will NOT write id3v1 tags into the bitstream. * * return code = number of bytes output to mp3buf. Can be 0 */int CDECL lame_encode_flush_nogap(        lame_global_flags *  gfp,    /* global context handle                 */        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */        int                  size);  /* number of valid octets in this stream *//* * OPTIONAL: * Normally, this is called by lame_init_params().  It writes id3v2 and * Xing headers into the front of the bitstream, and sets frame counters * and bitrate histogram data to 0.  You can also call this after  * lame_encode_flush_nogap().   */int CDECL lame_init_bitstream(        lame_global_flags *  gfp);    /* global context handle                 *//* * OPTIONAL:    some simple statistics * a bitrate histogram to visualize the distribution of used frame sizes * a stereo mode histogram to visualize the distribution of used stereo *   modes, useful in joint-stereo mode only *   0: LR    left-right encoded *   1: LR-I  left-right and intensity encoded (currently not supported) *   2: MS    mid-side encoded *   3: MS-I  mid-side and intensity encoded (currently not supported) * * attention: don't call them after lame_encode_finish * suggested: lame_encode_flush -> lame_*_hist -> lame_close */void CDECL lame_bitrate_hist(         const lame_global_flags *const gfp,               int                      bitrate_count[14] );void CDECL lame_bitrate_kbps(         const lame_global_flags *const gfp,               int                      bitrate_kbps [14] );void CDECL lame_stereo_mode_hist(         const lame_global_flags *const gfp,               int                      stereo_mode_count[4] );void CDECL lame_bitrate_stereo_mode_hist (         const lame_global_flags * const gfp,         int  bitrate_stmode_count [14] [4] );void CDECL lame_block_type_hist (        const lame_global_flags * const gfp,         int btype_count[6] );void CDECL lame_bitrate_block_type_hist (         const lame_global_flags * const gfp,         int bitrate_btype_count[14][6] );/* * OPTIONAL: * lame_mp3_tags_fid will append a Xing VBR tag to the mp3 file with file * pointer fid.  These calls perform forward and backwards seeks, so make * sure fid is a real file.  Make sure lame_encode_flush has been called, * and all mp3 data has been written to the file before calling this * function. * NOTE: * if VBR  tags are turned off by the user, or turned off by LAME because * the output is not a regular file, this call does nothing*/void CDECL lame_mp3_tags_fid(lame_global_flags *,FILE* fid);/* * REQUIRED: * final call to free all remaining buffers */int  CDECL lame_close (lame_global_flags *);/* * OBSOLETE: * lame_encode_finish combines lame_encode_flush() and lame_close() in * one call.  However, once this call is made, the statistics routines * will no longer work because the data will have been cleared, and * lame_mp3_tags_fid() cannot be called to add data to the VBR header   */int CDECL lame_encode_finish(        lame_global_flags*  gfp,        unsigned char*      mp3buf,        int                 size );/********************************************************************* * * decoding  * * a simple interface to mpglib, part of mpg123, is also included if * libmp3lame is compiled with HAVE_MPGLIB * *********************************************************************/typedef struct {  int header_parsed;   /* 1 if header was parsed and following data was                          computed                                       */  int stereo;          /* number of channels                             */  int samplerate;      /* sample rate                                    */  int bitrate;         /* bitrate                                        */  int mode;            /* mp3 frame type                                 */  int mode_ext;        /* mp3 frame type                                 */  int framesize;       /* number of samples per mp3 frame                */  /* this data is only computed if mpglib detects a Xing VBR header */  unsigned long nsamp; /* number of samples in mp3 file.                 */  int totalframes;     /* total number of frames in mp3 file             */  /* this data is not currently computed by the mpglib routines */  int framenum;        /* frames decoded counter                         */} mp3data_struct;/* required call to initialize decoder  * NOTE: the decoder should not be used when encoding is performed * with decoding on the fly */int CDECL lame_decode_init(void);/********************************************************************* * input 1 mp3 frame, output (maybe) pcm data.   * *  nout = lame_decode(mp3buf,len,pcm_l,pcm_r); * * input:   *    len          :  number of bytes of mp3 data in mp3buf *    mp3buf[len]  :  mp3 data to be decoded * * output: *    nout:  -1    : decoding error *            0    : need more data before we can complete the decode  *           >0    : returned 'nout' samples worth of data in pcm_l,pcm_r *    pcm_l[nout]  : left channel data *    pcm_r[nout]  : right channel data  *     *********************************************************************/int CDECL lame_decode(        unsigned char *  mp3buf,        int              len,        short            pcm_l[],        short            pcm_r[] );/* same as lame_decode, and also returns mp3 header data */int CDECL lame_decode_headers(        unsigned char*   mp3buf,        int              len,        short            pcm_l[],        short            pcm_r[],        mp3data_struct*  mp3data );/* same as lame_decode, but returns at most one frame */int CDECL lame_decode1(        unsigned char*  mp3buf,        int             len,        short           pcm_l[],        short           pcm_r[] );/* same as lame_decode1, but returns at most one frame and mp3 header data */int CDECL lame_decode1_headers(        unsigned char*   mp3buf,        int              len,        short            pcm_l[],        short            pcm_r[],        mp3data_struct*  mp3data );/* same as lame_decode1_headers, but also returns enc_delay and enc_padding   from VBR Info tag, (-1 if no info tag was found) */int CDECL lame_decode1_headersB(        unsigned char*   mp3buf,        int              len,        short            pcm_l[],        short            pcm_r[],        mp3data_struct*  mp3data,        int              *enc_delay,        int              *enc_padding );/* cleanup call to exit decoder  */int CDECL lame_decode_exit(void);/********************************************************************* * * id3tag stuff * *********************************************************************//* * id3tag.h -- Interface to write ID3 version 1 and 2 tags. * * Copyright (C) 2000 Don Melton. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. *//* utility to obtain alphabetically sorted list of genre names with numbers */extern void id3tag_genre_list(        void (*handler)(int, const char *, void *),        void*  cookie);extern void id3tag_init   (lame_global_flags *gfp);/* force addition of version 2 tag */extern void id3tag_add_v2   (lame_global_flags *gfp);/* add only a version 1 tag */extern void id3tag_v1_only  (lame_global_flags *gfp);/* add only a version 2 tag */extern void id3tag_v2_only  (lame_global_flags *gfp);/* pad version 1 tag with spaces instead of nulls */extern void id3tag_space_v1 (lame_global_flags *gfp);/* pad version 2 tag with extra 128 bytes */extern void id3tag_pad_v2   (lame_global_flags *gfp);extern void id3tag_set_title(        lame_global_flags*  gfp,        const char*         title );extern void id3tag_set_artist(        lame_global_flags*  gfp,        const char*         artist );extern void id3tag_set_album(        lame_global_flags*  gfp,        const char*         album );extern void id3tag_set_year(        lame_global_flags*  gfp,        const char*         year );extern void id3tag_set_comment(        lame_global_flags*  gfp,        const char*         comment );extern void id3tag_set_track(        lame_global_flags*  gfp,        const char*         track );/* return non-zero result if genre name or number is invalid */extern int id3tag_set_genre(        lame_global_flags*  gfp,        const char*         genre );/*************************************************************************  list of valid bitrates [kbps] & sample frequencies [Hz].*  first index: 0: MPEG-2   values  (sample frequencies 16...24 kHz) *               1: MPEG-1   values  (sample frequencies 32...48 kHz)*               2: MPEG-2.5 values  (sample frequencies  8...12 kHz)***********************************************************************/extern const int      bitrate_table    [3] [16];extern const int      samplerate_table [3] [ 4];/* maximum size of mp3buffer needed if you encode at most 1152 samples for   each call to lame_encode_buffer.  see lame_encode_buffer() below     (LAME_MAXMP3BUFFER is now obsolete)  */#define LAME_MAXMP3BUFFER   16384typedef enum {    LAME_OKAY             =   0,    LAME_NOERROR          =   0,    LAME_GENERICERROR     =  -1,    LAME_NOMEM            = -10,    LAME_BADBITRATE       = -11,    LAME_BADSAMPFREQ      = -12,    LAME_INTERNALERROR    = -13,        FRONTEND_READERROR    = -80,    FRONTEND_WRITEERROR   = -81,    FRONTEND_FILETOOLARGE = -82    } lame_errorcodes_t;#if defined(__cplusplus)}#endif#endif /* LAME_LAME_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -