2 package saccubus.properties;
5 import java.util.Properties;
6 import saccubus.converter.profile.FfmpegOption;
12 public class MovieSetting {
14 private static final String PROP_FFMPEG_PATH = "FFnpegPath";
15 private static final String PROP_VHOOK_PATH = "VhookPath";
16 private static final String PROP_OPTION_FILE = "OptionFile";
17 private static final String PROP_CMDLINE_EXT = "CMD_EXT";
18 private static final String PROP_CMDLINE_MAIN = "CMD_MAIN";
19 private static final String PROP_CMDLINE_IN = "CMD_IN";
20 private static final String PROP_CMDLINE_OUT = "CMD_OUT";
21 private final File ffmpeg;
22 private final File vhook;
23 private final File optionFile;
24 private final FfmpegOption ffmpegOption;
26 public MovieSetting(File ffmpeg, File vhook, File optionFile, FfmpegOption ffmpegOption) {
29 this.optionFile = optionFile;
30 this.ffmpegOption = ffmpegOption;
33 public File getFfmpeg() {
37 public File getVhook() {
41 public File getOptionFile() {
45 public FfmpegOption getFfmpegOption() {
49 public void save(Properties prop) {
50 prop.setProperty(PROP_FFMPEG_PATH, getFfmpeg().getPath());
51 prop.setProperty(PROP_VHOOK_PATH, getVhook().getPath());
52 prop.setProperty(PROP_CMDLINE_EXT, getFfmpegOption().getExtOption());
53 prop.setProperty(PROP_CMDLINE_MAIN, getFfmpegOption().getMainOption());
54 prop.setProperty(PROP_CMDLINE_IN, getFfmpegOption().getInOption());
55 prop.setProperty(PROP_CMDLINE_OUT, getFfmpegOption().getOutOption());
56 if (getOptionFile() != null) {
57 prop.setProperty(PROP_OPTION_FILE, getOptionFile().getPath());
59 prop.remove(PROP_OPTION_FILE);
63 public static MovieSetting load(Properties prop) {
64 String name = prop.getProperty(PROP_OPTION_FILE);
65 File optionFile = null;
67 optionFile = new File(name);
70 String ffmpeg = prop.getProperty(PROP_FFMPEG_PATH, ".\\bin\\ffmpeg.exe");
71 String vhook = prop.getProperty(PROP_VHOOK_PATH, ".\\bin\\nicovideo.dll");
72 String ext = prop.getProperty(PROP_CMDLINE_EXT, ".m4v");
73 String main = prop.getProperty(PROP_CMDLINE_MAIN, "");
74 String in = prop.getProperty(PROP_CMDLINE_IN, "");
75 String out = prop.getProperty(PROP_CMDLINE_OUT, "-f ipod -g 150 -qcomp 0.7 -qmin 10 -qmax 51 -qdiff 4 -subq 6 -me_range 16 -i_qfactor 0.714286 -level 13");
76 FfmpegOption opt = new FfmpegOption(ext, main, in, out);
78 return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);