增加非空判断

增加非空判断
pull/107/head
xufulong 5 years ago
parent 1480f1f8a8
commit a6cfd1a331
  1. 16
      app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.java
  2. 4
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java

@ -114,14 +114,18 @@ public class AudioHandleActivity extends BaseActivity {
}
switch (viewId) {
case R.id.btn_transform://转码
String transformFile;
if (useFFmpeg) { //使用FFmpeg转码
transformFile = PATH + File.separator + "transformAudio.mp3";
String transformFile = PATH + File.separator + "transformAudio.mp3";
commandLine = FFmpegUtil.transformAudio(srcFile, transformFile);
} else { //使用MediaCodec与mp3lame转mp3
transformFile = PATH + File.separator + "transformAudio.mp3";
Mp3Converter mp3Converter = new Mp3Converter();
mp3Converter.convertToMp3(srcFile, transformFile);
new Thread(new Runnable() {
@Override
public void run() {
String transformInput = PATH + File.separator + "transformAudio.mp3";
Mp3Converter mp3Converter = new Mp3Converter();
mp3Converter.convertToMp3(srcFile, transformInput);
}
}).start();
}
break;
case R.id.btn_cut://剪切(注意原文件与剪切文件格式一致,文件绝对路径最好不包含中文、特殊字符)
@ -191,7 +195,7 @@ public class AudioHandleActivity extends BaseActivity {
default:
break;
}
if (ffmpegHandler != null) {
if (ffmpegHandler != null && commandLine != null) {
ffmpegHandler.executeFFmpegCmd(commandLine);
}
}

@ -253,7 +253,7 @@ public class VideoHandleActivity extends BaseActivity {
default:
break;
}
if (ffmpegHandler != null) {
if (ffmpegHandler != null && commandLine != null) {
ffmpegHandler.executeFFmpegCmd(commandLine);
}
}
@ -264,7 +264,7 @@ public class VideoHandleActivity extends BaseActivity {
private void handlePhoto() {
// 图片所在路径,图片命名格式img+number.jpg
// 这里指定目录为根目录下img文件夹
String picturePath = PATH + "/frame/";
String picturePath = PATH + "/img/";
if (!FileUtil.checkFileExist(picturePath)) {
return;
}

Loading…
Cancel
Save