OSDN Git Service

出力動画に拡張子がつかない問題に対処
authoryukihane <yukihane.feather@gmail.com>
Wed, 14 Sep 2011 05:37:34 +0000 (14:37 +0900)
committeryukihane <yukihane.feather@gmail.com>
Wed, 14 Sep 2011 05:37:34 +0000 (14:37 +0900)
frontend/src/saccubus/worker/impl/convert/Convert.java
frontend/src/saccubus/worker/profile/FfmpegProfile.java
frontend/src/yukihane/inqubus/config/ConfigFfmpegProfile.java
frontend/src/yukihane/inqubus/gui/MainFrame.java

index 6cc39f6..1d472d9 100644 (file)
@@ -74,16 +74,17 @@ public class Convert extends Worker<ConvertResult, ConvertProgress> {
 
         final GeneralProfile gene = profile.getGeneralProfile();
         final OutputProfile outprof = profile.getOutputProfile();
-        final OutputNamePattern pattern = new OutputNamePattern(outprof.getFileName());
+        final OutputNamePattern outputPattern = new OutputNamePattern(outprof.getFileName());
         final String id = outprof.getVideoId();
-        pattern.setId(isNotEmpty(id) ? id : "");
+        outputPattern.setId(isNotEmpty(id) ? id : "");
         final String title = outprof.getTitile();
-        pattern.setTitle(isNotEmpty(title) ? title : "");
+        outputPattern.setTitle(isNotEmpty(title) ? title : "");
         final String fileName = getBaseName(videoFile.getPath());
-        pattern.setFileName(fileName);
-        pattern.setReplaceFrom(gene.getReplaceFrom());
-        pattern.setReplaceFrom(gene.getReplaceTo());
-        final File outputFile = new File(outprof.getDir(), pattern.createFileName());
+        outputPattern.setFileName(fileName);
+        outputPattern.setReplaceFrom(gene.getReplaceFrom());
+        outputPattern.setReplaceFrom(gene.getReplaceTo());
+        final File outputFile = new File(outprof.getDir(),
+                outputPattern.createFileName() + profile.getFfmpegOption().getExtOption());
 
         File transformedComment = null;
         File transformedOwner = null;
index 96e730d..bf096f6 100644 (file)
@@ -6,6 +6,10 @@ package saccubus.worker.profile;
  */
 public interface FfmpegProfile {
 
+    /**
+     * @return 変換後動画ファイルの拡張子.
+     * 最初にドットを付け, ".mp4" というような形式を返します.
+     */
     String getExtOption();
 
     String getInOption();
index 2accf35..2977755 100644 (file)
@@ -52,7 +52,10 @@ public class ConfigFfmpegProfile implements FfmpegProfile {
 
     @Override
     public String getExtOption() {
-        return this.extOption;
+        if (this.extOption.startsWith(".")) {
+            return this.extOption;
+        }
+        return "." + this.extOption;
     }
 
     @Override
index 50e9fcf..1d4030b 100644 (file)
@@ -1062,7 +1062,11 @@ public class MainFrame extends JFrame {
         private final boolean adjustRatio;
 
         private InqubusFfmpegProfile() throws IOException {
-            this.extOption = pnlInputFfmpeg.fldFfmpegOptionExtension.getText();
+            String ext = pnlInputFfmpeg.fldFfmpegOptionExtension.getText();
+            if (!ext.startsWith(".")) {
+                ext = "." + ext;
+            }
+            this.extOption = ext;
             this.inOption = pnlInputFfmpeg.fldFfmpegOptionIn.getText();
             this.mainOption = pnlInputFfmpeg.fldFfmpegOptionMain.getText();
             this.outOption = pnlInputFfmpeg.fldFfmpegOptionOut.getText();