/Users/njh/Projects/twolame/libtwolame/twolame.h

Go to the documentation of this file.
00001 /*
00002  *  TwoLAME: an optimized MPEG Audio Layer Two encoder
00003  *
00004  *  Copyright (C) 2001-2004 Michael Cheng
00005  *  Copyright (C) 2004-2005 The TwoLAME Project
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Lesser General Public
00009  *  License as published by the Free Software Foundation; either
00010  *  version 2.1 of the License, or (at your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  Lesser General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Lesser General Public
00018  *  License along with this library; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *  
00021  */
00022  
00023 
00024 #ifndef __TWOLAME_H__
00025 #define __TWOLAME_H__
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 
00032 #ifndef TRUE
00033 #define TRUE    (1)
00034 #endif
00035 
00036 #ifndef FALSE
00037 #define FALSE   (0)
00038 #endif
00039 
00040 
00042 typedef enum {
00043         TWOLAME_AUTO_MODE = -1, 
00044         TWOLAME_STEREO = 0,             
00045         TWOLAME_JOINT_STEREO,   
00046         TWOLAME_DUAL_CHANNEL,   
00047         TWOLAME_MONO,                   
00048         TWOLAME_NOT_SET
00049 } TWOLAME_MPEG_mode;
00050 
00051 
00056 typedef enum {
00057         TWOLAME_MPEG2 = 0,      
00058         TWOLAME_MPEG1           
00059 } TWOLAME_MPEG_version;
00060 
00061 
00063 typedef enum {
00064         TWOLAME_PAD_NO = 0,             
00065         TWOLAME_PAD_ALL                 
00066 //      TWOLAME_PAD_ADJUST              // unsupported by twolame
00067 } TWOLAME_Padding;
00068 
00070 typedef enum {
00071         TWOLAME_EMPHASIS_N = 0, 
00072         TWOLAME_EMPHASIS_5 = 1, 
00073                                                         // reserved
00074         TWOLAME_EMPHASIS_C = 3  
00075 } TWOLAME_Emphasis;
00076 
00077 
00079 struct twolame_options_struct;
00080 
00082 typedef struct twolame_options_struct twolame_options;
00083 
00084 
00085 
00086 
00087 
00093 const char* get_twolame_version( void );
00094 
00095 
00101 const char* get_twolame_url( void );
00102 
00103 
00114 void twolame_print_config(twolame_options *glopts);
00115 
00116 
00126 twolame_options *twolame_init(void);
00127 
00128 
00140 int twolame_init_params(twolame_options *glopts);
00141 
00142 
00157 int twolame_encode_buffer(
00158                 twolame_options *glopts,
00159                 const short int leftpcm[],
00160                 const short int rightpcm[],
00161                 int num_samples,
00162                 unsigned char *mp2buffer,
00163                 int mp2buffer_size );
00164 
00165 
00179 int twolame_encode_buffer_interleaved(
00180                 twolame_options *glopts,
00181                 const short int pcm[],
00182                 int num_samples,
00183                 unsigned char *mp2buffer,
00184                 int mp2buffer_size );
00185 
00186 
00204 int twolame_encode_buffer_float32(
00205                 twolame_options *glopts,
00206                 const float leftpcm[],
00207                 const float rightpcm[],
00208                 int num_samples,
00209                 unsigned char *mp2buffer,
00210                 int mp2buffer_size );
00211 
00212 
00225 int twolame_encode_flush(
00226                 twolame_options *glopts,
00227                 unsigned char *mp2buffer,
00228                 int mp2buffer_size);
00229 
00230 
00240 void twolame_close(twolame_options **glopts);
00241 
00242 
00243 
00259 int twolame_set_verbosity(twolame_options *glopts, int verbosity);
00260 
00261 
00267 int twolame_get_verbosity(twolame_options *glopts);
00268 
00269 
00280 int twolame_set_mode(twolame_options *glopts, TWOLAME_MPEG_mode mode);
00281 
00282 
00288 TWOLAME_MPEG_mode twolame_get_mode(twolame_options *glopts);
00289 
00290 
00296 const char *twolame_get_mode_name(twolame_options *glopts);
00297 
00298 
00308 int twolame_set_version(twolame_options *glopts, TWOLAME_MPEG_version version);
00309 
00310 
00316 TWOLAME_MPEG_version twolame_get_version(twolame_options *glopts);
00317 
00318 
00324 const char *twolame_get_version_name( twolame_options *glopts );
00325 
00326 
00336 int twolame_set_psymodel(twolame_options *glopts, int psymodel);
00337 
00338 
00344 int twolame_get_psymodel(twolame_options *glopts);
00345 
00346 
00360 int twolame_set_num_channels(twolame_options* glopts, int num_channels);
00361 
00362 
00368 int twolame_get_num_channels(twolame_options* glopts);
00369 
00370 
00382 int twolame_set_scale(twolame_options* glopts, float scale);
00383 
00384 
00390 float twolame_get_scale(twolame_options* glopts);
00391     
00403 int twolame_set_scale_left(twolame_options* glopts, float scale);
00404 
00405 
00411 float twolame_get_scale_left(twolame_options* glopts);
00412 
00413 
00425 int twolame_set_scale_right(twolame_options* glopts, float scale);
00426 
00427 
00433 float twolame_get_scale_right(twolame_options* glopts);
00434 
00435 
00445 int twolame_set_in_samplerate(twolame_options *glopts, int samplerate);
00446 
00447 
00453 int twolame_get_in_samplerate(twolame_options *glopts);
00454 
00455 
00465 int twolame_set_out_samplerate(twolame_options *glopts, int samplerate);
00466 
00467 
00473 int twolame_get_out_samplerate(twolame_options *glopts);
00474 
00475 
00485 int twolame_set_bitrate(twolame_options *glopts, int bitrate);
00486 
00487 
00493 int twolame_get_bitrate(twolame_options *glopts);
00494 
00495 
00500 int twolame_set_brate(twolame_options *glopts, int bitrate);
00501 
00502 
00507 int twolame_get_brate(twolame_options *glopts);
00508 
00509 
00521 int twolame_set_padding(twolame_options *glopts, TWOLAME_Padding padding);
00522 
00528 TWOLAME_Padding twolame_get_padding(twolame_options *glopts);
00529 
00530 
00540 int twolame_set_energy_levels(twolame_options *glopts, int energylevels );
00541 
00542 
00548 int twolame_get_energy_levels(twolame_options *glopts);
00549 
00550 
00560 int twolame_set_num_ancillary_bits(twolame_options *glopts, int num);
00561 
00562 
00568 int twolame_get_num_ancillary_bits(twolame_options *glopts);
00569 
00570 
00571 
00581 int twolame_set_emphasis(twolame_options *glopts, TWOLAME_Emphasis emphasis);
00582 
00583 
00589 TWOLAME_Emphasis twolame_get_emphasis(twolame_options *glopts);
00590 
00591 
00601 int twolame_set_error_protection(twolame_options *glopts, int err_protection);
00602 
00603 
00609 int twolame_get_error_protection(twolame_options *glopts);
00610 
00611 
00623 int twolame_set_copyright(twolame_options *glopts, int copyright);
00624 
00625 
00631 int twolame_get_copyright(twolame_options *glopts);
00632 
00633 
00643 int twolame_set_original(twolame_options *glopts, int original);
00644 
00645 
00651 int twolame_get_original(twolame_options *glopts);
00652 
00653 
00663 int twolame_set_VBR(twolame_options *glopts, int vbr);
00664 
00665 
00671 int twolame_get_VBR(twolame_options *glopts);
00672 
00673 
00686 int twolame_set_VBR_level(twolame_options *glopts, float level);
00687 
00688 
00694 float twolame_get_VBR_level(twolame_options *glopts);
00695 
00696 
00697 
00698 /* 
00699    Using the twolame_set_VBR_q()/twolame_get_VBR_q functions 
00700    are deprecated, please use twolame_set_VBR_level() instead.
00701 */
00702 int twolame_set_VBR_q(twolame_options *glopts, float level);
00703 float twolame_get_VBR_q(twolame_options *glopts);
00704 
00705 
00706 
00716 int twolame_set_ATH_level(twolame_options *glopts, float level);
00717 
00718 
00724 float twolame_get_ATH_level(twolame_options *glopts);
00725 
00726 
00736 int twolame_set_VBR_max_bitrate_kbps(twolame_options *glopts, int bitrate);
00737 
00743 int twolame_get_VBR_max_bitrate_kbps(twolame_options *glopts);
00744 
00745 
00755 int twolame_set_quick_mode(twolame_options *glopts, int quickmode);
00756 
00762 int twolame_get_quick_mode(twolame_options *glopts);
00763 
00764 
00774 int twolame_set_quick_count(twolame_options *glopts, int quickcount );
00775 
00781 int twolame_get_quick_count(twolame_options *glopts);
00782 
00783 
00793 int twolame_set_DAB(twolame_options *glopts, int dab);
00794 
00800 int twolame_get_DAB(twolame_options *glopts);
00801 
00802 
00812 int twolame_set_DAB_xpad_length(twolame_options *glopts, int length);
00813 
00814 
00820 int twolame_get_DAB_xpad_length(twolame_options *glopts);
00821 
00822 
00832 int twolame_set_DAB_crc_length(twolame_options *glopts, int length);
00833 
00834 
00840 int twolame_get_DAB_crc_length(twolame_options *glopts);
00841 
00842 
00843 
00844 #ifdef __cplusplus
00845 }
00846 #endif
00847 
00848 #endif /* _TWOLAME_H_ */
00849 
00850 

Generated on Mon May 8 16:10:09 2006 for libtwolame by  doxygen 1.4.6