00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __TWOLAME_H__
00024 #define __TWOLAME_H__
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifdef _WIN32
00041 #ifdef LIBTWOLAME_STATIC
00042 #define DLL_EXPORT
00043 #else
00044 #ifdef LIBTWOLAME_DLL_EXPORTS
00045 #define DLL_EXPORT __declspec(dllexport)
00046 #else
00047 #define DLL_EXPORT __declspec(dllimport)
00048 #endif
00049 #endif
00050 #else
00051 #define DLL_EXPORT
00052 #endif
00053
00054
00055 #ifndef TRUE
00056 #define TRUE (1)
00057 #endif
00058
00059 #ifndef FALSE
00060 #define FALSE (0)
00061 #endif
00062
00063
00065 typedef enum {
00066 TWOLAME_AUTO_MODE = -1,
00067 TWOLAME_STEREO = 0,
00068 TWOLAME_JOINT_STEREO,
00069 TWOLAME_DUAL_CHANNEL,
00070 TWOLAME_MONO,
00071 TWOLAME_NOT_SET
00072 } TWOLAME_MPEG_mode;
00073
00074
00079 typedef enum {
00080 TWOLAME_MPEG2 = 0,
00081 TWOLAME_MPEG1
00082 } TWOLAME_MPEG_version;
00083
00084
00086 typedef enum {
00087 TWOLAME_PAD_NO = 0,
00088 TWOLAME_PAD_ALL
00089
00090 } TWOLAME_Padding;
00091
00093 typedef enum {
00094 TWOLAME_EMPHASIS_N = 0,
00095 TWOLAME_EMPHASIS_5 = 1,
00096
00097 TWOLAME_EMPHASIS_C = 3
00098 } TWOLAME_Emphasis;
00099
00100
00102 #define TWOLAME_SAMPLES_PER_FRAME 1152
00103
00104
00106 struct twolame_options_struct;
00107
00109 typedef struct twolame_options_struct twolame_options;
00110
00111
00112
00113
00114
00120 DLL_EXPORT const char* get_twolame_version( void );
00121
00122
00128 DLL_EXPORT const char* get_twolame_url( void );
00129
00130
00141 DLL_EXPORT void twolame_print_config(twolame_options *glopts);
00142
00143
00153 DLL_EXPORT twolame_options *twolame_init(void);
00154
00155
00167 DLL_EXPORT int twolame_init_params(twolame_options *glopts);
00168
00169
00184 DLL_EXPORT int twolame_encode_buffer(
00185 twolame_options *glopts,
00186 const short int leftpcm[],
00187 const short int rightpcm[],
00188 int num_samples,
00189 unsigned char *mp2buffer,
00190 int mp2buffer_size );
00191
00192
00206 DLL_EXPORT int twolame_encode_buffer_interleaved(
00207 twolame_options *glopts,
00208 const short int pcm[],
00209 int num_samples,
00210 unsigned char *mp2buffer,
00211 int mp2buffer_size );
00212
00213
00231 DLL_EXPORT int twolame_encode_buffer_float32(
00232 twolame_options *glopts,
00233 const float leftpcm [],
00234 const float rightpcm [],
00235 int num_samples,
00236 unsigned char *mp2buffer,
00237 int mp2buffer_size );
00238
00239
00252 DLL_EXPORT int twolame_encode_flush(
00253 twolame_options *glopts,
00254 unsigned char *mp2buffer,
00255 int mp2buffer_size);
00256
00257
00267 DLL_EXPORT void twolame_close(twolame_options **glopts);
00268
00269
00270
00286 DLL_EXPORT int twolame_set_verbosity(twolame_options *glopts, int verbosity);
00287
00288
00294 DLL_EXPORT int twolame_get_verbosity(twolame_options *glopts);
00295
00296
00307 DLL_EXPORT int twolame_set_mode(twolame_options *glopts, TWOLAME_MPEG_mode mode);
00308
00309
00315 DLL_EXPORT TWOLAME_MPEG_mode twolame_get_mode(twolame_options *glopts);
00316
00317
00323 DLL_EXPORT const char *twolame_get_mode_name(twolame_options *glopts);
00324
00325
00335 DLL_EXPORT int twolame_set_version(twolame_options *glopts, TWOLAME_MPEG_version version);
00336
00337
00343 DLL_EXPORT TWOLAME_MPEG_version twolame_get_version(twolame_options *glopts);
00344
00345
00351 DLL_EXPORT const char *twolame_get_version_name( twolame_options *glopts );
00352
00353
00360 DLL_EXPORT int twolame_get_framelength( twolame_options *glopts );
00361
00362
00372 DLL_EXPORT int twolame_set_psymodel(twolame_options *glopts, int psymodel);
00373
00374
00380 DLL_EXPORT int twolame_get_psymodel(twolame_options *glopts);
00381
00382
00396 DLL_EXPORT int twolame_set_num_channels(twolame_options* glopts, int num_channels);
00397
00398
00404 DLL_EXPORT int twolame_get_num_channels(twolame_options* glopts);
00405
00406
00418 DLL_EXPORT int twolame_set_scale(twolame_options* glopts, float scale);
00419
00420
00426 DLL_EXPORT float twolame_get_scale(twolame_options* glopts);
00427
00439 DLL_EXPORT int twolame_set_scale_left(twolame_options* glopts, float scale);
00440
00441
00447 DLL_EXPORT float twolame_get_scale_left(twolame_options* glopts);
00448
00449
00461 DLL_EXPORT int twolame_set_scale_right(twolame_options* glopts, float scale);
00462
00463
00469 DLL_EXPORT float twolame_get_scale_right(twolame_options* glopts);
00470
00471
00481 DLL_EXPORT int twolame_set_in_samplerate(twolame_options *glopts, int samplerate);
00482
00483
00489 DLL_EXPORT int twolame_get_in_samplerate(twolame_options *glopts);
00490
00491
00501 DLL_EXPORT int twolame_set_out_samplerate(twolame_options *glopts, int samplerate);
00502
00503
00509 DLL_EXPORT int twolame_get_out_samplerate(twolame_options *glopts);
00510
00511
00521 DLL_EXPORT int twolame_set_bitrate(twolame_options *glopts, int bitrate);
00522
00523
00529 DLL_EXPORT int twolame_get_bitrate(twolame_options *glopts);
00530
00531
00536 DLL_EXPORT int twolame_set_brate(twolame_options *glopts, int bitrate);
00537
00538
00543 DLL_EXPORT int twolame_get_brate(twolame_options *glopts);
00544
00545
00557 DLL_EXPORT int twolame_set_padding(twolame_options *glopts, TWOLAME_Padding padding);
00558
00564 DLL_EXPORT TWOLAME_Padding twolame_get_padding(twolame_options *glopts);
00565
00566
00584 DLL_EXPORT int twolame_set_energy_levels(twolame_options *glopts, int energylevels );
00585
00586
00592 DLL_EXPORT int twolame_get_energy_levels(twolame_options *glopts);
00593
00594
00604 DLL_EXPORT int twolame_set_num_ancillary_bits(twolame_options *glopts, int num);
00605
00606
00612 DLL_EXPORT int twolame_get_num_ancillary_bits(twolame_options *glopts);
00613
00614
00615
00625 DLL_EXPORT int twolame_set_emphasis(twolame_options *glopts, TWOLAME_Emphasis emphasis);
00626
00627
00633 DLL_EXPORT TWOLAME_Emphasis twolame_get_emphasis(twolame_options *glopts);
00634
00635
00645 DLL_EXPORT int twolame_set_error_protection(twolame_options *glopts, int err_protection);
00646
00647
00653 DLL_EXPORT int twolame_get_error_protection(twolame_options *glopts);
00654
00655
00667 DLL_EXPORT int twolame_set_copyright(twolame_options *glopts, int copyright);
00668
00669
00675 DLL_EXPORT int twolame_get_copyright(twolame_options *glopts);
00676
00677
00687 DLL_EXPORT int twolame_set_original(twolame_options *glopts, int original);
00688
00689
00695 DLL_EXPORT int twolame_get_original(twolame_options *glopts);
00696
00697
00707 DLL_EXPORT int twolame_set_VBR(twolame_options *glopts, int vbr);
00708
00709
00715 DLL_EXPORT int twolame_get_VBR(twolame_options *glopts);
00716
00717
00730 DLL_EXPORT int twolame_set_VBR_level(twolame_options *glopts, float level);
00731
00732
00738 DLL_EXPORT float twolame_get_VBR_level(twolame_options *glopts);
00739
00740
00741
00742
00743
00744
00745
00746 DLL_EXPORT int twolame_set_VBR_q(twolame_options *glopts, float level);
00747 DLL_EXPORT float twolame_get_VBR_q(twolame_options *glopts);
00748
00749
00750
00760 DLL_EXPORT int twolame_set_ATH_level(twolame_options *glopts, float level);
00761
00762
00768 DLL_EXPORT float twolame_get_ATH_level(twolame_options *glopts);
00769
00770
00780 DLL_EXPORT int twolame_set_VBR_max_bitrate_kbps(twolame_options *glopts, int bitrate);
00781
00787 DLL_EXPORT int twolame_get_VBR_max_bitrate_kbps(twolame_options *glopts);
00788
00789
00799 DLL_EXPORT int twolame_set_quick_mode(twolame_options *glopts, int quickmode);
00800
00806 DLL_EXPORT int twolame_get_quick_mode(twolame_options *glopts);
00807
00808
00818 DLL_EXPORT int twolame_set_quick_count(twolame_options *glopts, int quickcount );
00819
00825 DLL_EXPORT int twolame_get_quick_count(twolame_options *glopts);
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00848 DLL_EXPORT int twolame_set_DAB(twolame_options *glopts, int dab);
00849
00855 DLL_EXPORT int twolame_get_DAB(twolame_options *glopts);
00856
00857
00867 DLL_EXPORT int twolame_set_DAB_xpad_length(twolame_options *glopts, int length);
00868
00869
00875 DLL_EXPORT int twolame_get_DAB_xpad_length(twolame_options *glopts);
00876
00877
00887 DLL_EXPORT int twolame_set_DAB_crc_length(twolame_options *glopts, int length);
00888
00889
00895 DLL_EXPORT int twolame_get_DAB_crc_length(twolame_options *glopts);
00896
00897
00898
00899 #ifdef __cplusplus
00900 }
00901 #endif
00902
00903 #endif
00904
00905
00906