From 8327b9859a23d4d0c11458c8f96df6ef435baad7 Mon Sep 17 00:00:00 2001 From: yukihane Date: Fri, 16 Sep 2011 00:37:16 +0900 Subject: [PATCH] =?utf8?q?MediaInfo=E8=A8=AD=E5=AE=9A=E7=94=A8=E3=81=AEGUI?= =?utf8?q?=E9=A0=85=E7=9B=AE=E3=81=A8=E3=80=81=E3=82=B3=E3=83=B3=E3=83=95?= =?utf8?q?=E3=82=A3=E3=82=B0=E8=AA=AD=E3=81=BF=E6=9B=B8=E3=81=8D=E5=87=A6?= =?utf8?q?=E7=90=86=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/saccubus/worker/impl/convert/Convert.java | 2 +- .../saccubus/worker/profile/ConvertProfile.java | 7 ++++ frontend/src/yukihane/inqubus/config/Config.java | 9 +++++ .../inqubus/config/ConfigConvertProfile.java | 7 ++++ .../src/yukihane/inqubus/gui/ConfigDialog.java | 41 ++++++++++++++-------- 5 files changed, 50 insertions(+), 16 deletions(-) diff --git a/frontend/src/saccubus/worker/impl/convert/Convert.java b/frontend/src/saccubus/worker/impl/convert/Convert.java index 0fa9916..d43d310 100644 --- a/frontend/src/saccubus/worker/impl/convert/Convert.java +++ b/frontend/src/saccubus/worker/impl/convert/Convert.java @@ -176,7 +176,7 @@ public class Convert extends Worker { cmdList.add(opt); } } - final Info info = MediaInfo.getInfo(new File("bin", "MediaInfo"), targetVideoFile); + final Info info = MediaInfo.getInfo(profile.getMediaInfo(), targetVideoFile); // 4:3 なら1.33, 16:9 なら1.76 final boolean isHD = ((double) info.getWidth() / (double) info.getHeight() > 1.5); if (ffop.isResize()) { diff --git a/frontend/src/saccubus/worker/profile/ConvertProfile.java b/frontend/src/saccubus/worker/profile/ConvertProfile.java index 6d16e4d..d5a9567 100644 --- a/frontend/src/saccubus/worker/profile/ConvertProfile.java +++ b/frontend/src/saccubus/worker/profile/ConvertProfile.java @@ -45,6 +45,13 @@ public interface ConvertProfile { */ File getVhook(); + /** + * @return {@link #isConvert()}がtrueの場合に + * 使用するMediaInfo実行ファイル. + * それ以外の場合は未定義. + */ + File getMediaInfo(); + /** @return 一時作業ディレクトリ. */ File getTempDir(); diff --git a/frontend/src/yukihane/inqubus/config/Config.java b/frontend/src/yukihane/inqubus/config/Config.java index 2c18e60..9499567 100644 --- a/frontend/src/yukihane/inqubus/config/Config.java +++ b/frontend/src/yukihane/inqubus/config/Config.java @@ -328,6 +328,15 @@ public enum Config { public void setFfmpegDllPath(String s) { config.setProperty(FFMPEG_DLLPATH, s); } + private static final String MEDIAINFO_PATH = "ffmpeg.mediainfopath"; + + public String getMediaInfoPath() { + return config.getString(MEDIAINFO_PATH, "bin/MediaInfo.exe"); + } + + public void setMediaInfoPath(String s) { + config.setProperty(MEDIAINFO_PATH, s); + } private static final String FFMPEG_PARAM_OPTIONFILE = "ffmpeg.param.optionfile"; public String getFfmpegOptionFile() { diff --git a/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java b/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java index 45d1c1a..f2b2171 100644 --- a/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java +++ b/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java @@ -21,6 +21,7 @@ public abstract class ConfigConvertProfile implements ConvertProfile { private final boolean vhookDisabled; private final boolean commentOverlay; private final File vhook; + private final File mediaInfo; private final File tempDir; private final File font; private final int fontIndex; @@ -40,6 +41,7 @@ public abstract class ConfigConvertProfile implements ConvertProfile { this.vhookDisabled = p.getFfmpegDllDisabled(); this.commentOverlay = p.getOutputCommentOverlay(); this.vhook = new File(p.getFfmpegDllPath()); + this.mediaInfo = new File(p.getMediaInfoPath()); this.tempDir = new File(p.getSystemTempDir()); this.font = new File(p.getFontPath()); this.fontIndex = Integer.parseInt(p.getFontIndex()); @@ -88,6 +90,11 @@ public abstract class ConfigConvertProfile implements ConvertProfile { } @Override + public File getMediaInfo() { + return mediaInfo; + } + + @Override public File getTempDir() { return tempDir; } diff --git a/frontend/src/yukihane/inqubus/gui/ConfigDialog.java b/frontend/src/yukihane/inqubus/gui/ConfigDialog.java index fb734cf..ab1bbf0 100644 --- a/frontend/src/yukihane/inqubus/gui/ConfigDialog.java +++ b/frontend/src/yukihane/inqubus/gui/ConfigDialog.java @@ -92,10 +92,9 @@ public class ConfigDialog extends JDialog { fldFontIndex = new JTextField(); final JPanel pnlFfmpeg = new JPanel(); final JPanel pnlFfmpegBinPath = new JPanel(); - final JLabel lblFfmpegPath = new JLabel(); - final JLabel lblFfmpegDllPath = new JLabel(); - fldFfmpegPath = new JTextField(); - fldFfmpegDllPath = new JTextField(); + final JLabel lblFfmpegPath = new JLabel("ffmpeg"); + final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ"); + final JLabel lblMediaInfoPath = new JLabel("MediaInfo"); final JPanel pnlNgSetting = new JPanel(); final JPanel pnlSearch = new JPanel(); @@ -478,10 +477,6 @@ public class ConfigDialog extends JDialog { pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス")); - lblFfmpegPath.setText("ffmpeg"); - - lblFfmpegDllPath.setText("拡張ライブラリ"); - final JButton btnFfmpegPath = new JButton("..."); btnFfmpegPath.addActionListener( new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath)); @@ -490,6 +485,10 @@ public class ConfigDialog extends JDialog { btnFfmpegDllPath.addActionListener( new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath)); + final JButton btnMediaInfoPath = new JButton("..."); + btnMediaInfoPath.addActionListener( + new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath)); + GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath); pnlFfmpegBinPath.setLayout(gl_jPanel10); gl_jPanel10.setHorizontalGroup( @@ -497,16 +496,22 @@ public class ConfigDialog extends JDialog { .addGroup(gl_jPanel10.createSequentialGroup() .addContainerGap() .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblFfmpegPath) .addComponent(lblFfmpegDllPath) - .addComponent(lblFfmpegPath)) + .addComponent(lblMediaInfoPath) + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) - .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)) + .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING) - .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)) + .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING) + .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING) + ) .addContainerGap()) ); gl_jPanel10.setVerticalGroup( @@ -516,12 +521,15 @@ public class ConfigDialog extends JDialog { .addComponent(lblFfmpegPath) .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnFfmpegPath)) - .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lblFfmpegDllPath) .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnFfmpegDllPath)) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(lblMediaInfoPath) + .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(btnMediaInfoPath)) + ) ); pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ")); @@ -788,8 +796,9 @@ public class ConfigDialog extends JDialog { private final JCheckBox cbCommentOpaque; // ffmpeg // ffmpeg - ファイルパス - private final JTextField fldFfmpegPath; - private final JTextField fldFfmpegDllPath; + private final JTextField fldFfmpegPath = new JTextField(); + private final JTextField fldFfmpegDllPath = new JTextField(); + private final JTextField fldMediaInfoPath = new JTextField(); // ffmpeg - ffmpegパラメータ private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel(); // ffmpeg - その他 @@ -884,6 +893,7 @@ public class ConfigDialog extends JDialog { */ fldFfmpegPath.setText(p.getFfmpegPath()); fldFfmpegDllPath.setText(p.getFfmpegDllPath()); + fldMediaInfoPath.setText(p.getMediaInfoPath()); /* * ffmpeg - ffmpegパラメータ @@ -990,6 +1000,7 @@ public class ConfigDialog extends JDialog { */ p.setFfmpegPath(fldFfmpegPath.getText()); p.setFfmpegDllPath(fldFfmpegDllPath.getText()); + p.setMediaInfoPath(fldMediaInfoPath.getText()); /* * ffmpeg - ffmpegパラメータ -- 2.11.0