|
|
|
@ -1,9 +1,12 @@ |
|
|
|
|
package com.frank.ffmpeg; |
|
|
|
|
|
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
|
|
import com.frank.ffmpeg.listener.OnHandleListener; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The JNI interface of handling FFmpeg command |
|
|
|
|
* Created by frank on 2018/1/23 |
|
|
|
@ -39,6 +42,33 @@ public class FFmpegCmd { |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Execute FFmpeg multi commands |
|
|
|
|
* @param commands the String array of command |
|
|
|
|
* @param onHandleListener the callback for executing command |
|
|
|
|
*/ |
|
|
|
|
public static void execute(final List<String[]> commands, final OnHandleListener onHandleListener) { |
|
|
|
|
new Thread(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
if (onHandleListener != null) { |
|
|
|
|
onHandleListener.onBegin(); |
|
|
|
|
} |
|
|
|
|
//call JNI interface to execute FFmpeg cmd
|
|
|
|
|
int result = 0; |
|
|
|
|
int count = 0; |
|
|
|
|
for (String[] command : commands) { |
|
|
|
|
result = handle(command); |
|
|
|
|
count ++; |
|
|
|
|
Log.i("FFmpegCmd", count + " result=" + result); |
|
|
|
|
} |
|
|
|
|
if (onHandleListener != null) { |
|
|
|
|
onHandleListener.onEnd(result, null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Using FastStart to moov box in front of mdat box |
|
|
|
|
* |
|
|
|
|