OSDN Git Service

動画変換クラスのクラス名変更
[coroid/inqubus.git] / frontend / src / saccubus / converter / Convert.java
similarity index 89%
rename from frontend/src/saccubus/converter/Ffmpeg.java
rename to frontend/src/saccubus/converter/Convert.java
index dfaa539..f066aab 100644 (file)
@@ -28,9 +28,9 @@ import yukihane.swf.Cws2Fws;
  *
  * @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;
@@ -39,7 +39,7 @@ public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
     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;
@@ -52,7 +52,7 @@ public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
     }
 
     @Override
-    protected FfmpegResult doInBackground() throws Exception {
+    protected ConvertResult doInBackground() throws Exception {
         try {
             return exec();
         } finally {
@@ -68,15 +68,15 @@ public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
         }
     }
 
-    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();
@@ -89,16 +89,16 @@ public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
 //            }
 //        }
 //        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,
@@ -177,7 +177,7 @@ public class Ffmpeg extends SwingWorker<FfmpegResult, FfmpegProgress> {
             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);
                 }