diff --git a/app/src/main/java/com/frank/ffmpeg/VideoPlayer.java b/app/src/main/java/com/frank/ffmpeg/VideoPlayer.java index 20fc676..5a76cce 100644 --- a/app/src/main/java/com/frank/ffmpeg/VideoPlayer.java +++ b/app/src/main/java/com/frank/ffmpeg/VideoPlayer.java @@ -5,7 +5,7 @@ import android.media.AudioManager; import android.media.AudioTrack; /** - * 视频播放器 + * VideoPlayer: using FFmpeg filter * Created by frank on 2018/2/1 */ public class VideoPlayer { @@ -15,27 +15,32 @@ public class VideoPlayer { } public native int play(String filePath, Object surface); + public native void setPlayRate(float playRate); public native int filter(String filePath, Object surface, String filterType); + public native void again(); + public native void release(); + public native void playAudio(boolean play); /** - * 创建AudioTrack对象,供JNI调用 + * Create an AudioTrack instance for JNI calling + * * @param sampleRate sampleRate - * @param channels channels + * @param channels channel layout * @return AudioTrack */ - public AudioTrack createAudioTrack(int sampleRate, int channels){ + public AudioTrack createAudioTrack(int sampleRate, int channels) { int audioFormat = AudioFormat.ENCODING_PCM_16BIT; int channelConfig; - if(channels == 1){ + if (channels == 1) { channelConfig = AudioFormat.CHANNEL_OUT_MONO; - }else if(channels == 2){ + } else if (channels == 2) { channelConfig = AudioFormat.CHANNEL_OUT_STEREO; - }else{ + } else { channelConfig = AudioFormat.CHANNEL_OUT_STEREO; }