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 #ifndef TRUE
00028 #define TRUE    (1)
00029 #endif
00030 
00031 #ifndef FALSE
00032 #define FALSE   (0)
00033 #endif
00034 
00035 
00037 typedef enum {
00038         TWOLAME_STEREO = 0,             
00039         TWOLAME_JOINT_STEREO,   
00040         TWOLAME_DUAL_CHANNEL,   
00041         TWOLAME_MONO,                   
00042         TWOLAME_NOT_SET
00043 } TWOLAME_MPEG_mode;
00044 
00045 
00050 typedef enum {
00051         TWOLAME_MPEG2 = 0,      
00052         TWOLAME_MPEG1           
00053 } TWOLAME_MPEG_version;
00054 
00055 
00057 typedef enum {
00058         TWOLAME_PAD_NO = 0,             
00059         TWOLAME_PAD_ALL                 
00060 //      TWOLAME_PAD_ADJUST              // unsupported by twolame
00061 } TWOLAME_Padding;
00062 
00064 typedef enum {
00065         TWOLAME_EMPHASIS_N = 0, 
00066         TWOLAME_EMPHASIS_5 = 1, 
00067                                                         // reserved
00068         TWOLAME_EMPHASIS_C = 3, 
00069 } TWOLAME_Emphasis;
00070 
00071 
00073 struct twolame_options_struct;
00074 
00076 typedef struct twolame_options_struct twolame_options;
00077 
00078 
00079 
00080 
00081 
00087 const char* get_twolame_version( void );
00088 
00089 
00099 twolame_options *twolame_init(void);
00100 
00101 
00113 int twolame_init_params(twolame_options *glopts);
00114 
00115 
00129 int twolame_encode_buffer(
00130                 twolame_options *glopts,
00131                 const short int leftpcm[],
00132                 const short int rightpcm[],
00133                 int num_samples,
00134                 unsigned char *mp2buffer,
00135                 int mp2buffer_size );
00136 
00137 
00150 int twolame_encode_buffer_interleaved(
00151                 twolame_options *glopts,
00152                 const short int pcm[],
00153                 int num_samples,
00154                 unsigned char *mp2buffer,
00155                 int mp2buffer_size );
00156 
00157 
00169 int twolame_encode_flush(
00170                 twolame_options *glopts,
00171                 unsigned char *mp2buffer,
00172                 int mp2buffer_size);
00173 
00174 
00184 void twolame_close(twolame_options **glopts);
00185 
00186 
00187 
00201 int twolame_set_verbosity(twolame_options *glopts, int verbosity);
00202 
00203 
00209 int twolame_get_verbosity(twolame_options *glopts);
00210 
00211 
00223 int twolame_get_bitrate_index(TWOLAME_MPEG_version version, int bitrate);
00224 
00225 
00236 int twolame_get_samplerate_index(long sampleRate, TWOLAME_MPEG_version *version);
00237 
00238 
00249 int twolame_set_mode(twolame_options *glopts, TWOLAME_MPEG_mode mode);
00250 
00251 
00257 TWOLAME_MPEG_mode twolame_get_mode(twolame_options *glopts);
00258 
00259 
00265 const char *twolame_get_mode_name(twolame_options *glopts);
00266 
00267 
00277 int twolame_set_version(twolame_options *glopts, TWOLAME_MPEG_version version);
00278 
00279 
00285 TWOLAME_MPEG_version twolame_get_version(twolame_options *glopts);
00286 
00287 
00293 const char *twolame_get_version_name( twolame_options *glopts );
00294 
00295 
00305 int twolame_set_psymodel(twolame_options *glopts, int psymodel);
00306 
00307 
00313 int twolame_get_psymodel(twolame_options *glopts);
00314 
00315 
00329 int twolame_set_num_channels(twolame_options* glopts, int num_channels);
00330 
00331 
00337 int twolame_get_num_channels(twolame_options* glopts);
00338 
00339 
00351 int twolame_set_scale(twolame_options* glopts, float scale);
00352 
00353 
00359 float twolame_get_scale(twolame_options* glopts);
00360     
00372 int twolame_set_scale_left(twolame_options* glopts, float scale);
00373 
00374 
00380 float twolame_get_scale_left(twolame_options* glopts);
00381 
00382 
00394 int twolame_set_scale_right(twolame_options* glopts, float scale);
00395 
00396 
00402 float twolame_get_scale_right(twolame_options* glopts);
00403 
00404 
00414 int twolame_set_in_samplerate(twolame_options *glopts, int samplerate);
00415 
00416 
00422 int twolame_get_in_samplerate(twolame_options *glopts);
00423 
00424 
00434 int twolame_set_out_samplerate(twolame_options *glopts, int samplerate);
00435 
00436 
00442 int twolame_get_out_samplerate(twolame_options *glopts);
00443 
00444 
00454 int twolame_set_bitrate(twolame_options *glopts, int bitrate);
00455 
00456 
00462 int twolame_get_bitrate(twolame_options *glopts);
00463 
00464 
00469 int twolame_set_brate(twolame_options *glopts, int bitrate);
00470 
00471 
00476 int twolame_get_brate(twolame_options *glopts);
00477 
00478 
00490 int twolame_set_padding(twolame_options *glopts, TWOLAME_Padding padding);
00491 
00497 TWOLAME_Padding twolame_get_padding(twolame_options *glopts);
00498 
00499 
00509 int twolame_set_energy_levels(twolame_options *glopts, int energylevels );
00510 
00511 
00517 int twolame_get_energy_levels(twolame_options *glopts);
00518 
00519 
00529 int twolame_set_num_ancillary_bits(twolame_options *glopts, int num);
00530 
00531 
00537 int twolame_get_num_ancillary_bits(twolame_options *glopts);
00538 
00539 
00540 
00550 int twolame_set_emphasis(twolame_options *glopts, TWOLAME_Emphasis emphasis);
00551 
00552 
00558 TWOLAME_Emphasis twolame_get_emphasis(twolame_options *glopts);
00559 
00560 
00570 int twolame_set_error_protection(twolame_options *glopts, int err_protection);
00571 
00572 
00578 int twolame_get_error_protection(twolame_options *glopts);
00579 
00580 
00592 int twolame_set_copyright(twolame_options *glopts, int copyright);
00593 
00594 
00600 int twolame_get_copyright(twolame_options *glopts);
00601 
00602 
00612 int twolame_set_original(twolame_options *glopts, int original);
00613 
00614 
00620 int twolame_get_original(twolame_options *glopts);
00621 
00622 
00632 int twolame_set_VBR(twolame_options *glopts, int vbr);
00633 
00634 
00640 int twolame_get_VBR(twolame_options *glopts);
00641 
00642 
00655 int twolame_set_VBR_q(twolame_options *glopts, float level);
00656 
00657 
00663 float twolame_get_VBR_q(twolame_options *glopts);
00664 
00665 
00675 int twolame_set_ATH_level(twolame_options *glopts, float level);
00676 
00677 
00683 float twolame_get_ATH_level(twolame_options *glopts);
00684 
00685 
00695 int twolame_set_VBR_max_bitrate_kbps(twolame_options *glopts, int bitrate);
00696 
00702 int twolame_get_VBR_max_bitrate_kbps(twolame_options *glopts);
00703 
00704 
00714 int twolame_set_quick_mode(twolame_options *glopts, int quickmode);
00715 
00721 int twolame_get_quick_mode(twolame_options *glopts);
00722 
00723 
00733 int twolame_set_quick_count(twolame_options *glopts, int quickcount );
00734 
00740 int twolame_get_quick_count(twolame_options *glopts);
00741 
00742 
00752 int twolame_set_DAB(twolame_options *glopts, int dab);
00753 
00759 int twolame_get_DAB(twolame_options *glopts);
00760 
00761 
00771 int twolame_set_DAB_xpad_length(twolame_options *glopts, int length);
00772 
00773 
00779 int twolame_get_DAB_xpad_length(twolame_options *glopts);
00780 
00781 
00791 int twolame_set_DAB_crc_length(twolame_options *glopts, int length);
00792 
00793 
00799 int twolame_get_DAB_crc_length(twolame_options *glopts);
00800 
00801 
00802 #endif
00803 
00804 

Generated on Tue Apr 19 17:39:40 2005 for libtwolame by  doxygen 1.4.2