parser.parse(args);
- options.recursive = recursiveParameter.isParameterSpecified();
+ options.setRecursive(recursiveParameter.isParameterSpecified());
- options.deinterlace = deinterlaceParameter.isParameterSpecified();
+ options.setDeinterlace(deinterlaceParameter.isParameterSpecified());
- options.testOnly = testParameter.isParameterSpecified();
+ options.setTestOnly(testParameter.isParameterSpecified());
if (outputFormatParameter.isParameterSpecified())
- options.outputFormats.addAll(outputFormatParameter.getValue());
+ options.getOutputFormats().addAll(outputFormatParameter.getValue());
if (workingDirectoryParameter.isParameterSpecified())
- options.workingDirectory = workingDirectoryParameter.getValue();
+ options.setWorkingDirectory(workingDirectoryParameter.getValue());
if (inputPatternParameter.isParameterSpecified())
- options.inputPatterns.addAll(inputPatternParameter.getValue());
+ options.getInputPatterns().addAll(inputPatternParameter.getValue());
- options.forPortablePlayer = forPortableParameter.isParameterSpecified();
+ options.setForPortablePlayer(forPortableParameter.isParameterSpecified());
if (videoBitrateParameter.isParameterSpecified())
options.setVideoBitrate(videoBitrateParameter.getValue());
// handle directory
for (final File subFile : sourceFile.listFiles())
if (subFile.isDirectory()) {
- if (encodingOptions.recursive)
+ if (encodingOptions.isRecursive())
compileEncodingPlan(subFile);
} else
compileEncodingPlan(subFile);
.getFileExtension(sourceFile);
// encode source file into every desired target format
- for (final String targetFormat : encodingOptions.outputFormats) {
+ for (final String targetFormat : encodingOptions.getOutputFormats()) {
// construct target file
final File targetFile = getTargetFile(sourceFile,
public boolean fileMatchesInputPattern(final File file) {
final String fileName = file.getName().toLowerCase();
- for (final String inputPattern : encodingOptions.inputPatterns)
+ for (final String inputPattern : encodingOptions.getInputPatterns())
if (WildCardMatcher.match(fileName, inputPattern.toLowerCase()))
return true;
encodingPlan = new EncodingPlan();
- compileEncodingPlan(encodingOptions.workingDirectory);
+ compileEncodingPlan(encodingOptions.getWorkingDirectory());
- if (!encodingOptions.testOnly)
+ if (!encodingOptions.isTestOnly())
try {
encodingPlan.execute(encodingOptions);
} catch (final Exception exception) {
// public Bitrate audioBitrate;
- public boolean deinterlace = false;
+ private boolean deinterlace = false;
- public boolean recursive;
+ private boolean recursive;
- public boolean testOnly;
+ private boolean testOnly;
- public boolean forPortablePlayer = false;
+ private boolean forPortablePlayer = false;
- public File workingDirectory = new File(System.getProperty("user.dir"));
+ private File workingDirectory = new File(System.getProperty("user.dir"));
- List<String> outputFormats = new ArrayList<String>();
+ private List<String> outputFormats = new ArrayList<String>();
- List<String> inputPatterns = new ArrayList<String>();
+ private List<String> inputPatterns = new ArrayList<String>();
public BitrateParameter.bitrate getAudioBitrate() {
return audioBitrate;
this.videoBitrate = videoBitrate;
}
+ public List<String> getInputPatterns() {
+ return inputPatterns;
+ }
+
+ public void setInputPatterns(List<String> inputPatterns) {
+ this.inputPatterns = inputPatterns;
+ }
+
+ public List<String> getOutputFormats() {
+ return outputFormats;
+ }
+
+ public void setOutputFormats(List<String> outputFormats) {
+ this.outputFormats = outputFormats;
+ }
+
+ public File getWorkingDirectory() {
+ return workingDirectory;
+ }
+
+ public void setWorkingDirectory(File workingDirectory) {
+ this.workingDirectory = workingDirectory;
+ }
+
+ public boolean isForPortablePlayer() {
+ return forPortablePlayer;
+ }
+
+ public void setForPortablePlayer(boolean forPortablePlayer) {
+ this.forPortablePlayer = forPortablePlayer;
+ }
+
+ public boolean isTestOnly() {
+ return testOnly;
+ }
+
+ public void setTestOnly(boolean testOnly) {
+ this.testOnly = testOnly;
+ }
+
+ public boolean isRecursive() {
+ return recursive;
+ }
+
+ public void setRecursive(boolean recursive) {
+ this.recursive = recursive;
+ }
+
+ public boolean isDeinterlace() {
+ return deinterlace;
+ }
+
+ public void setDeinterlace(boolean deinterlace) {
+ this.deinterlace = deinterlace;
+ }
+
}
if (audioBitrate != -1)
codecParams.append("-b:a " + audioBitrate + "k ");
- if (options.deinterlace)
+ if (options.isDeinterlace())
codecParams.append("-filter:v yadif ");
return codecParams.toString();
if (options.getAudioBitrate() == bitrate.NONE)
audioCodec = null;
- if (options.forPortablePlayer) {
+ if (options.isForPortablePlayer()) {
videoBitrate = 1000;
audioBitrate = 128;
videoCodec = "libxvid";