Changeset 114
- Timestamp:
- 12/12/06 18:31:29 (2 years ago)
- Files:
-
- trunk/src/org/thestaticvoid/iriverter/AudioSyncDialog.java (modified) (5 diffs)
- trunk/src/org/thestaticvoid/iriverter/AutomaticallySplitDialog.java (modified) (6 diffs)
- trunk/src/org/thestaticvoid/iriverter/Bitrate.java (deleted)
- trunk/src/org/thestaticvoid/iriverter/BitrateDialog.java (modified) (6 diffs)
- trunk/src/org/thestaticvoid/iriverter/Converter.java (modified) (7 diffs)
- trunk/src/org/thestaticvoid/iriverter/ConverterOptions.java (modified) (11 diffs)
- trunk/src/org/thestaticvoid/iriverter/ConverterUI.java (modified) (6 diffs)
- trunk/src/org/thestaticvoid/iriverter/DVD.java (modified) (2 diffs)
- trunk/src/org/thestaticvoid/iriverter/DVDInfoReader.java (modified) (2 diffs)
- trunk/src/org/thestaticvoid/iriverter/MPlayerInfo.java (modified) (3 diffs)
- trunk/src/org/thestaticvoid/iriverter/MPlayerNotFoundException.java (added)
- trunk/src/org/thestaticvoid/iriverter/MPlayerPathDialog.java (added)
- trunk/src/org/thestaticvoid/iriverter/ManualSplit.java (modified) (1 diff)
- trunk/src/org/thestaticvoid/iriverter/ProgressDialog.java (modified) (3 diffs)
- trunk/src/org/thestaticvoid/iriverter/VolumeDialog.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/org/thestaticvoid/iriverter/AudioSyncDialog.java
r32 r114 12 12 private Label bringAudioLabel, millisecondsLabel, videoLabel; 13 13 private Spinner delayInput; 14 private Button autoSync, before, after, dismiss;14 private Button autoSync, before, after, cancel, ok; 15 15 16 public static final int AUTO_SYNC = Integer.MAX_VALUE; 17 18 public AudioSyncDialog(Shell parent, int style, int delay) { 16 public AudioSyncDialog(Shell parent, int style) { 19 17 super(parent, style); 20 this.delay = delay;18 delay = ConverterOptions.getAudioDelay(); 21 19 } 22 20 23 public intopen() {21 public void open() { 24 22 shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 25 23 shell.setText("Audio Sync"); … … 43 41 autoSync = new Button(shell, SWT.CHECK); 44 42 autoSync.setText("Automatically Sync"); 45 autoSync.setSelection( delay == AUTO_SYNC);43 autoSync.setSelection(ConverterOptions.getAutoSync()); 46 44 gridData = new GridData(); 47 45 gridData.horizontalSpan = 5; … … 74 72 videoLabel.setText("video"); 75 73 76 dismiss = new Button(shell, SWT.PUSH);77 dismiss .setText("Close");74 Composite dismissComposite = new Composite(shell, SWT.NONE); 75 dismissComposite.setLayout(new RowLayout()); 78 76 gridData = new GridData(); 79 gridData.widthHint = 75;80 77 gridData.horizontalSpan = 5; 81 78 gridData.horizontalAlignment = SWT.RIGHT; 82 dismiss.setLayoutData(gridData); 83 dismiss.addSelectionListener(this); 79 dismissComposite.setLayoutData(gridData); 80 81 cancel = new Button(dismissComposite, SWT.PUSH); 82 cancel.setText("Cancel"); 83 RowData rowData = new RowData(); 84 rowData.width = 75; 85 cancel.setLayoutData(rowData); 86 cancel.addSelectionListener(this); 87 88 ok = new Button(dismissComposite, SWT.PUSH); 89 ok.setText("OK"); 90 rowData = new RowData(); 91 rowData.width = 75; 92 ok.setLayoutData(rowData); 93 ok.addSelectionListener(this); 84 94 85 95 if (autoSync.getSelection()) { … … 94 104 while (!shell.isDisposed()) 95 105 if (!getParent().getDisplay().readAndDispatch()) 96 getParent().getDisplay().sleep(); 97 98 return delay; 106 getParent().getDisplay().sleep(); 99 107 } 100 108 … … 103 111 } 104 112 105 public void widgetSelected(SelectionEvent e) { 106 if (e.getSource() == dismiss) { 107 try { 108 if (autoSync.getSelection()) { 109 delay = AUTO_SYNC; 110 shell.dispose(); 111 } 112 113 public void widgetSelected(SelectionEvent e) { 114 if (e.getSource() == autoSync) 115 toggleSelection(); 116 117 if (e.getSource() == cancel) 118 shell.dispose(); 119 120 if (e.getSource() == ok) { 121 if (autoSync.getSelection()) { 122 ConverterOptions.setAutoSync(true); 123 ConverterOptions.setAudioDelay(0); 124 } else { 113 125 delay = delayInput.getSelection(); 114 115 126 if (before.getSelection()) 116 127 delay = -delay; 117 } catch (Exception exception) { 118 return; 128 129 ConverterOptions.setAutoSync(false); 130 ConverterOptions.setAudioDelay(delay); 119 131 } 120 132 121 133 shell.dispose(); 122 134 } 123 124 if (e.getSource() == autoSync)125 toggleSelection();126 135 } 127 136 trunk/src/org/thestaticvoid/iriverter/AutomaticallySplitDialog.java
r32 r114 9 9 public class AutomaticallySplitDialog extends Dialog implements SelectionListener { 10 10 private Shell shell; 11 private boolean autoSplit;12 private int splitTime;13 11 private Label splitVideoEveryLabel, minutesLabel; 14 12 private Spinner splitTimeInput; 15 private Button automaticallySplit, dismiss;13 private Button automaticallySplit, cancel, ok; 16 14 17 public static final int NO_SPLIT = Integer.MAX_VALUE; 18 19 public AutomaticallySplitDialog(Shell parent, int style, boolean autoSplit, int delay) { 15 public AutomaticallySplitDialog(Shell parent, int style) { 20 16 super(parent, style); 21 this.autoSplit = autoSplit;22 this.splitTime = delay;23 17 } 24 18 25 public intopen() {19 public void open() { 26 20 shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 27 21 shell.setText("Automatically Split"); … … 45 39 automaticallySplit = new Button(shell, SWT.CHECK); 46 40 automaticallySplit.setText("Automatically Split"); 47 automaticallySplit.setSelection( autoSplit);41 automaticallySplit.setSelection(ConverterOptions.getAutoSplit()); 48 42 gridData = new GridData(); 49 43 gridData.horizontalSpan = 3; … … 55 49 56 50 splitTimeInput = new Spinner(shell, SWT.BORDER); 57 splitTimeInput.setSelection(Math.abs( splitTime));51 splitTimeInput.setSelection(Math.abs(ConverterOptions.getSplitTime())); 58 52 splitTimeInput.setMinimum(0); 59 53 … … 61 55 minutesLabel.setText("minutes"); 62 56 63 dismiss = new Button(shell, SWT.PUSH);64 dismiss .setText("Close");57 Composite dismissComposite = new Composite(shell, SWT.NONE); 58 dismissComposite.setLayout(new RowLayout()); 65 59 gridData = new GridData(); 66 gridData.widthHint = 75;67 60 gridData.horizontalSpan = 3; 68 61 gridData.horizontalAlignment = SWT.RIGHT; 69 dismiss.setLayoutData(gridData); 70 dismiss.addSelectionListener(this); 62 dismissComposite.setLayoutData(gridData); 63 64 cancel = new Button(dismissComposite, SWT.PUSH); 65 cancel.setText("Cancel"); 66 RowData rowData = new RowData(); 67 rowData.width = 75; 68 cancel.setLayoutData(rowData); 69 cancel.addSelectionListener(this); 70 71 ok = new Button(dismissComposite, SWT.PUSH); 72 ok.setText("OK"); 73 rowData = new RowData(); 74 rowData.width = 75; 75 ok.setLayoutData(rowData); 76 ok.addSelectionListener(this); 71 77 72 78 if (!automaticallySplit.getSelection()) … … 77 83 while (!shell.isDisposed()) 78 84 if (!getParent().getDisplay().readAndDispatch()) 79 getParent().getDisplay().sleep(); 80 81 return splitTime; 85 getParent().getDisplay().sleep(); 82 86 } 83 87 … … 86 90 } 87 91 88 public void widgetSelected(SelectionEvent e) { 89 if (e.getSource() == dismiss) { 90 if (!automaticallySplit.getSelection()) 91 splitTime = NO_SPLIT; 92 else 93 splitTime = splitTimeInput.getSelection(); 94 92 public void widgetSelected(SelectionEvent e) { 93 if (e.getSource() == automaticallySplit) 94 toggleSelection(); 95 96 if (e.getSource() == cancel) 97 shell.dispose(); 98 99 if (e.getSource() == ok) { 100 ConverterOptions.setAutoSplit(automaticallySplit.getSelection()); 101 ConverterOptions.setSplitTime(splitTimeInput.getSelection()); 95 102 shell.dispose(); 96 103 } 97 98 if (e.getSource() == automaticallySplit)99 toggleSelection();100 104 } 101 105 trunk/src/org/thestaticvoid/iriverter/BitrateDialog.java
r83 r114 9 9 public class BitrateDialog extends Dialog implements SelectionListener { 10 10 private Shell shell; 11 private Bitrate maxBitrate, currentBitrate;12 11 private int currentVideoBitrate, currentAudioBitrate; 13 12 private Scale videoBitrateScale, audioBitrateScale; 14 13 private Label currentVideoBitrateLabel, currentAudioBitrateLabel; 15 private Button dismiss;14 private Button cancel, ok; 16 15 17 public BitrateDialog(Shell parent, int style , Bitrate maxBitrate, Bitrate currentBitrate) {16 public BitrateDialog(Shell parent, int style) { 18 17 super(parent, style); 19 this.maxBitrate = maxBitrate; 20 this.currentBitrate = currentBitrate; 21 currentVideoBitrate = currentBitrate.getVideo(); 22 currentAudioBitrate = currentBitrate.getAudio(); 18 currentVideoBitrate = ConverterOptions.getVideoBitrate(); 19 currentAudioBitrate = ConverterOptions.getAudioBitrate(); 23 20 } 24 21 25 public Bitrateopen() {22 public void open() { 26 23 shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 27 24 shell.setText("Bitrate"); … … 48 45 videoBitrateScale = new Scale(shell, SWT.HORIZONTAL); 49 46 videoBitrateScale.setMinimum(50); 50 videoBitrateScale.setMaximum( maxBitrate.getVideo() / 2);47 videoBitrateScale.setMaximum(ConverterOptions.getCurrentProfile().getMaxVideoBitrate() / 2); 51 48 videoBitrateScale.setSelection(currentVideoBitrate / 2); 52 49 videoBitrateScale.setPageIncrement(25); … … 62 59 audioBitrateScale = new Scale(shell, SWT.HORIZONTAL); 63 60 audioBitrateScale.setMinimum(2); 64 audioBitrateScale.setMaximum( maxBitrate.getAudio() / 16);61 audioBitrateScale.setMaximum(ConverterOptions.getCurrentProfile().getMaxAudioBitrate() / 16); 65 62 audioBitrateScale.setSelection(currentAudioBitrate / 16); 66 63 audioBitrateScale.setPageIncrement(1); … … 71 68 currentAudioBitrateLabel.setText(currentAudioBitrate + " Kbps"); 72 69 73 dismiss = new Button(shell, SWT.PUSH);74 dismiss .setText("Close");70 Composite dismissComposite = new Composite(shell, SWT.NONE); 71 dismissComposite.setLayout(new RowLayout()); 75 72 gridData = new GridData(); 76 gridData.widthHint = 75;77 73 gridData.horizontalSpan = 3; 78 74 gridData.horizontalAlignment = SWT.RIGHT; 79 dismiss.setLayoutData(gridData); 80 dismiss.addSelectionListener(this); 75 dismissComposite.setLayoutData(gridData); 76 77 cancel = new Button(dismissComposite, SWT.PUSH); 78 cancel.setText("Cancel"); 79 RowData rowData = new RowData(); 80 rowData.width = 75; 81 cancel.setLayoutData(rowData); 82 cancel.addSelectionListener(this); 83 84 ok = new Button(dismissComposite, SWT.PUSH); 85 ok.setText("OK"); 86 rowData = new RowData(); 87 rowData.width = 75; 88 ok.setLayoutData(rowData); 89 ok.addSelectionListener(this); 81 90 82 91 shell.pack(); … … 86 95 while (!shell.isDisposed()) 87 96 if (!getParent().getDisplay().readAndDispatch()) 88 getParent().getDisplay().sleep(); 89 90 return new Bitrate(currentVideoBitrate, currentAudioBitrate); 97 getParent().getDisplay().sleep(); 91 98 } 92 99 … … 108 115 } 109 116 110 if (e.getSource() == dismiss)117 if (e.getSource() == cancel) 111 118 shell.dispose(); 119 120 if (e.getSource() == ok) { 121 ConverterOptions.setVideoBitrate(currentVideoBitrate); 122 ConverterOptions.setAudioBitrate(currentAudioBitrate); 123 shell.dispose(); 124 } 112 125 } 113 126 } trunk/src/org/thestaticvoid/iriverter/Converter.java
r107 r114 7 7 private List jobs, notSplitVideos; 8 8 private ProgressDialogInfo progressDialogInfo; 9 private String mplayerPath; 9 10 private Process proc; 10 11 private boolean isCanceled; 11 12 private int exitCode; 12 13 13 public Converter(List jobs, ProgressDialogInfo progressDialogInfo ) {14 public Converter(List jobs, ProgressDialogInfo progressDialogInfo, String mplayerPath) { 14 15 this.jobs = Converter.checkForOverwritingFiles(Converter.expandSingleJobsToMultiple(Converter.removeInvalidJobs(jobs))); 15 16 this.progressDialogInfo = progressDialogInfo; 17 this.mplayerPath = mplayerPath; 16 18 isCanceled = false; 17 19 … … 175 177 List commandList = new ArrayList(); 176 178 177 commandList.add( MPlayerInfo.getMPlayerPath()+ "mencoder");179 commandList.add(mplayerPath + "mencoder"); 178 180 179 181 commandList.add(inputVideo); … … 233 235 commandList.add("harddup"); 234 236 235 if (ConverterOptions.getVolumeFilter() == VolumeFilter.VOLNORM) {237 if (ConverterOptions.getVolumeFilter().equals("volnorm")) { 236 238 commandList.add("-af"); 237 239 commandList.add("volnorm"); 238 } else if (ConverterOptions.getVolumeFilter() == VolumeFilter.VOLUME) {240 } else if (ConverterOptions.getVolumeFilter().equals("volume")) { 239 241 commandList.add("-af"); 240 242 commandList.add("volume=" + ConverterOptions.getGain()); … … 261 263 progressDialogInfo.setStatus("Gathering information about the input video..."); 262 264 263 MPlayerInfo info = new MPlayerInfo(singleVideoInfo.getInputVideo() );265 MPlayerInfo info = new MPlayerInfo(singleVideoInfo.getInputVideo(), mplayerPath); 264 266 if (!info.videoSupported()) { 265 267 Logger.logMessage("Unsupported video", Logger.ERROR); … … 340 342 341 343 if (manualSplitInfo.getMarks()[0].getTime() == Mark.START_MARK) 342 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-endpos", "" + manualSplitInfo.getMarks()[1].getTime()});344 runConversionCommand(new String[]{mplayerPath + "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-endpos", "" + manualSplitInfo.getMarks()[1].getTime()}); 343 345 else if (manualSplitInfo.getMarks()[1].getTime() == Mark.END_MARK) 344 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + manualSplitInfo.getMarks()[0].getTime()});346 runConversionCommand(new String[]{mplayerPath + "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + manualSplitInfo.getMarks()[0].getTime()}); 345 347 else 346 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + manualSplitInfo.getMarks()[0].getTime(), "-endpos", "" + (manualSplitInfo.getMarks()[1].getTime() - manualSplitInfo.getMarks()[0].getTime())});348 runConversionCommand(new String[]{mplayerPath + "mencoder", manualSplitInfo.getVideo(), "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + manualSplitInfo.getMarks()[0].getTime(), "-endpos", "" + (manualSplitInfo.getMarks()[1].getTime() - manualSplitInfo.getMarks()[0].getTime())}); 347 349 } 348 350 … … 390 392 progressDialogInfo.setOutputVideo(new File(joinVideosInfo.getOutputVideo()).getName()); 391 393 progressDialogInfo.setStatus("Writing header"); 392 splitVideo(joinVideosInfo.getOutputVideo(), runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", "-forceidx", tempFile.toString(), "-o", joinVideosInfo.getOutputVideo(), "-ovc", "copy", "-oac", "copy"}));394 splitVideo(joinVideosInfo.getOutputVideo(), runConversionCommand(new String[]{mplayerPath + "mencoder", "-forceidx", tempFile.toString(), "-o", joinVideosInfo.getOutputVideo(), "-ovc", "copy", "-oac", "copy"})); 393 395 } 394 396 } catch (IOException e) { … … 444 446 445 447 if ((i + 1) == 1) 446 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-endpos", "" + (length / pieces)});448 runConversionCommand(new String[]{mplayerPath + "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-endpos", "" + (length / pieces)}); 447 449 else if ((i + 1) == pieces) 448 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + (length / pieces) * i});450 runConversionCommand(new String[]{mplayerPath + "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + (length / pieces) * i}); 449 451 else 450 runConversionCommand(new String[]{ MPlayerInfo.getMPlayerPath()+ "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + (length / pieces) * i, "-endpos", "" + (length / pieces)});452 runConversionCommand(new String[]{mplayerPath + "mencoder", inputVideo, "-o", outputVideo, "-ovc", "copy", "-oac", "copy", "-ss", "" + (length / pieces) * i, "-endpos", "" + (length / pieces)}); 451 453 } 452 454 } trunk/src/org/thestaticvoid/iriverter/ConverterOptions.java
r102 r114 28 28 } 29 29 30 p ublicstatic void writeOption(String option, String setting) {30 private static void writeOption(String option, String setting) { 31 31 try { 32 32 Logger.logMessage("Setting: " + option + "=" + setting, Logger.INFO); … … 62 62 } 63 63 64 p ublicstatic String readOption(String option) {64 private static String readOption(String option) { 65 65 String returnSetting = ""; 66 66 … … 107 107 } 108 108 109 public static void setPanAndScan(boolean panAndScan) { 110 writeOption("panAndScan", "" + panAndScan); 111 } 112 109 113 public static int getVideoBitrate() { 110 114 String videoBitrate = readOption("videoBitrate"); … … 115 119 } 116 120 121 public static void setVideoBitrate(int videoBitrate) { 122 writeOption("videoBitrate", "" + videoBitrate); 123 } 124 117 125 public static int getAudioBitrate() { 118 126 String audioBitrate = readOption("audioBitrate"); … … 122 130 return Integer.parseInt(audioBitrate); 123 131 } 132 133 public static void setAudioBitrate(int audioBitrate) { 134 writeOption("audioBitrate", "" + audioBitrate); 135 } 124 136 125 137 public static Dimensions getDimensions() { … … 131 143 } 132 144 145 public static void setDimensions(Dimensions dimensions) { 146 writeOption("dimensions", "" + dimensions); 147 } 148 133 149 public static boolean getAutoSync() { 134 150 String autoSync = readOption("autoSync"); … … 139 155 } 140 156 157 public static void setAutoSync(boolean autoSync) { 158 writeOption("autoSync", "" + autoSync); 159 } 160 141 161 public static int getAudioDelay() { 142 162 String audioDelay = readOption("audioDelay"); … … 147 167 } 148 168 169 public static void setAudioDelay(int audioDelay) { 170 writeOption("audioDelay", "" + audioDelay); 171 } 172 149 173 public static boolean getAutoSplit() { 150 174 String autoSplit = readOption("autoSplit"); … … 155 179 } 156 180 181 public static void setAutoSplit(boolean autoSplit) { 182 writeOption("autoSplit", "" + autoSplit); 183 } 184 157 185 public static int getSplitTime() { 158 186 String splitTime = readOption("splitTime"); … … 163 191 } 164 192 165 public static int getVolumeFilter() { 193 public static void setSplitTime(int splitTime) { 194 writeOption("splitTime", "" + splitTime); 195 } 196 197 public static String getVolumeFilter() { 166 198 String volumeFilter = readOption("volumeFilter"); 167 if (volumeFilter.equals("") || volumeFilter.equals("none")) 168 return VolumeFilter.NONE; 169 else if (volumeFilter.equals("volnorm")) 170 return VolumeFilter.VOLNORM; 171 172 return VolumeFilter.VOLUME; 199 if (volumeFilter.equals("")) 200 return "none"; 201 202 return volumeFilter; 203 } 204 205 public static void setVolumeFilter(String volumeFilter) { 206 writeOption("volumeFilter", volumeFilter); 173 207 } 174 208 … … 180 214 return Double.parseDouble(gain); 181 215 } 216 217 public static void setGain(double gain) { 218 writeOption("gain", "" + gain); 219 } 220 221 public static String getMPlayerSource() { 222 String mplayerSource = readOption("mplayerSource"); 223 if (mplayerSource.equals("")) 224 if (System.getProperty("os.name").indexOf("Windows") >= 0) 225 return "download"; 226 else 227 return "local"; 228 229 return mplayerSource; 230 } 231 232 public static void setMPlayerSource(String mplayerSource) { 233 writeOption("mplayerSource", mplayerSource); 234 } 235 236 public static boolean getDownloadExtraCodecs() { 237 String downloadExtraCodecs = readOption("downloadExtraCodecs"); 238 if (downloadExtraCodecs.equals("")) 239 return false; 240 241 return downloadExtraCodecs.equals("true"); 242 } 243 244 public static void setDownloadExtraCodecs(boolean downloadExtraCodecs) { 245 writeOption("downloadExtraCodecs", "" + downloadExtraCodecs); 246 } 247 248 public static String getMPlayerPath() { 249 String mplayerPath = readOption("mplayerPath"); 250 if (mplayerPath.equals("") || !new File(mplayerPath).isDirectory()) 251 return "."; 252 253 return mplayerPath; 254 } 255 256 public static void setMPlayerPath(String mplayerPath) { 257 writeOption("mplayerPath", mplayerPath); 258 } 182 259 } trunk/src/org/thestaticvoid/iriverter/ConverterUI.java
r102 r114 18 18 private CTabFolder tabFolder; 19 19 private Map profileMenuItems, dimensionsMenuItems; 20 private MenuItem convert, playFile, newSingleVideo, newDirectory, newDVD, advancedJobs, manualSplit, joinVideos, moveUp, moveDown, closeJob, closeAllJobs, quit, bitrate, videoSize, panAndScan, advancedOptions, audioSync, automaticallySplit, volume, contents, logViewer, about;20 private MenuItem convert, playFile, newSingleVideo, newDirectory, newDVD, advancedJobs, manualSplit, joinVideos, moveUp, moveDown, closeJob, closeAllJobs, quit, bitrate, videoSize, panAndScan, advancedOptions, audioSync, automaticallySplit, volume, mplayerPath, contents, logViewer, about; 21 21 private Menu videoSizeMenu; 22 22 private DropTarget target; … … 250 250 volume.setText("&Volume..."); 251 251 volume.addSelectionListener(this); 252 253 mplayerPath = new MenuItem(advancedOptionsMenu, SWT.PUSH); 254 mplayerPath.setText("&MPlayer Path..."); 255 mplayerPath.addSelectionListener(this); 252 256 253 257 MenuItem help = new MenuItem(menu, SWT.CASCADE); … … 321 325 322 326 progressDialog = new ProgressDialog(shell, SWT.NONE); 323 Converter converter = new Converter(jobs, progressDialog); 324 converter.start(); 325 progressDialog.open(); 326 converter.cancel(); 327 328 boolean canceled = false; 329 while (!canceled) 330 try { 331 Converter converter = new Converter(jobs, progressDialog, MPlayerInfo.getMPlayerPath()); 332 converter.start(); 333 progressDialog.open(); 334 converter.cancel(); 335 } catch (MPlayerNotFoundException mpe) { 336 canceled = new MPlayerPathDialog(shell, SWT.NONE).open(); 337 } 327 338 } 328 339 … … 339 350 } catch (IOException io) { 340 351 io.printStackTrace(); 352 } catch (MPlayerNotFoundException mpe) { 353 MPlayerPathDialog dialog = new MPlayerPathDialog(shell, SWT.NONE); 354 dialog.open(); 341 355 } 342 356 } … … 423 437 } 424 438 425 if (e.getSource() == bitrate) { 426 BitrateDialog bitrateDialog = new BitrateDialog(shell, SWT.NONE, new Bitrate(ConverterOptions.getCurrentProfile().getMaxVideoBitrate(), ConverterOptions.getCurrentProfile().getMaxAudioBitrate()), new Bitrate(ConverterOptions.getVideoBitrate(), ConverterOptions.getAudioBitrate())); 427 Bitrate newBitrate = bitrateDialog.open(); 428 ConverterOptions.writeOption("videoBitrate", "" + newBitrate.getVideo()); 429 ConverterOptions.writeOption("audioBitrate", "" + newBitrate.getAudio()); 430 } 439 if (e.getSource() == bitrate) 440 new BitrateDialog(shell, SWT.NONE).open(); 431 441 432 442 if (dimensionsMenuItems.containsKey(e.getSource())) { … … 435 445 436 446 if (e.getSource() == panAndScan) 437 ConverterOptions.writeOption("panAndScan", "" + panAndScan.getSelection()); 438 439 if (e.getSource() == audioSync) { 440 int audioDelay = new AudioSyncDialog(shell, SWT.NONE, (ConverterOptions.getAutoSync()) ? AudioSyncDialog.AUTO_SYNC : ConverterOptions.getAudioDelay()).open(); 441 442 if (audioDelay == AudioSyncDialog.AUTO_SYNC) { 443 ConverterOptions.writeOption("autoSync", "true"); 444 ConverterOptions.writeOption("audioDelay", "0"); 445 } else { 446 ConverterOptions.writeOption("autoSync", "false"); 447 ConverterOptions.writeOption("audioDelay", "" + audioDelay); 448 } 449 } 450 451 if (e.getSource() == automaticallySplit) { 452 int splitTime = new AutomaticallySplitDialog(shell, SWT.NONE, ConverterOptions.getAutoSplit(), ConverterOptions.getSplitTime()).open(); 453 454 if (splitTime == AutomaticallySplitDialog.NO_SPLIT) 455 ConverterOptions.writeOption("autoSplit", "false"); 456 else { 457 ConverterOptions.writeOption("autoSplit", "true"); 458 ConverterOptions.writeOption("splitTime", "" + splitTime); 459 } 460 } 461 462 if (e.getSource() == volume) { 463 double volume = new VolumeDialog(shell, SWT.NONE, ConverterOptions.getVolumeFilter(), ConverterOptions.getGain()).open(); 464 465 if (volume == VolumeDialog.NONE) 466 ConverterOptions.writeOption("volumeFilter", "none"); 467 else if (volume == VolumeDialog.VOLNORM) 468 ConverterOptions.writeOption("volumeFilter", "volnorm"); 469 else { 470 ConverterOptions.writeOption("volumeFilter", "volume"); 471 ConverterOptions.writeOption("gain", "" + volume); 472 } 447 ConverterOptions.setPanAndScan(panAndScan.getSelection()); 448 449 if (e.getSource() == audioSync) 450 new AudioSyncDialog(shell, SWT.NONE).open(); 451 452 if (e.getSource() == automaticallySplit) 453 new AutomaticallySplitDialog(shell, SWT.NONE).open(); 454 455 456 if (e.getSource() == volume) 457 new VolumeDialog(shell, SWT.NONE).open(); 458 459 if (e.getSource() == mplayerPath) { 460 new MPlayerPathDialog(shell, SWT.NONE).open(); 473 461 } 474 462 trunk/src/org/thestaticvoid/iriverter/DVD.java
r102 r114 195 195 if (e.getSource() == previewButton) { 196 196 if (!getDrive().equals("")) { 197 try { 198 java.util.List commandList = new ArrayList(); 199 commandList.add(MPlayerInfo.getMPlayerPath() + "mplayer"); 200 commandList.add("-dvd-device"); 201 commandList.add(getDrive()); 202 commandList.add("dvd://" + getTitle()); 203 204 if (getAudioStream() > -1) { 205 commandList.add("-aid"); 206 commandList.add("" + getAudioStream()); 197 boolean canceled = false; 198 while (!canceled) 199 try { 200 java.util.List commandList = new ArrayList(); 201 commandList.add(MPlayerInfo.getMPlayerPath() + "mplayer"); 202 commandList.add("-dvd-device"); 203 commandList.add(getDrive()); 204 commandList.add("dvd://" + getTitle()); 205 206 if (getAudioStream() > -1) { 207 commandList.add("-aid"); 208 commandList.add("" + getAudioStream()); 209 } 210 211 if (getSubtitles() > -1) { 212 commandList.add("-sid"); 213 commandList.add("" + getSubtitles()); 214 } 215 216 String commandStr = ""; 217 String[] command = new String[commandList.size()]; 218 for (int i = 0; i < command.length; i++) { 219 command[i] = (String) commandList.get(i); 220 commandStr += command[i] + " "; 221 } 222 Logger.logMessage(commandStr, Logger.INFO); 223 224 proc = Runtime.getRuntime().exec(command); 225 } catch (IOException io) { 226 io.printStackTrace(); 227 canceled = true; 228 } catch (MPlayerNotFoundException mpe) { 229 canceled = new MPlayerPathDialog(getParent().getShell(), SWT.NONE).open(); 207 230 }
