Ejemplo n.º 1
0
 private void Worker_Stop()
 {
     Bt_Stop.Enabled = false;
     if (worker_process != null)
     {
         worker_process.Cancel();
     }
 }
Ejemplo n.º 2
0
        private CompletionStatus ExecuteComplex(string src, string dst)
        {
            string DstEncode  = GetPathWithoutExtension(dst) + "_.mp4";
            string DstExtract = GetPathWithoutExtension(dst) + "_.mkv";
            string DstAac     = GetPathWithoutExtension(dst) + "_.aac";

            jobId++;
            CompletionStatus Result;

            FFmpegConfig.UserInterfaceManager.Start(jobId, "Encoding to H264/AAC (Complex)");

            ProcessStartOptions OptionsMain = new ProcessStartOptions(jobId, "", true);
            FFmpegProcess       ProcessMain = null;

            OptionsMain.Started += (sender, e) => {
                ProcessMain = e.Process;
            };
            Task <CompletionStatus> TaskMain = Task.Run(() => MediaEncoder.Encode(src, "h264", null, "", DstEncode, OptionsMain));

            ProcessStartOptions Options = new ProcessStartOptions(jobId, "Extracting Audio", false);

            Result = MediaMuxer.ExtractAudio(src, DstExtract, Options);
            if (Result == CompletionStatus.Success)
            {
                Options.Title = "Encoding Audio";
                Result        = MediaEncoder.Encode(DstExtract, null, "aac", null, DstAac, Options);
            }

            if (Result != CompletionStatus.Success)
            {
                ProcessMain?.Cancel();
            }

            TaskMain.Wait();
            CompletionStatus Result2 = TaskMain.Result;

            if (Result == CompletionStatus.Success && Result2 == CompletionStatus.Success)
            {
                Options.Title = "Muxing Audio and Video";
                Result        = MediaMuxer.Muxe(DstEncode, DstAac, dst, Options);
            }

            File.Delete(DstEncode);
            File.Delete(DstExtract);
            File.Delete(DstAac);
            FFmpegConfig.UserInterfaceManager.Stop(jobId);
            return(Result);
        }
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (ClosingState == 0)
     {
         ClosingState           = HasRunningHosts ? 1 : 2;
         autoClose              = true;
         CancelButton.Content   = "Cancelling...";
         CancelButton.IsEnabled = false;
         task?.Cancel();
         foreach (FFmpegProcess host in hosts)
         {
             host.Cancel();
         }
     }
     if (ClosingState == 1)
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 4
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     host?.Cancel();
     task?.Cancel();
 }