Skip to content

Commit

Permalink
standard naming specification
Browse files Browse the repository at this point in the history
  • Loading branch information
JinJieGu committed Apr 19, 2018
1 parent c7ab189 commit f93ed7c
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 11 deletions.
Binary file modified library/src/jniLibs/arm64-v8a/liblame-mp3-utils.so
Binary file not shown.
Binary file modified library/src/jniLibs/armeabi-v7a/liblame-mp3-utils.so
Binary file not shown.
Binary file modified library/src/jniLibs/mips/liblame-mp3-utils.so
Binary file not shown.
Binary file modified library/src/jniLibs/mips64/liblame-mp3-utils.so
Binary file not shown.
Binary file modified library/src/jniLibs/x86/liblame-mp3-utils.so
Binary file not shown.
Binary file modified library/src/jniLibs/x86_64/liblame-mp3-utils.so
Binary file not shown.
14 changes: 6 additions & 8 deletions library/src/main/cpp/lame-mp3-utils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include"stdio.h"
#include"jni.h"
#include"malloc.h"
#include"string.h"
#include"lamemp3/lame.h"
#include"android/log.h"
#define LOG_TAG "lameUtils"
Expand Down Expand Up @@ -47,9 +45,9 @@ Java_jaygoo_library_converter_Mp3Converter_init(JNIEnv *env, jclass type, jint i

extern "C" JNIEXPORT
void JNICALL Java_jaygoo_library_converter_Mp3Converter_convertMp3
(JNIEnv * env, jobject obj, jstring jInput, jstring jMp3) {
const char* cInput = env->GetStringUTFChars(jInput, 0);
const char* cMp3 = env->GetStringUTFChars(jMp3, 0);
(JNIEnv * env, jobject obj, jstring jInputPath, jstring jMp3Path) {
const char* cInput = env->GetStringUTFChars(jInputPath, 0);
const char* cMp3 = env->GetStringUTFChars(jMp3Path, 0);
//open input file and output file
FILE* fInput = fopen(cInput,"rb");
FILE* fMp3 = fopen(cMp3,"wb");
Expand All @@ -66,7 +64,7 @@ void JNICALL Java_jaygoo_library_converter_Mp3Converter_convertMp3

//convert to mp3
do{
read = static_cast<int>(fread(inputBuffer, sizeof(short int) * 2, 8192, fInput));
read = static_cast<int>(fread(inputBuffer, sizeof(short int) * 2, BUFFER_SIZE, fInput));
total += read * sizeof(short int)*2;
nowConvertBytes = total;
if(read != 0){
Expand All @@ -84,8 +82,8 @@ void JNICALL Java_jaygoo_library_converter_Mp3Converter_convertMp3
resetLame();
fclose(fInput);
fclose(fMp3);
env->ReleaseStringUTFChars(jInput, cInput);
env->ReleaseStringUTFChars(jMp3, cMp3);
env->ReleaseStringUTFChars(jInputPath, cInput);
env->ReleaseStringUTFChars(jMp3Path, cMp3);
nowConvertBytes = -1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public native static void init(int inSampleRate, int channel, int mode,
/**
* file convert to mp3
* it may cost a lot of time and better put it in a thread
* @param input
* @param inputPath
* file path to be converted
* @param mp3
* @param mp3Path
* mp3 output file path
*/
public native static void convertMp3(String input, String mp3);
public native static void convertMp3(String inputPath, String mp3Path);


/**
Expand Down

0 comments on commit f93ed7c

Please sign in to comment.