1 #include <string.h>
2 #include <stdlib.h>
3 #include <jni.h>
4 #include <android/log.h>
5
6 #define LOG_TAG "welsdec"
7 #define LOGI(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
8
9 extern "C" int EncMain (int argc, char* argv[]);
10 extern "C"
Java_com_wels_enc_WelsEncTest_DoEncoderAutoTest(JNIEnv * env,jobject thiz,jstring jsIncfgName,jstring jsInlayerName,jstring jsInyuvName,jstring jsOutbitName)11 JNIEXPORT void JNICALL Java_com_wels_enc_WelsEncTest_DoEncoderAutoTest
12 (JNIEnv* env, jobject thiz, jstring jsIncfgName, jstring jsInlayerName, jstring jsInyuvName, jstring jsOutbitName) {
13 /**************** Add the native codes/API *****************/
14 const char* argv[] = {
15 (char*) ("encConsole.exe"),
16 (char*) ((*env).GetStringUTFChars (jsIncfgName, NULL)),
17 (char*) ("-org"),
18 (char*) ((*env).GetStringUTFChars (jsInyuvName, NULL)),
19 (char*) ("-bf"),
20 (char*) ((*env).GetStringUTFChars (jsOutbitName, NULL)),
21 (char*) ("-numl"),
22 (char*) ("1"),
23 (char*) ("-lconfig"),
24 (char*) ("0"),
25 (char*) ((*env).GetStringUTFChars (jsInlayerName, NULL))
26 };
27 LOGI ("Start to run JNI module!+++");
28 EncMain (sizeof (argv) / sizeof (argv[0]), (char**)&argv[0]);
29 LOGI ("End to run JNI module!+++");
30 }
31
Java_com_wels_enc_WelsEncTest_DoEncoderTest(JNIEnv * env,jobject thiz,jstring jsFileNameIn)32 JNIEXPORT void JNICALL Java_com_wels_enc_WelsEncTest_DoEncoderTest
33 (JNIEnv* env, jobject thiz, jstring jsFileNameIn) {
34 /**************** Add the native codes/API *****************/
35 char* argv[2];
36 int argc = 2;
37 argv[0] = (char*) ("encConsole.exe");
38 argv[1] = (char*) ((*env).GetStringUTFChars (jsFileNameIn, NULL));
39 LOGI ("Start to run JNI module!+++");
40 EncMain (argc, argv);
41 LOGI ("End to run JNI module!+++");
42
43 }
44
45
46