OSDN Git Service

リサイズに関するコンフィグ読み書き
[coroid/inqubus.git] / frontend / src / saccubus / converter / profile / FfmpegOption.java
index 79dfa0e..f92617c 100644 (file)
@@ -18,6 +18,11 @@ public class FfmpegOption {
     private final String inOption;
     private final String outOption;
     private final String avfilterOption;
+    private final boolean resize;
+    private final int resizeWidth;
+    private final int resizeHeight;
+    private final boolean adjustRatio;
+    private final boolean padding;
 
     public static FfmpegOption load(File file) throws IOException {
         Properties prop = new Properties();
@@ -27,22 +32,34 @@ public class FfmpegOption {
         String in = prop.getProperty("IN", "");
         String out = prop.getProperty("OUT", "");
         String avfilter = prop.getProperty("AVFILTER", "");
+        boolean resize = Boolean.getBoolean(prop.getProperty("RESIZE", "false"));
+        String width = prop.getProperty("WIDTH", "");
+        String height = prop.getProperty("HEIGHT", "");
+        boolean adjust =  Boolean.getBoolean(prop.getProperty("ADJST_RATIO", "true"));
+        boolean pad =  Boolean.getBoolean(prop.getProperty("ADJST_RATIO", "false"));
 
         if (StringUtils.isBlank(ext)) {
             throw new IOException("変換オプションファイル書式誤り ext: "
                     + ext + ", main: " + main + ", in: " + in + ", out: " + out + ", avfilter: " + avfilter);
         }
-        return new FfmpegOption(ext, main, in, out, avfilter);
+        return new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust, pad);
     }
 
-    public FfmpegOption(String extOption, String mainOption, String inOption, String outOption, String avfilterOption) {
+    public FfmpegOption(String extOption, String mainOption, String inOption, String outOption, String avfilterOption,
+            boolean resize, String width, String height, boolean adjust, boolean pad) {
         this.extOption = (extOption.startsWith(".")) ? extOption : "." + extOption;
         this.mainOption = mainOption;
         this.inOption = inOption;
         this.outOption = outOption;
         this.avfilterOption = avfilterOption;
+        this.resize = resize;
+        this.resizeWidth = (width.isEmpty()) ? 0 : Integer.parseInt(width);
+        this.resizeHeight = (height.isEmpty()) ? 0 : Integer.parseInt(height);
+        this.adjustRatio = adjust;
+        this.padding = pad;
     }
 
+
     public String getExtOption() {
         return extOption;
     }
@@ -62,4 +79,25 @@ public class FfmpegOption {
     public String getAvfilterOption() {
         return avfilterOption;
     }
+
+    public boolean isResize() {
+        return resize;
+    }
+
+    public int getResizeWidth() {
+        return resizeWidth;
+    }
+
+    public int getResizeHeight() {
+        return resizeHeight;
+    }
+
+    public boolean isAdjustRatio() {
+        return adjustRatio;
+    }
+
+    public boolean isPadding() {
+        return padding;
+    }
+
 }