translate the note FFmpegHandler into English

translate the note FFmpegHandler into English
pull/112/head
xufulong 5 years ago
parent 918fe2bc12
commit 199d141e1c
  1. 6
      app/src/main/java/com/frank/ffmpeg/format/VideoLayout.java
  2. 18
      app/src/main/java/com/frank/ffmpeg/handler/FFmpegHandler.java

@ -1,15 +1,15 @@
package com.frank.ffmpeg.format; package com.frank.ffmpeg.format;
/** /**
* 视频布局 * layout of video
* Created by frank on 2018/6/18. * Created by frank on 2018/6/18.
*/ */
public class VideoLayout { public class VideoLayout {
//水平拼接 //horizontal join
public final static int LAYOUT_HORIZONTAL = 1; public final static int LAYOUT_HORIZONTAL = 1;
//垂直拼接 //vertical join
public final static int LAYOUT_VERTICAL = 2; public final static int LAYOUT_VERTICAL = 2;
} }

@ -9,7 +9,7 @@ import com.frank.ffmpeg.model.MediaBean;
import com.frank.ffmpeg.tool.JsonParseTool; import com.frank.ffmpeg.tool.JsonParseTool;
/** /**
* Handler消息处理器 * Handler of FFmpeg and FFprobe
* Created by frank on 2019/11/11. * Created by frank on 2019/11/11.
*/ */
public class FFmpegHandler { public class FFmpegHandler {
@ -37,11 +37,12 @@ public class FFmpegHandler {
} }
/** /**
* 执行ffmpeg命令行 * execute the command of FFmpeg
*
* @param commandLine commandLine * @param commandLine commandLine
*/ */
public void executeFFmpegCmd(final String[] commandLine) { public void executeFFmpegCmd(final String[] commandLine) {
if(commandLine == null) { if (commandLine == null) {
return; return;
} }
FFmpegCmd.execute(commandLine, new OnHandleListener() { FFmpegCmd.execute(commandLine, new OnHandleListener() {
@ -54,9 +55,9 @@ public class FFmpegHandler {
@Override @Override
public void onEnd(int resultCode, String resultMsg) { public void onEnd(int resultCode, String resultMsg) {
Log.i(TAG, "handle onEnd..."); Log.i(TAG, "handle onEnd...");
if(isContinue) { if (isContinue) {
mHandler.obtainMessage(MSG_CONTINUE).sendToTarget(); mHandler.obtainMessage(MSG_CONTINUE).sendToTarget();
}else { } else {
mHandler.obtainMessage(MSG_FINISH).sendToTarget(); mHandler.obtainMessage(MSG_FINISH).sendToTarget();
} }
} }
@ -64,11 +65,12 @@ public class FFmpegHandler {
} }
/** /**
* execute probe cmd * execute the command of FFprobe
*
* @param commandLine commandLine * @param commandLine commandLine
*/ */
public void executeFFprobeCmd(final String[] commandLine) { public void executeFFprobeCmd(final String[] commandLine) {
if(commandLine == null) { if (commandLine == null) {
return; return;
} }
FFmpegCmd.executeProbe(commandLine, new OnHandleListener() { FFmpegCmd.executeProbe(commandLine, new OnHandleListener() {
@ -82,7 +84,7 @@ public class FFmpegHandler {
public void onEnd(int resultCode, String resultMsg) { public void onEnd(int resultCode, String resultMsg) {
Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg); Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg);
MediaBean mediaBean = null; MediaBean mediaBean = null;
if(resultMsg != null && !resultMsg.isEmpty()) { if (resultMsg != null && !resultMsg.isEmpty()) {
mediaBean = JsonParseTool.parseMediaFormat(resultMsg); mediaBean = JsonParseTool.parseMediaFormat(resultMsg);
} }
mHandler.obtainMessage(MSG_FINISH, mediaBean).sendToTarget(); mHandler.obtainMessage(MSG_FINISH, mediaBean).sendToTarget();

Loading…
Cancel
Save