Example #1
0
 static public void Execute(IWin32Window parent, string script)
 {
     using (AvsFile r = AvsFile.ParseScript(script))
     {
         using (CropDialog d = new CropDialog())
         {
             d.file   = r;
             d.reader = r.GetVideoReader();
             d.init();
             d.ShowDialog(parent);
         }
     }
 }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
            }
        }
Example #4
0
 public IVideoReader GetVideoReader()
 {
     return(reader.GetVideoReader());
 }