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 
00199 int twolame_encode_flush(
00200                 twolame_options *glopts,
00201                 unsigned char *mp2buffer,
00202                 int mp2buffer_size);
00203 
00204 
00214 void twolame_close(twolame_options **glopts);
00215 
00216 
00217 
00233 int twolame_set_verbosity(twolame_options *glopts, int verbosity);
00234 
00235 
00241 int twolame_get_verbosity(twolame_options *glopts);
00242 
00243 
00254 int twolame_set_mode(twolame_options *glopts, TWOLAME_MPEG_mode mode);
00255 
00256 
00262 TWOLAME_MPEG_mode twolame_get_mode(twolame_options *glopts);
00263 
00264 
00270 const char *twolame_get_mode_name(twolame_options *glopts);
00271 
00272 
00282 int twolame_set_version(twolame_options *glopts, TWOLAME_MPEG_version version);
00283 
00284 
00290 TWOLAME_MPEG_version twolame_get_version(twolame_options *glopts);
00291 
00292 
00298 const char *twolame_get_version_name( twolame_options *glopts );
00299 
00300 
00310 int twolame_set_psymodel(twolame_options *glopts, int psymodel);
00311 
00312 
00318 int twolame_get_psymodel(twolame_options *glopts);
00319 
00320 
00334 int twolame_set_num_channels(twolame_options* glopts, int num_channels);
00335 
00336 
00342 int twolame_get_num_channels(twolame_options* glopts);
00343 
00344 
00356 int twolame_set_scale(twolame_options* glopts, float scale);
00357 
00358 
00364 float twolame_get_scale(twolame_options* glopts);
00365     
00377 int twolame_set_scale_left(twolame_options* glopts, float scale);
00378 
00379 
00385 float twolame_get_scale_left(twolame_options* glopts);
00386 
00387 
00399 int twolame_set_scale_right(twolame_options* glopts, float scale);
00400 
00401 
00407 float twolame_get_scale_right(twolame_options* glopts);
00408 
00409 
00419 int twolame_set_in_samplerate(twolame_options *glopts, int samplerate);
00420 
00421 
00427 int twolame_get_in_samplerate(twolame_options *glopts);
00428 
00429 
00439 int twolame_set_out_samplerate(twolame_options *glopts, int samplerate);
00440 
00441 
00447 int twolame_get_out_samplerate(twolame_options *glopts);
00448 
00449 
00459 int twolame_set_bitrate(twolame_options *glopts, int bitrate);
00460 
00461 
00467 int twolame_get_bitrate(twolame_options *glopts);
00468 
00469 
00474 int twolame_set_brate(twolame_options *glopts, int bitrate);
00475 
00476 
00481 int twolame_get_brate(twolame_options *glopts);
00482 
00483 
00495 int twolame_set_padding(twolame_options *glopts, TWOLAME_Padding padding);
00496 
00502 TWOLAME_Padding twolame_get_padding(twolame_options *glopts);
00503 
00504 
00514 int twolame_set_energy_levels(twolame_options *glopts, int energylevels );
00515 
00516 
00522 int twolame_get_energy_levels(twolame_options *glopts);
00523 
00524 
00534 int twolame_set_num_ancillary_bits(twolame_options *glopts, int num);
00535 
00536 
00542 int twolame_get_num_ancillary_bits(twolame_options *glopts);
00543 
00544 
00545 
00555 int twolame_set_emphasis(twolame_options *glopts, TWOLAME_Emphasis emphasis);
00556 
00557 
00563 TWOLAME_Emphasis twolame_get_emphasis(twolame_options *glopts);
00564 
00565 
00575 int twolame_set_error_protection(twolame_options *glopts, int err_protection);
00576 
00577 
00583 int twolame_get_error_protection(twolame_options *glopts);
00584 
00585 
00597 int twolame_set_copyright(twolame_options *glopts, int copyright);
00598 
00599 
00605 int twolame_get_copyright(twolame_options *glopts);
00606 
00607 
00617 int twolame_set_original(twolame_options *glopts, int original);
00618 
00619 
00625 int twolame_get_original(twolame_options *glopts);
00626 
00627 
00637 int twolame_set_VBR(twolame_options *glopts, int vbr);
00638 
00639 
00645 int twolame_get_VBR(twolame_options *glopts);
00646 
00647 
00660 int twolame_set_VBR_level(twolame_options *glopts, float level);
00661 
00662 
00668 float twolame_get_VBR_level(twolame_options *glopts);
00669 
00670 
00671 
00672 /* 
00673    Using the twolame_set_VBR_q()/twolame_get_VBR_q functions 
00674    are deprecated, please use twolame_set_VBR_level() instead.
00675 */
00676 int twolame_set_VBR_q(twolame_options *glopts, float level);
00677 float twolame_get_VBR_q(twolame_options *glopts);
00678 
00679 
00680 
00690 int twolame_set_ATH_level(twolame_options *glopts, float level);
00691 
00692 
00698 float twolame_get_ATH_level(twolame_options *glopts);
00699 
00700 
00710 int twolame_set_VBR_max_bitrate_kbps(twolame_options *glopts, int bitrate);
00711 
00717 int twolame_get_VBR_max_bitrate_kbps(twolame_options *glopts);
00718 
00719 
00729 int twolame_set_quick_mode(twolame_options *glopts, int quickmode);
00730 
00736 int twolame_get_quick_mode(twolame_options *glopts);
00737 
00738 
00748 int twolame_set_quick_count(twolame_options *glopts, int quickcount );
00749 
00755 int twolame_get_quick_count(twolame_options *glopts);
00756 
00757 
00767 int twolame_set_DAB(twolame_options *glopts, int dab);
00768 
00774 int twolame_get_DAB(twolame_options *glopts);
00775 
00776 
00786 int twolame_set_DAB_xpad_length(twolame_options *glopts, int length);
00787 
00788 
00794 int twolame_get_DAB_xpad_length(twolame_options *glopts);
00795 
00796 
00806 int twolame_set_DAB_crc_length(twolame_options *glopts, int length);
00807 
00808 
00814 int twolame_get_DAB_crc_length(twolame_options *glopts);
00815 
00816 
00817 
00818 #ifdef __cplusplus
00819 }
00820 #endif
00821 
00822 #endif /* _TWOLAME_H_ */
00823 
00824 

Generated on Tue Nov 29 01:07:19 2005 for libtwolame by  doxygen 1.4.3