translate VideoPlayer into English

translate VideoPlayer into English
pull/112/head
xufulong 5 years ago
parent 6e3d24eeb5
commit 8b1ced6e0d
  1. 19
      app/src/main/java/com/frank/ffmpeg/VideoPlayer.java

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

Loading…
Cancel
Save