public OneClickPostProcessor(MainForm mainForm, D2VIndexJob ijob)
 {
     this.job = ijob;
     this.mainForm = mainForm;
     this.jobUtil = mainForm.JobUtil;
     this.vUtil = new VideoUtil(mainForm);
 }
Beispiel #2
0
        private static LogItem postprocess(MainForm mainForm, Job ajob)
        {
            if (!(ajob is D2VIndexJob))
            {
                return(null);
            }
            D2VIndexJob job = (D2VIndexJob)ajob;

            StringBuilder            logBuilder       = new StringBuilder();
            VideoUtil                vUtil            = new VideoUtil(mainForm);
            List <string>            arrFilesToDelete = new List <string>();
            Dictionary <int, string> audioFiles       = vUtil.getAllDemuxedAudio(job.AudioTracks, new List <AudioTrackInfo>(), out arrFilesToDelete, job.Output, null);

            if (job.LoadSources)
            {
                if (job.DemuxMode != 0 && audioFiles.Count > 0)
                {
                    string[] files = new string[audioFiles.Values.Count];
                    audioFiles.Values.CopyTo(files, 0);
                    Util.ThreadSafeRun(mainForm, new MethodInvoker(
                                           delegate
                    {
                        mainForm.Audio.openAudioFile(files);
                    }));
                }
                // if the above needed delegation for openAudioFile this needs it for openVideoFile?
                // It seems to fix the problem of ASW dissapearing as soon as it appears on a system (Vista X64)
                Util.ThreadSafeRun(mainForm, new MethodInvoker(
                                       delegate
                {
                    AviSynthWindow asw = new AviSynthWindow(mainForm, job.Output);
                    asw.OpenScript    += new OpenScriptCallback(mainForm.Video.openVideoFile);
                    asw.Show();
                }));
            }

            return(null);
        }
        private void goButton_Click(object sender, EventArgs e)
        {
            if (Drives.ableToWriteOnThisDrive(Path.GetPathRoot(output.Filename)) || // check whether the output path is read-only
                Drives.ableToWriteOnThisDrive(Path.GetPathRoot(workingName.Text)))
            {
                if ((verifyAudioSettings() == null)
                    && (VideoSettings != null)
                    && !string.IsNullOrEmpty(input.Filename)
                    && !string.IsNullOrEmpty(workingName.Text))
                {
                    FileSize? desiredSize = optionalTargetSizeBox1.Value;

                    List<AudioJob> aJobs = new List<AudioJob>();
                    List<MuxStream> muxOnlyAudio = new List<MuxStream>();
                    List<AudioTrackInfo> audioTracks = new List<AudioTrackInfo>();
                    for (int i = 0; i < audioConfigControl.Count; ++i)
                    {
                        if (audioTrack[i].SelectedIndex == 0) // "None"
                            continue;

                        string aInput;
                        TrackInfo info = null;
                        int delay = audioConfigControl[i].Delay;
                        if (audioTrack[i].SelectedSCItem.IsStandard)
                        {
                            AudioTrackInfo a = (AudioTrackInfo)audioTrack[i].SelectedObject;
                            audioTracks.Add(a);
                            aInput = "::" + a.TrackID + "::";
                            info = a.TrackInfo;
                        }
                        else
                            aInput = audioTrack[i].SelectedText;

                        if (audioConfigControl[i].DontEncode)
                            muxOnlyAudio.Add(new MuxStream(aInput, info, delay));
                        else
                            aJobs.Add(new AudioJob(aInput, null, null, audioConfigControl[i].Settings, delay));
                    }

                    string d2vName = Path.Combine(workingDirectory.Filename, workingName.Text + ".d2v");

                    DGIndexPostprocessingProperties dpp = new DGIndexPostprocessingProperties();
                    dpp.DAR = ar.Value;
                    dpp.DirectMuxAudio = muxOnlyAudio.ToArray();
                    dpp.AudioJobs = aJobs.ToArray();
                    dpp.AutoDeinterlace = autoDeint.Checked;
                    dpp.AvsSettings = (AviSynthSettings)avsProfile.SelectedProfile.BaseSettings;
                    dpp.ChapterFile = chapterFile.Filename;
                    dpp.Container = (ContainerType)containerFormat.SelectedItem;
                    dpp.FinalOutput = output.Filename;
                    dpp.HorizontalOutputResolution = (int)horizontalResolution.Value;
                    dpp.OutputSize = desiredSize;
                    dpp.SignalAR = signalAR.Checked;
                    dpp.AutoCrop = autoCrop.Checked;
                    dpp.KeepInputResolution = keepInputResolution.Checked;
                    dpp.PrerenderJob = addPrerenderJob.Checked;
                    dpp.Splitting = splitting.Value;
                    dpp.DeviceOutputType = devicetype.Text;
                    dpp.UseChaptersMarks = usechaptersmarks.Checked;
                    dpp.VideoSettings = VideoSettings.Clone();
                    D2VIndexJob job = new D2VIndexJob(input.Filename, d2vName, 1, audioTracks, dpp, false, false);
                    mainForm.Jobs.addJobsToQueue(job);
                    if (this.openOnQueue.Checked)
                    {
                        if (!string.IsNullOrEmpty(this.chapterFile.Filename))
                            this.chapterFile.Filename = string.Empty; // clean up
                        input.PerformClick();
                    }
                    else
                        this.Close();
                }
                else
                    MessageBox.Show("You must select audio and video profile, output name and working directory to continue",
                        "Incomplete configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else MessageBox.Show("MeGUI cannot write on the disc " + Path.GetPathRoot(output.Filename) + " \n" +
                                 "Please, select another output path to save your project...", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
 /// <summary>
 /// creates a project
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void queueButton_Click(object sender, System.EventArgs e)
 {
     if (configured)
     {
         if (Drives.ableToWriteOnThisDrive(Path.GetPathRoot(output.Text)))
         {
             if (!dialogMode)
             {
                 switch (IndexerUsed)
                 {
                     case IndexType.D2V:
                     {
                         D2VIndexJob job = generateIndexJob();
                         lastJob = job;
                         mainForm.Jobs.addJobsToQueue(job);
                         if (this.closeOnQueue.Checked)
                             this.Close();
                         break;
                     }
                     case IndexType.DGI:
                     {
                         DGIIndexJob job = generateDGNVIndexJob();
                         //lastJob = job;
                         mainForm.Jobs.addJobsToQueue(job);
                         if (this.closeOnQueue.Checked)
                             this.Close();
                         break;
                     }
                     case IndexType.DGA:
                     {
                         DGAIndexJob job = generateDGAIndexJob();
                         //lastJob = job;
                         mainForm.Jobs.addJobsToQueue(job);
                         if (this.closeOnQueue.Checked)
                             this.Close();
                         break;
                     }
                     case IndexType.FFMS:
                     {
                         FFMSIndexJob job = generateFFMSIndexJob();
                         //lastJob = job;
                         mainForm.Jobs.addJobsToQueue(job);
                         if (this.closeOnQueue.Checked)
                             this.Close();
                         break;
                     }
                 }
             }
         }
         else
             MessageBox.Show("MeGUI cannot write on the disc " + Path.GetPathRoot(output.Text) + "\n" +
                                             "Please, select another output path to save your project...", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
         MessageBox.Show("You must select the input and output file to continue",
                "Configuration incomplete", MessageBoxButtons.OK);
 }