public void StopEncode() { hbFunctions.hb_stop(this.Handle); // Also remove all jobs from the queue (in case we stopped a 2-pass encode) var currentJobs = new List <IntPtr>(); int jobs = hbFunctions.hb_count(this.Handle); for (int i = 0; i < jobs; i++) { currentJobs.Add(hbFunctions.hb_job(this.Handle, 0)); } foreach (IntPtr job in currentJobs) { hbFunctions.hb_rem(this.Handle, job); } }