parent
1416a54a3b
commit
66bfa44052
@ -1,4 +1,4 @@ |
||||
package com.github.xch168.ffmpeg.invoker; |
||||
package com.github.xch168.ffmpeg.invoker.demo; |
||||
|
||||
import android.content.Context; |
||||
|
@ -1,10 +0,0 @@ |
||||
#include <jni.h> |
||||
#include <string> |
||||
|
||||
extern "C" JNIEXPORT jstring JNICALL |
||||
Java_com_github_xch168_ffmpeg_invoker_MainActivity_stringFromJNI( |
||||
JNIEnv* env, |
||||
jobject /* this */) { |
||||
std::string hello = "Hello from C++"; |
||||
return env->NewStringUTF(hello.c_str()); |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.github.xch168.ffmpeg.invoker.demo; |
||||
|
||||
import org.junit.Test; |
||||
|
||||
import static org.junit.Assert.*; |
||||
|
||||
/** |
||||
* Example local unit test, which will execute on the development machine (host). |
||||
* |
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
||||
*/ |
||||
public class ExampleUnitTest { |
||||
@Test |
||||
public void addition_isCorrect() { |
||||
assertEquals(4, 2 + 2); |
||||
} |
||||
} |
@ -0,0 +1 @@ |
||||
/build |
@ -0,0 +1,50 @@ |
||||
apply plugin: 'com.android.library' |
||||
|
||||
android { |
||||
compileSdkVersion 29 |
||||
buildToolsVersion "29.0.3" |
||||
|
||||
defaultConfig { |
||||
minSdkVersion 16 |
||||
targetSdkVersion 29 |
||||
versionCode 1 |
||||
versionName "1.0" |
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
||||
consumerProguardFiles 'consumer-rules.pro' |
||||
|
||||
externalNativeBuild { |
||||
cmake { |
||||
cppFlags "" |
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86" |
||||
} |
||||
} |
||||
} |
||||
|
||||
buildTypes { |
||||
release { |
||||
minifyEnabled false |
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
||||
} |
||||
} |
||||
|
||||
externalNativeBuild { |
||||
cmake { |
||||
path "src/main/cpp/CMakeLists.txt" |
||||
version "3.10.2" |
||||
} |
||||
} |
||||
|
||||
sourceSets.main { |
||||
jniLibs.srcDir 'libs' |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
implementation fileTree(dir: 'libs', include: ['*.jar']) |
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0' |
||||
testImplementation 'junit:junit:4.12' |
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
||||
} |
@ -0,0 +1,21 @@ |
||||
# Add project specific ProGuard rules here. |
||||
# You can control the set of applied configuration files using the |
||||
# proguardFiles setting in build.gradle. |
||||
# |
||||
# For more details, see |
||||
# http://developer.android.com/guide/developing/tools/proguard.html |
||||
|
||||
# If your project uses WebView with JS, uncomment the following |
||||
# and specify the fully qualified class name to the JavaScript interface |
||||
# class: |
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
||||
# public *; |
||||
#} |
||||
|
||||
# Uncomment this to preserve the line number information for |
||||
# debugging stack traces. |
||||
#-keepattributes SourceFile,LineNumberTable |
||||
|
||||
# If you keep the line number information, uncomment this to |
||||
# hide the original source file name. |
||||
#-renamesourcefileattribute SourceFile |
@ -0,0 +1,27 @@ |
||||
package com.github.xch168.ffmpeg.invoker; |
||||
|
||||
import android.content.Context; |
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry; |
||||
import androidx.test.ext.junit.runners.AndroidJUnit4; |
||||
|
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
|
||||
import static org.junit.Assert.*; |
||||
|
||||
/** |
||||
* Instrumented test, which will execute on an Android device. |
||||
* |
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
||||
*/ |
||||
@RunWith(AndroidJUnit4.class) |
||||
public class ExampleInstrumentedTest { |
||||
@Test |
||||
public void useAppContext() { |
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
||||
|
||||
assertEquals("com.github.xch168.ffmpeg.invoker.test", appContext.getPackageName()); |
||||
} |
||||
} |
@ -0,0 +1,2 @@ |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
package="com.github.xch168.ffmpeg.invoker" /> |
@ -0,0 +1,9 @@ |
||||
#include <jni.h> |
||||
#include <string> |
||||
|
||||
extern "C" |
||||
JNIEXPORT jstring JNICALL |
||||
Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_stringFromJNI(JNIEnv *env, jclass clazz) { |
||||
std::string hello = "Hello from C++"; |
||||
return env->NewStringUTF(hello.c_str()); |
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.github.xch168.ffmpeg.invoker; |
||||
|
||||
/** |
||||
* Created by XuCanHui on 2020/3/14. |
||||
*/ |
||||
public class FFmpegInvoker { |
||||
|
||||
static { |
||||
System.loadLibrary("ffmpeg-invoker"); |
||||
} |
||||
|
||||
public static native String stringFromJNI(); |
||||
|
||||
public static void exec(Callback callback) |
||||
{ |
||||
|
||||
} |
||||
|
||||
public interface Callback { |
||||
void onSuccess(); |
||||
void onFailure(); |
||||
void onProgress(); |
||||
} |
||||
} |
@ -1,2 +1,3 @@ |
||||
rootProject.name='FFmpeg-Invoker' |
||||
include ':app' |
||||
include ':library' |
||||
|
Loading…
Reference in new issue