ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
+ private class FfmpegOptionCheckBoxListener implements ActionListener{
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ setFFMpegOptionCheckbox();
+ }
+ }
+ private final FfmpegOptionCheckBoxListener ffmpegOptionCheckBoxListener = new FfmpegOptionCheckBoxListener();
+
+ private void setFFMpegOptionCheckbox() {
+ boolean resizable = (resizeCheckBox.isEnabled() && resizeCheckBox.isSelected());
+ resizeWidthField.setEnabled(resizable);
+ resizeHeigitField.setEnabled(resizable);
+ adjustRatioCheckBox.setEnabled(resizable);
+
+ boolean adjustable = (adjustRatioCheckBox.isEnabled() && adjustRatioCheckBox.isSelected());
+ paddingCheckBox.setEnabled(adjustable);
+ }
+
private void setNames() {
mainTabbedPane.setName("mainTabbedPane");
.addComponent(adjustRatioCheckBox))
.addGroup(layout.createSequentialGroup()
.addGap(20)
- .addComponent(padCheckBox))
+ .addComponent(paddingCheckBox))
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(resizeHeightLabel)
.addComponent(resizeHeigitField))
.addComponent(adjustRatioCheckBox)
- .addComponent(padCheckBox)));
+ .addComponent(paddingCheckBox)));
+
+ resizeCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
+ adjustRatioCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
+ paddingCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
+ setFFMpegOptionCheckbox();
VideoInfoPanel.add(DoButton, gridBagConstraints71);
inputOptionField.setText(movie.getFfmpegOption().getInOption());
outputOptionField.setText(movie.getFfmpegOption().getOutOption());
avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
+ resizeCheckBox.setSelected(movie.getFfmpegOption().isResize());
+ resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth()));
+ resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight()));
+ adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio());
+ paddingCheckBox.setSelected(movie.getFfmpegOption().isPadding());
FFmpegOptionModel.reload(movie.getOptionFile());
// 変換設定
private final JLabel resizeHeightLabel = new JLabel("縦");
private final JTextField resizeHeigitField = new JTextField();
private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
- private final JCheckBox padCheckBox = new JCheckBox("黒幕を付与");
+ private final JCheckBox paddingCheckBox = new JCheckBox("黒幕を付与");
// FFmpegの設定 ここまで
private JLabel FontIndexLabel = new JLabel();
private JTextField fontIndexField = new JTextField();
public void actionPerformed(java.awt.event.ActionEvent e) {
if (FFmpegOptionModel.isFile()) {// ファイル
- extOptionField.setEnabled(false);
- mainOptionField.setEnabled(false);
- inputOptionField.setEnabled(false);
- outputOptionField.setEnabled(false);
- avfilterOptionField.setEnabled(false);
+ setFFMpegOptionEnabled(false);
} else {// ファイルでない
- extOptionField.setEnabled(true);
- mainOptionField.setEnabled(true);
- inputOptionField.setEnabled(true);
- outputOptionField.setEnabled(true);
- avfilterOptionField.setEditable(true);
+ setFFMpegOptionEnabled(true);
+ setFFMpegOptionCheckbox();
}
}
+
+ private void setFFMpegOptionEnabled(boolean enable) {
+ extOptionField.setEnabled(enable);
+ mainOptionField.setEnabled(enable);
+ inputOptionField.setEnabled(enable);
+ outputOptionField.setEnabled(enable);
+ avfilterOptionField.setEnabled(enable);
+ resizeCheckBox.setEnabled(enable);
+ resizeWidthField.setEnabled(enable);
+ resizeHeigitField.setEditable(enable);
+ adjustRatioCheckBox.setEnabled(enable);
+ paddingCheckBox.setEnabled(enable);
+ }
});
}
return FFmpegOptionComboBox;
String in = inputOptionField.getText();
String out = outputOptionField.getText();
String avfilter = avfilterOptionField.getText();
+ boolean resize = resizeCheckBox.isSelected();
+ String width = resizeWidthField.getText();
+ String height = resizeHeigitField.getText();
+ boolean adjust = adjustRatioCheckBox.isSelected();
+ boolean pad = paddingCheckBox.isSelected();
File optionFile = FFmpegOptionModel.getSelectedFile();
- FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter);
+ FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust, pad);
return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
}
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();
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;
}
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;
+ }
+
}
// OutputFileSetting outputFileSetting = p.getOutputFileSetting();
Ffmpeg ffmpeg = p.getFfmpeg();
- FfmpegOption newFfmpegOption = new FfmpegOption(ffmpeg.getFfmpegOption().getExtOption(), "", "", ff, "");
+ FfmpegOption newFfmpegOption = new FfmpegOption(ffmpeg.getFfmpegOption().getExtOption(), "", "", ff, "", false,
+ "", "", false, false);
InputFileSetting newVideoSetting = new InputFileSetting(new SFile(true, new File(video)), false, false);
InputFileSetting newCommentSetting = new InputFileSetting(new SFile(true, new File(comm)), false, false);
InputFileSetting newTcommentSetting = new InputFileSetting(new SFile(true, new File(tcomm)), false, false);
private static final String PROP_CMDLINE_IN = "CMD_IN";
private static final String PROP_CMDLINE_OUT = "CMD_OUT";
private static final String PROP_CMDLINE_AVFILTER = "CMD_AVFILTER";
+ private static final String PROP_RESIZE = "CMD_RESIZE";
+ private static final String PROP_RESIZE_WIDTH = "CMD_RESIZE_WIDTH";
+ private static final String PROP_RESIZE_HEIGHT = "CMD_RESIZE_HEIGHT";
+ private static final String PROP_ADJUST_RATIO = "CMD_ADJUST_RATIO";
+ private static final String PROP_PADDING ="CMD_PADDING";
private final File ffmpeg;
private final File vhook;
private final File optionFile;
prop.setProperty(PROP_CMDLINE_IN, getFfmpegOption().getInOption());
prop.setProperty(PROP_CMDLINE_OUT, getFfmpegOption().getOutOption());
prop.setProperty(PROP_CMDLINE_AVFILTER, getFfmpegOption().getAvfilterOption());
+ prop.setProperty(PROP_RESIZE, Boolean.toString(getFfmpegOption().isResize()));
+ prop.setProperty(PROP_RESIZE_WIDTH, Integer.toString(getFfmpegOption().getResizeWidth()));
+ prop.setProperty(PROP_RESIZE_HEIGHT, Integer.toString(getFfmpegOption().getResizeHeight()));
+ prop.setProperty(PROP_ADJUST_RATIO, Boolean.toString(getFfmpegOption().isAdjustRatio()));
+ prop.setProperty(PROP_PADDING, Boolean.toString(getFfmpegOption().isPadding()));
if (getOptionFile() != null) {
prop.setProperty(PROP_OPTION_FILE, getOptionFile().getPath());
} else {
String out = prop.getProperty(PROP_CMDLINE_OUT,
"-f ipod -g 150 -qcomp 0.7 -qmin 20 -qmax 30 -qdiff 4 -subq 6 -me_range 16 -i_qfactor 0.714286");
String avfilter = prop.getProperty(PROP_CMDLINE_AVFILTER, "");
- FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter);
+ boolean resize = Boolean.getBoolean(prop.getProperty(PROP_RESIZE,"false"));
+ String width = prop.getProperty(PROP_RESIZE_WIDTH, "512");
+ String height = prop.getProperty(PROP_RESIZE_HEIGHT, "384");
+ boolean adjust = Boolean.getBoolean(prop.getProperty(PROP_ADJUST_RATIO,"false"));
+ boolean pad = Boolean.getBoolean(prop.getProperty(PROP_PADDING, "false"));
+ FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust, pad);
return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
}