1 package yukihane.inqubus.config;
4 import java.io.IOException;
5 import org.apache.commons.lang.builder.ToStringBuilder;
6 import saccubus.FfmpegOption;
7 import saccubus.worker.profile.FfmpegProfile;
10 * コンフィグに設定された値を基にしたFfmpegProfile実装.
13 public class ConfigFfmpegProfile implements FfmpegProfile {
15 private final String extOption;
16 private final String inOption;
17 private final String mainOption;
18 private final String outOption;
19 private final String avOption;
20 private final boolean resize;
21 private final int resizeWidth;
22 private final int resizeHeight;
23 private final boolean adjustRatio;
25 public ConfigFfmpegProfile() throws IOException {
26 final Config p = Config.INSTANCE;
28 if (p.getFfmpegOptionFile() != null) {
29 final File file = new File(p.getFfmpegOptionFile());
30 final FfmpegOption ffop = FfmpegOption.load(file);
31 this.extOption = ffop.getExtOption();
32 this.inOption = ffop.getInOption();
33 this.mainOption = ffop.getMainOption();
34 this.outOption = ffop.getMainOption();
35 this.avOption = ffop.getAvfilterOption();
36 this.resize = ffop.isResize();
37 this.resizeWidth = ffop.getResizeWidth();
38 this.resizeHeight = ffop.getResizeHeight();
39 this.adjustRatio = ffop.isAdjustRatio();
41 this.extOption = p.getFfmpegExtension();
42 this.inOption = p.getFfmpegInOption();
43 this.mainOption = p.getFfmpegMainOption();
44 this.outOption = p.getFfmpegOutOption();
45 this.avOption = p.getFfmpegAvOption();
46 this.resize = p.getFfmpegResizeEnable();
47 this.resizeWidth = Integer.parseInt(p.getFfmpegResizeWidth());
48 this.resizeHeight = Integer.parseInt(p.getFfmpegResizeHeight());
49 this.adjustRatio = p.getFfmpegKeepAspect();
54 public String getExtOption() {
55 if (this.extOption.startsWith(".")) {
56 return this.extOption;
58 return "." + this.extOption;
62 public String getInOption() {
67 public String getMainOption() {
68 return this.mainOption;
72 public String getOutOption() {
73 return this.outOption;
77 public String getAvfilterOption() {
82 public boolean isResize() {
87 public int getResizeWidth() {
88 return this.resizeWidth;
92 public int getResizeHeight() {
93 return this.resizeHeight;
97 public boolean isAdjustRatio() {
98 return this.adjustRatio;
102 public String toString() {
103 return ToStringBuilder.reflectionToString(this);