Feature: rename param

pull/209/head
xufuji456 3 years ago
parent b69def6d45
commit ac97af3910
  1. 33
      libmp3/src/main/cpp/audio_lame.c

@ -6,26 +6,20 @@
JNIEXPORT RETURN_TYPE JNICALL Java_com_frank_mp3_Mp3Lite_ ## FUNC_NAME \ JNIEXPORT RETURN_TYPE JNICALL Java_com_frank_mp3_Mp3Lite_ ## FUNC_NAME \
(JNIEnv *env, jclass thiz, ##__VA_ARGS__)\ (JNIEnv *env, jclass thiz, ##__VA_ARGS__)\
lame_global_flags *glf; lame_global_flags *global_flags;
lame_global_flags *initializeDefault(JNIEnv *env) {
lame_global_flags *glf = lame_init();
lame_init_params(glf);
return glf;
}
lame_global_flags *initialize( lame_global_flags *initialize(
JNIEnv *env, JNIEnv *env,
jint inSamplerate, jint outChannel, jint inSampleRate, jint outChannel,
jint outSamplerate, jint outBitrate, jfloat scaleInput, jint mode, jint vbrMode, jint outSampleRate, jint outBitrate, jfloat scaleInput, jint mode, jint vbrMode,
jint quality, jint vbrQuality, jint abrMeanBitrate, jint lowpassFreq, jint highpassFreq, jint quality, jint vbrQuality, jint abrMeanBitrate, jint lowpassFreq, jint highpassFreq,
jstring id3tagTitle, jstring id3tagArtist, jstring id3tagAlbum, jstring id3tagTitle, jstring id3tagArtist, jstring id3tagAlbum,
jstring id3tagYear, jstring id3tagComment) { jstring id3tagYear, jstring id3tagComment) {
lame_global_flags *glf = lame_init(); lame_global_flags *glf = lame_init();
lame_set_in_samplerate(glf, inSamplerate); lame_set_in_samplerate(glf, inSampleRate);
lame_set_num_channels(glf, outChannel); lame_set_num_channels(glf, outChannel);
lame_set_out_samplerate(glf, outSamplerate); lame_set_out_samplerate(glf, outSampleRate);
lame_set_brate(glf, outBitrate); lame_set_brate(glf, outBitrate);
lame_set_quality(glf, quality); lame_set_quality(glf, quality);
lame_set_scale(glf, scaleInput); lame_set_scale(glf, scaleInput);
@ -45,8 +39,6 @@ lame_global_flags *initialize(
lame_set_mode(glf, MONO); lame_set_mode(glf, MONO);
break; break;
case 4: case 4:
lame_set_mode(glf, NOT_SET);
break;
default: default:
lame_set_mode(glf, NOT_SET); lame_set_mode(glf, NOT_SET);
break; break;
@ -74,7 +66,6 @@ lame_global_flags *initialize(
} }
const jchar *title = NULL; const jchar *title = NULL;
const jchar *artist = NULL; const jchar *artist = NULL;
const jchar *album = NULL; const jchar *album = NULL;
@ -185,8 +176,8 @@ void close_lame(lame_global_flags *glf) {
MP3_FUNC(void, lameInitDefault) { MP3_FUNC(void, lameInitDefault) {
global_flags = lame_init();
glf = initializeDefault(env); lame_init_params(global_flags);
} }
MP3_FUNC(void, lameInit, MP3_FUNC(void, lameInit,
@ -196,7 +187,7 @@ MP3_FUNC(void, lameInit,
jstring id3tagArtist, jstring id3tagAlbum, jstring id3tagYear, jstring id3tagArtist, jstring id3tagAlbum, jstring id3tagYear,
jstring id3tagComment) { jstring id3tagComment) {
glf = initialize(env, inSampleRate, outChannel, outSampleRate, outBitrate, scaleInput, mode, global_flags = initialize(env, inSampleRate, outChannel, outSampleRate, outBitrate, scaleInput, mode,
vbrMode, vbrMode,
quality, vbrQuality, abrMeanBitrate, lowPassFreq, highPassFreq, id3tagTitle, quality, vbrQuality, abrMeanBitrate, lowPassFreq, highPassFreq, id3tagTitle,
id3tagArtist, id3tagAlbum, id3tagArtist, id3tagAlbum,
@ -206,19 +197,19 @@ MP3_FUNC(void, lameInit,
MP3_FUNC(jint, lameEncode, MP3_FUNC(jint, lameEncode,
jshortArray buffer_l, jshortArray buffer_r, jint samples, jbyteArray mp3buf) { jshortArray buffer_l, jshortArray buffer_r, jint samples, jbyteArray mp3buf) {
return encode(env, glf, buffer_l, buffer_r, samples, mp3buf); return encode(env, global_flags, buffer_l, buffer_r, samples, mp3buf);
} }
MP3_FUNC(jint, encodeBufferInterleaved, MP3_FUNC(jint, encodeBufferInterleaved,
jshortArray pcm, jint samples, jbyteArray mp3buf) { jshortArray pcm, jint samples, jbyteArray mp3buf) {
return encodeBufferInterleaved(env, glf, pcm, samples, mp3buf); return encodeBufferInterleaved(env, global_flags, pcm, samples, mp3buf);
} }
MP3_FUNC(jint, lameFlush, MP3_FUNC(jint, lameFlush,
jbyteArray mp3buf) { jbyteArray mp3buf) {
return flush(env, glf, mp3buf); return flush(env, global_flags, mp3buf);
} }
MP3_FUNC(void, lameClose) { MP3_FUNC(void, lameClose) {
close_lame(glf); close_lame(global_flags);
} }
Loading…
Cancel
Save