private void addAnalysisPass_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(VideoInput)) { MessageBox.Show("Error: Could not add job to queue. Make sure that all the details are entered correctly", "Couldn't create job", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AviSynthJob job = new AviSynthJob(VideoInput); mainForm.Jobs.addJobsToQueue(new AviSynthJob(VideoInput)); }
/// <summary> /// sets up encoding /// </summary /// <param name="job">the job to be processed</param> /// <param name="error">output for any errors that might ocurr during this method</param> /// <returns>true if the setup has succeeded, false if it has not</returns> public bool setup(Job job, out string error) { error = ""; if (job is AviSynthJob) { this.job = (AviSynthJob)job; } else { error = "Job '" + job.Name + "' has been given to the AviSynthProcessor, even though it is not an AviSynthJob."; return(false); } stup.JobName = job.Name; try { file = AvsFile.OpenScriptFile(job.Input); reader = file.GetVideoReader(); } catch (Exception ex) { error = ex.Message; return(false); } stup.NbFramesTotal = reader.FrameCount; position = 0; try { processorThread = new Thread(new ThreadStart(process)); } catch (Exception e) { error = e.Message; return(false); } try { statusThread = new Thread(new ThreadStart(update)); } catch (Exception e) { error = e.Message; return(false); } return(true); }
/// <summary> /// sets up encoding /// </summary /// <param name="job">the job to be processed</param> /// <param name="error">output for any errors that might ocurr during this method</param> /// <returns>true if the setup has succeeded, false if it has not</returns> public void setup(Job job, StatusUpdate su, LogItem _) { Debug.Assert(job is AviSynthJob, "Job isn't an AviSynthJob"); stup = su; this.job = (AviSynthJob)job; try { file = AvsFile.OpenScriptFile(job.Input); reader = file.GetVideoReader(); } catch (Exception ex) { throw new JobRunException(ex); } stup.NbFramesTotal = (ulong)reader.FrameCount; stup.ClipLength = TimeSpan.FromSeconds((double)stup.NbFramesTotal / file.VideoInfo.FPS); stup.Status = "Playing through file..."; position = 0; try { processorThread = new Thread(new ThreadStart(process)); } catch (Exception e) { throw new JobRunException(e); } try { statusThread = new Thread(new ThreadStart(update)); } catch (Exception e) { throw new JobRunException(e); } }