diff --git a/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
index b07f7a2..b4458c1 100644
--- a/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
+++ b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
@@ -3,6 +3,7 @@ package com.github.xch168.ffmpeg.invoker.demo;
import android.os.Build;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
+import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@@ -11,6 +12,7 @@ import com.github.xch168.ffmpeg.invoker.FFmpegInvoker;
public class MainActivity extends AppCompatActivity {
+ private TextView mConfigView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -20,9 +22,9 @@ public class MainActivity extends AppCompatActivity {
TextView tv = findViewById(R.id.tv_cpu_abi);
tv.setText("CPU_ABI: " + getCpuAbi());
- TextView configView = findViewById(R.id.tv_config_info);
- configView.setMovementMethod(ScrollingMovementMethod.getInstance());
- configView.setText(getConfigInfo());
+ mConfigView = findViewById(R.id.tv_config_info);
+ mConfigView.setMovementMethod(ScrollingMovementMethod.getInstance());
+
}
private String getCpuAbi() {
@@ -33,6 +35,22 @@ public class MainActivity extends AppCompatActivity {
}
}
+ public void getFFmpegConfigInfo(View view) {
+ mConfigView.setText(getConfigInfo());
+ }
+
+ public void getFFmpegCodecInfo(View view) {
+ mConfigView.setText(FFmpegInvoker.getAVCodecInfo());
+ }
+
+ public void getFFmpegFormatInfo(View view) {
+ mConfigView.setText(FFmpegInvoker.getAVFormatInfo());
+ }
+
+ public void getFFmpegFilterInfo(View view) {
+ mConfigView.setText(FFmpegInvoker.getAVFilterInfo());
+ }
+
private String getConfigInfo() {
String configInfo = FFmpegInvoker.getConfigInfo();
String[] configItems = configInfo.split(" ");
@@ -42,5 +60,4 @@ public class MainActivity extends AppCompatActivity {
}
return configInfoBuilder.toString();
}
-
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3b58c09..d28a3c3 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -15,12 +15,56 @@
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="20dp"/>
+
+
+
+
+
+
+
+
diff --git a/library/src/main/cpp/ffmpeg-invoker.c b/library/src/main/cpp/ffmpeg-invoker.c
index 9a40cea..885fe3b 100644
--- a/library/src/main/cpp/ffmpeg-invoker.c
+++ b/library/src/main/cpp/ffmpeg-invoker.c
@@ -105,5 +105,69 @@ JNIEXPORT jstring JNICALL
Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getConfigInfo(JNIEnv *env, jclass clazz) {
char info[10000] = {0};
sprintf(info, "%s\n", avcodec_configuration());
+ return (*env)->NewStringUTF(env, info);
+}
+
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVCodecInfo(JNIEnv *env, jclass clazz) {
+ char info[40000] = { 0 };
+
+ AVCodec *c_temp = av_codec_next(NULL);
+ while (c_temp != NULL) {
+ if (c_temp->decode != NULL) {
+ sprintf(info, "%s[Dec]", info);
+ }
+ else {
+ sprintf(info, "%s[Enc]", info);
+ }
+ switch (c_temp->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ sprintf(info, "%s[Video]", info);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ sprintf(info, "%s[Audio]", info);
+ break;
+ default:
+ sprintf(info, "%s[Other]", info);
+ break;
+ }
+ sprintf(info, "%s[%10s]\n", info, c_temp->name);
+
+
+ c_temp=c_temp->next;
+ }
+
+ return (*env)->NewStringUTF(env, info);
+}
+
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVFormatInfo(JNIEnv *env, jclass clazz) {
+ char info[40000] = { 0 };
+
+ AVInputFormat *if_temp = av_iformat_next(NULL);
+ AVOutputFormat *of_temp = av_oformat_next(NULL);
+ //Input
+ while (if_temp != NULL) {
+ sprintf(info, "%s[In ][%10s]\n", info, if_temp->name);
+ if_temp = if_temp->next;
+ }
+ //Output
+ while (of_temp != NULL) {
+ sprintf(info, "%s[Out][%10s]\n", info, of_temp->name);
+ of_temp = of_temp->next;
+ }
+
+ return (*env)->NewStringUTF(env, info);
+}
+
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVFilterInfo(JNIEnv *env, jclass clazz) {
+ char info[40000] = { 0 };
+ AVFilter *f_temp = (AVFilter *)avfilter_next(NULL);
+ while (f_temp != NULL) {
+ sprintf(info, "%s[%10s]\n", info, f_temp->name);
+ f_temp = f_temp->next;
+ }
+
return (*env)->NewStringUTF(env, info);
}
\ No newline at end of file
diff --git a/library/src/main/cpp/ffmpeg-invoker.h b/library/src/main/cpp/ffmpeg-invoker.h
index 56b8529..0cafa02 100644
--- a/library/src/main/cpp/ffmpeg-invoker.h
+++ b/library/src/main/cpp/ffmpeg-invoker.h
@@ -15,6 +15,15 @@ Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_exit(JNIEnv *, jclass);
JNIEXPORT jstring JNICALL
Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getConfigInfo(JNIEnv *, jclass);
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVCodecInfo(JNIEnv *env, jclass clazz);
+
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVFormatInfo(JNIEnv *, jclass);
+
+JNIEXPORT jstring JNICALL
+Java_com_github_xch168_ffmpeg_invoker_FFmpegInvoker_getAVFilterInfo(JNIEnv *, jclass);
+
#ifdef __cplusplus
}
#endif
diff --git a/library/src/main/java/com/github/xch168/ffmpeg/invoker/FFmpegInvoker.java b/library/src/main/java/com/github/xch168/ffmpeg/invoker/FFmpegInvoker.java
index ff79aec..998d4f4 100644
--- a/library/src/main/java/com/github/xch168/ffmpeg/invoker/FFmpegInvoker.java
+++ b/library/src/main/java/com/github/xch168/ffmpeg/invoker/FFmpegInvoker.java
@@ -19,6 +19,9 @@ public class FFmpegInvoker {
public static native void exit();
public static native String getConfigInfo();
+ public static native String getAVCodecInfo();
+ public static native String getAVFormatInfo();
+ public static native String getAVFilterInfo();
public static void exec(String[] cmds, long duration, Callback listener) {
sCallback = listener;