libtwolame: /home/humfrn01/Projects/twolame/trunk/libtwolame/twolame.h Source File

# /home/humfrn01/Projects/twolame/trunk/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-2006 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  *  $Id: twolame.h 164 2008-01-08 01:43:36Z nhumfrey $
    00022  *
    00023  */
    00024
    00025 #ifndef __TWOLAME_H__
    00026 #define __TWOLAME_H__
    00027
    00028 #ifdef __cplusplus
    00029 extern "C" {
    00030 #endif
    00031
    00034 /*
    00035  * ATTENTION WIN32 USERS!
    00036  *
    00037  * By default, when you use this header file, it is configured to use
    00038  * symbols from the "twolame.dll" file. If you use the static version of
    00039  * the library, define LIBTWOLAME_STATIC prior to including this header.
    00040  */
    00041
    00042 #ifdef _WIN32
    00043 #ifdef LIBTWOLAME_STATIC
    00044 #define DLL_EXPORT
    00045 #else
    00046 #ifdef LIBTWOLAME_DLL_EXPORTS
    00047 #define DLL_EXPORT __declspec(dllexport)
    00048 #else
    00049 #define DLL_EXPORT __declspec(dllimport)
    00050 #endif
    00051 #endif
    00052 #else
    00053 #define DLL_EXPORT
    00054 #endif
    00055
    00056
    00057 #ifndef TRUE
    00058 #define TRUE    (1)
    00059 #endif
    00060
    00061 #ifndef FALSE
    00062 #define FALSE   (0)
    00063 #endif
    00064
    00065
    00067 typedef enum {
    00068         TWOLAME_AUTO_MODE = -1,
    00069         TWOLAME_STEREO = 0,
    00070         TWOLAME_JOINT_STEREO,
    00071         TWOLAME_DUAL_CHANNEL,
    00072         TWOLAME_MONO,
    00073         TWOLAME_NOT_SET
    00074 } TWOLAME_MPEG_mode;
    00075
    00076
    00081 typedef enum {
    00082         TWOLAME_MPEG2 = 0,
    00083         TWOLAME_MPEG1
    00084 } TWOLAME_MPEG_version;
    00085
    00086
    00088 typedef enum {
    00089         TWOLAME_PAD_NO = 0,
    00090         TWOLAME_PAD_ALL
    00091 //      TWOLAME_PAD_ADJUST              // unsupported by twolame
    00092 } TWOLAME_Padding;
    00093
    00095 typedef enum {
    00096         TWOLAME_EMPHASIS_N = 0,
    00097         TWOLAME_EMPHASIS_5 = 1,
    00098                                                         // reserved
    00099         TWOLAME_EMPHASIS_C = 3
    00100 } TWOLAME_Emphasis;
    00101
    00102
    00104 #define TWOLAME_SAMPLES_PER_FRAME               (1152)
    00105
    00106
    00108 struct twolame_options_struct;
    00109
    00111 typedef struct twolame_options_struct twolame_options;
    00112
    00113
    00114
    00115
    00116
    00122 DLL_EXPORT const char* get_twolame_version( void );
    00123
    00124
    00130 DLL_EXPORT const char* get_twolame_url( void );
    00131
    00132
    00143 DLL_EXPORT void twolame_print_config(twolame_options *glopts);
    00144
    00145
    00155 DLL_EXPORT twolame_options *twolame_init(void);
    00156
    00157
    00169 DLL_EXPORT int twolame_init_params(twolame_options *glopts);
    00170
    00171
    00186 DLL_EXPORT int twolame_encode_buffer(
    00187                 twolame_options *glopts,
    00188                 const short int leftpcm[],
    00189                 const short int rightpcm[],
    00190                 int num_samples,
    00191                 unsigned char *mp2buffer,
    00192                 int mp2buffer_size );
    00193
    00194
    00208 DLL_EXPORT int twolame_encode_buffer_interleaved(
    00209                 twolame_options *glopts,
    00210                 const short int pcm[],
    00211                 int num_samples,
    00212                 unsigned char *mp2buffer,
    00213                 int mp2buffer_size );
    00214
    00215
    00233 DLL_EXPORT int twolame_encode_buffer_float32(
    00234                 twolame_options *glopts,
    00235                 const float             leftpcm [],
    00236                 const float             rightpcm [],
    00237                 int num_samples,
    00238                 unsigned char *mp2buffer,
    00239                 int mp2buffer_size );
    00240
    00241
    00255 int twolame_encode_buffer_float32_interleaved(
    00256                 twolame_options *glopts,
    00257                 const float pcm[],
    00258                 int num_samples,
    00259                 unsigned char *mp2buffer,
    00260                 int mp2buffer_size );
    00261
    00262
    00275 DLL_EXPORT int twolame_encode_flush(
    00276                 twolame_options *glopts,
    00277                 unsigned char *mp2buffer,
    00278                 int mp2buffer_size);
    00279
    00280
    00290 DLL_EXPORT void twolame_close(twolame_options **glopts);
    00291
    00292
    00293
    00309 DLL_EXPORT int twolame_set_verbosity(twolame_options *glopts, int verbosity);
    00310
    00311
    00317 DLL_EXPORT int twolame_get_verbosity(twolame_options *glopts);
    00318
    00319
    00330 DLL_EXPORT int twolame_set_mode(twolame_options *glopts, TWOLAME_MPEG_mode mode);
    00331
    00332
    00338 DLL_EXPORT TWOLAME_MPEG_mode twolame_get_mode(twolame_options *glopts);
    00339
    00340
    00346 DLL_EXPORT const char *twolame_get_mode_name(twolame_options *glopts);
    00347
    00348
    00358 DLL_EXPORT int twolame_set_version(twolame_options *glopts, TWOLAME_MPEG_version version);
    00359
    00360
    00366 DLL_EXPORT TWOLAME_MPEG_version twolame_get_version(twolame_options *glopts);
    00367
    00368
    00374 DLL_EXPORT const char *twolame_get_version_name( twolame_options *glopts );
    00375
    00376
    00383 DLL_EXPORT int twolame_get_framelength( twolame_options *glopts );
    00384
    00385
    00395 DLL_EXPORT int twolame_set_psymodel(twolame_options *glopts, int psymodel);
    00396
    00397
    00403 DLL_EXPORT int twolame_get_psymodel(twolame_options *glopts);
    00404
    00405
    00419 DLL_EXPORT int twolame_set_num_channels(twolame_options* glopts, int num_channels);
    00420
    00421
    00427 DLL_EXPORT int twolame_get_num_channels(twolame_options* glopts);
    00428
    00429
    00441 DLL_EXPORT int twolame_set_scale(twolame_options* glopts, float scale);
    00442
    00443
    00449 DLL_EXPORT float twolame_get_scale(twolame_options* glopts);
    00450
    00462 DLL_EXPORT int twolame_set_scale_left(twolame_options* glopts, float scale);
    00463
    00464
    00470 DLL_EXPORT float twolame_get_scale_left(twolame_options* glopts);
    00471
    00472
    00484 DLL_EXPORT int twolame_set_scale_right(twolame_options* glopts, float scale);
    00485
    00486
    00492 DLL_EXPORT float twolame_get_scale_right(twolame_options* glopts);
    00493
    00494
    00504 DLL_EXPORT int twolame_set_in_samplerate(twolame_options *glopts, int samplerate);
    00505
    00506
    00512 DLL_EXPORT int twolame_get_in_samplerate(twolame_options *glopts);
    00513
    00514
    00524 DLL_EXPORT int twolame_set_out_samplerate(twolame_options *glopts, int samplerate);
    00525
    00526
    00532 DLL_EXPORT int twolame_get_out_samplerate(twolame_options *glopts);
    00533
    00534
    00544 DLL_EXPORT int twolame_set_bitrate(twolame_options *glopts, int bitrate);
    00545
    00546
    00552 DLL_EXPORT int twolame_get_bitrate(twolame_options *glopts);
    00553
    00554
    00559 DLL_EXPORT int twolame_set_brate(twolame_options *glopts, int bitrate);
    00560
    00561
    00566 DLL_EXPORT int twolame_get_brate(twolame_options *glopts);
    00567
    00568
    00580 DLL_EXPORT int twolame_set_padding(twolame_options *glopts, TWOLAME_Padding padding);
    00581
    00587 DLL_EXPORT TWOLAME_Padding twolame_get_padding(twolame_options *glopts);
    00588
    00589
    00607 DLL_EXPORT int twolame_set_energy_levels(twolame_options *glopts, int energylevels );
    00608
    00609
    00615 DLL_EXPORT int twolame_get_energy_levels(twolame_options *glopts);
    00616
    00617
    00627 DLL_EXPORT int twolame_set_num_ancillary_bits(twolame_options *glopts, int num);
    00628
    00629
    00635 DLL_EXPORT int twolame_get_num_ancillary_bits(twolame_options *glopts);
    00636
    00637
    00638
    00648 DLL_EXPORT int twolame_set_emphasis(twolame_options *glopts, TWOLAME_Emphasis emphasis);
    00649
    00650
    00656 DLL_EXPORT TWOLAME_Emphasis twolame_get_emphasis(twolame_options *glopts);
    00657
    00658
    00668 DLL_EXPORT int twolame_set_error_protection(twolame_options *glopts, int err_protection);
    00669
    00670
    00676 DLL_EXPORT int twolame_get_error_protection(twolame_options *glopts);
    00677
    00678
    00690 DLL_EXPORT int twolame_set_copyright(twolame_options *glopts, int copyright);
    00691
    00692
    00698 DLL_EXPORT int twolame_get_copyright(twolame_options *glopts);
    00699
    00700
    00710 DLL_EXPORT int twolame_set_original(twolame_options *glopts, int original);
    00711
    00712
    00718 DLL_EXPORT int twolame_get_original(twolame_options *glopts);
    00719
    00720
    00730 DLL_EXPORT int twolame_set_VBR(twolame_options *glopts, int vbr);
    00731
    00732
    00738 DLL_EXPORT int twolame_get_VBR(twolame_options *glopts);
    00739
    00740
    00753 DLL_EXPORT int twolame_set_VBR_level(twolame_options *glopts, float level);
    00754
    00755
    00761 DLL_EXPORT float twolame_get_VBR_level(twolame_options *glopts);
    00762
    00763
    00764
    00765 /*
    00766    Using the twolame_set_VBR_q()/twolame_get_VBR_q functions
    00767    are deprecated, please use twolame_set_VBR_level() instead.
    00768 */
    00769 DLL_EXPORT int twolame_set_VBR_q(twolame_options *glopts, float level);
    00770 DLL_EXPORT float twolame_get_VBR_q(twolame_options *glopts);
    00771
    00772
    00773
    00783 DLL_EXPORT int twolame_set_ATH_level(twolame_options *glopts, float level);
    00784
    00785
    00791 DLL_EXPORT float twolame_get_ATH_level(twolame_options *glopts);
    00792
    00793
    00803 DLL_EXPORT int twolame_set_VBR_max_bitrate_kbps(twolame_options *glopts, int bitrate);
    00804
    00810 DLL_EXPORT int twolame_get_VBR_max_bitrate_kbps(twolame_options *glopts);
    00811
    00812
    00822 DLL_EXPORT int twolame_set_quick_mode(twolame_options *glopts, int quickmode);
    00823
    00829 DLL_EXPORT int twolame_get_quick_mode(twolame_options *glopts);
    00830
    00831
    00841 DLL_EXPORT int twolame_set_quick_count(twolame_options *glopts, int quickcount );
    00842
    00848 DLL_EXPORT int twolame_get_quick_count(twolame_options *glopts);
    00849
    00850
    00851
    00852
    00853
    00854
    00855
    00856 /* WARNING: DAB support is currently broken */
    00857
    00858
    00859
    00860
    00861
    00871 DLL_EXPORT int twolame_set_DAB(twolame_options *glopts, int dab);
    00872
    00878 DLL_EXPORT int twolame_get_DAB(twolame_options *glopts);
    00879
    00880
    00890 DLL_EXPORT int twolame_set_DAB_xpad_length(twolame_options *glopts, int length);
    00891
    00892
    00898 DLL_EXPORT int twolame_get_DAB_xpad_length(twolame_options *glopts);
    00899
    00900
    00910 DLL_EXPORT int twolame_set_DAB_crc_length(twolame_options *glopts, int length);
    00911
    00912
    00918 DLL_EXPORT int twolame_get_DAB_crc_length(twolame_options *glopts);
    00919
    00920
    00921
    00922 #ifdef __cplusplus
    00923 }
    00924 #endif
    00925
    00926 #endif /* _TWOLAME_H_ */
    00927
    00928
    00929 // vim:ts=4:sw=4:nowrap: