*
* @author yuki
*/
-public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
+public class Convert extends SwingWorker<ConvertResult, ConvertProgress> {
- private static final Logger logger = Logger.getLogger(Ffmpeg.class.getName());
+ private static final Logger logger = Logger.getLogger(Convert.class.getName());
private final File commentMiddleFile;
private final File tcommMiddleFile;
private final File TMP_CWS;
private final File convertedVideoFile;
private final ConvertProfile ffmpeg;
- Ffmpeg(File commentFile, File videoFile, File convertedVideoFile, ConvertProfile ffmpeg) throws IOException {
+ Convert(ConvertProfile ffmpeg, File commentFile, File videoFile, File convertedVideoFile) throws IOException {
this.commentFile = commentFile;
this.videoFile = videoFile;
this.convertedVideoFile = convertedVideoFile;
}
@Override
- protected FfmpegResult doInBackground() throws Exception {
+ protected ConvertResult doInBackground() throws Exception {
try {
return exec();
} finally {
}
}
- private FfmpegResult exec() throws InterruptedException, IOException {
+ private ConvertResult exec() throws InterruptedException, IOException {
final HideCondition ngSetting = getFfmpeg().getNgSetting();
if (commentFile != null) {
- publish(new FfmpegProgress("コメントの中間ファイルへの変換中"));
+ publish(new ConvertProgress("コメントの中間ファイルへの変換中"));
boolean conv = ConvertToVideoHook.convert(commentFile, commentMiddleFile, ngSetting.getId(), ngSetting.
getWord());
if (!conv) {
- publish(new FfmpegProgress("コメント変換に失敗。ファイル名に使用できない文字が含まれているか正規表現の間違い?"));
- return new FfmpegResult(false);
+ publish(new ConvertProgress("コメント変換に失敗。ファイル名に使用できない文字が含まれているか正規表現の間違い?"));
+ return new ConvertResult(false);
}
}
checkStop();
// }
// }
// stopFlagReturn();
- publish(new FfmpegProgress("動画の変換を開始"));
+ publish(new ConvertProgress("動画の変換を開始"));
int code;
if ((code = converting_video(videoFile, convertedVideoFile, (commentFile != null), commentMiddleFile.getPath(),
false, tcommMiddleFile.getPath(), getFfmpeg().getFfmpegOption())) == 0) {
- publish(new FfmpegProgress("変換が正常に終了しました。"));
- return new FfmpegResult(true);
+ publish(new ConvertProgress("変換が正常に終了しました。"));
+ return new ConvertResult(true);
} else {
- publish(new FfmpegProgress("変換エラー:" + convertedVideoFile.getPath()));
+ publish(new ConvertProgress("変換エラー:" + convertedVideoFile.getPath()));
}
- return new FfmpegResult(false);
+ return new ConvertResult(false);
}
private int converting_video(File videoFile, File convertedVideoFile, boolean addComment, String commPath,
while ((e = ebr.readLine()) != null) {
String state = e;
if (state.startsWith("frame=")) {
- publish(new FfmpegProgress(state));
+ publish(new ConvertProgress(state));
} else if (!state.endsWith("No accelerated colorspace conversion found")) {
logger.log(Level.INFO, e);
}