Changeset 163

Show
Ignore:
Timestamp:
04/14/07 17:11:39 (2 years ago)
Author:
jlee
Message:

JoinVideos? made modular using ConcatenateShit? class. Now everything compiles successfully. There are still a lot of things left to do before useable again:

  • Reimplement DVD in SingleVideo? (=> automatic Matroska/OGM support thanks to KuwaiiRiver?'s code)
  • Add error detection in all Jobs
  • Close ProgressDialog? when done with Jobs and show errors if any

Things I want to do before 18:

  • Implement 2-passes option in SingleVideo? Job/MencoderCommand (should be incredibly easy)
  • Add GUI profile management (Ticket #12)

Yes...I'm happy with the way things are going. 18 will almost be the way this program should have always been.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/org/thestaticvoid/iriverter/ConverterUI.java

    r162 r163  
    768768        } 
    769769         
    770         private JoinVideos newJoinVideos() { 
     770        private void newJoinVideos() { 
    771771                CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); 
    772                 JoinVideos joinVideos = new JoinVideos(tabFolder, SWT.NONE, tabItem); 
    773                 tabItem.setControl(joinVideos); 
    774                 tabFolder.setSelection(tabItem); 
    775                 tabChanged(false); 
    776                  
    777                 return joinVideos; 
     772                JoinVideos joinVideos = null; 
     773                 
     774                boolean canceled = false; 
     775                while (!canceled) 
     776                        try { 
     777                                joinVideos = new JoinVideos(tabFolder, SWT.NONE, tabItem, MPlayerInfo.getMPlayerPath());  
     778                                tabItem.setControl(joinVideos); 
     779                                tabFolder.setSelection(tabItem); 
     780                                tabChanged(false); 
     781                                canceled = true; 
     782                        } catch (MPlayerNotFoundException mpe) { 
     783                                canceled = new MPlayerPathDialog(shell).open(); 
     784                        } catch (Exception e) { 
     785                                tabItem.dispose(); 
     786                                canceled = true; 
     787                        } 
    778788        } 
    779789         
  • trunk/src/org/thestaticvoid/iriverter/JoinVideos.java

    r157 r163  
    3131import org.eclipse.swt.layout.*; 
    3232 
    33 public class JoinVideos extends Composite implements SelectionListener, TabItemControl, JoinVideosInfo {       
     33public class JoinVideos extends Composite implements SelectionListener, TabItemControl, Job {  
    3434        private CTabItem tabItem; 
    3535        private java.util.List inputVideos; 
     
    3737        private Button up, add, remove, down, outputVideoSelect; 
    3838        private Text outputVideoInput; 
    39         private String syncOutputVideo
    40          
    41         public JoinVideos(Composite parent, int style, CTabItem tabItem) { 
     39        private String syncOutputVideo, mplayerPath
     40         
     41        public JoinVideos(Composite parent, int style, CTabItem tabItem, String mplayerPath) { 
    4242                super(parent, style); 
    4343                this.tabItem = tabItem; 
     44                this.mplayerPath = mplayerPath; 
    4445                inputVideos = new java.util.ArrayList(); 
    4546                 
     
    241242        } 
    242243         
    243         public synchronized String getOutputVideo() { 
     244        public String getOutputVideo() { 
    244245                Display.getDefault().syncExec(new Runnable() { 
    245246                        public void run() { 
     
    251252        } 
    252253         
    253         public synchronized void setOutputVideo(String outputVideo) { 
     254        public void setOutputVideo(String outputVideo) { 
    254255                syncOutputVideo = outputVideo; 
    255256                 
     
    260261                }); 
    261262        } 
     263         
     264        public String getDescription() { 
     265                return "Joining videos into " + new File(getOutputVideo()).getName(); 
     266        } 
     267         
     268        public ShitToDo[] getShitToDo() { 
     269                java.util.List shitToDo = new java.util.ArrayList(); 
     270                 
     271                File tempFile;           
     272                try { 
     273                        tempFile = File.createTempFile("iriverter-", ".avi"); 
     274                        tempFile.deleteOnExit(); 
     275                } catch (IOException io) { 
     276                        Logger.logException(io); 
     277                        return new ShitToDo[]{}; 
     278                } 
     279                 
     280                shitToDo.add(new ConcatenateShit("Concatenating videos to a temporary file...", getInputVideos(), tempFile.toString())); 
     281                shitToDo.add(new MencoderShit("Writing header...", new MencoderCommand(new String[]{mplayerPath + MPlayerInfo.MENCODER_BIN, "-forceidx", "-ovc", "copy", "-oac", "copy"}, new InputVideo(tempFile.toString()), getOutputVideo()))); 
     282                 
     283                return (ShitToDo[]) shitToDo.toArray(new ShitToDo[]{}); 
     284        } 
    262285} 
  • trunk/src/org/thestaticvoid/iriverter/MPlayerInfo.java

    r161 r163  
    3333        private Process proc; 
    3434        private StringBuffer mplayerOutput; 
    35         private boolean commandFound = true; 
    3635         
    3736        public MPlayerInfo(InputVideo inputVideo) throws MPlayerNotFoundException { 
  • trunk/src/org/thestaticvoid/iriverter/MencoderShit.java

    r161 r163  
    4545                 
    4646                progressDialogInfo.setSubdescription(description); 
     47                progressDialogInfo.setMiscellaneous1(""); 
     48                progressDialogInfo.setMiscellaneous2(""); 
    4749                 
    4850                try { 
     
    9294                                // This should never happen 
    9395                                e.printStackTrace(); 
     96                                throw new FailedToDoSomeShit(description); 
    9497                        }                        
    9598                }