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