static void RunMeshroomCompute( string MeshroomComputeBin, string ImagesDir, string graph, int chunkNum, ChunkProgress ChunkProgressCB, AutoResetEvent AbortEvent) { /* remove previous cache dir, if it exists */ RemoveCacheDir(ImagesDir, chunkNum); /* start meshroom compute process */ var runner = new ProcRunner(MeshroomComputeBin, graph); runner.StartAsync(); /* poll progress until finished/aborted */ var stepsPoller = MeshroomProgress.GetPoller(ImagesDir); var graphName = Path.GetFileNameWithoutExtension(graph); while (runner.IsRunning(AbortEvent, POLL_FREQ)) { var done = stepsPoller.PollStepsDone(); var total = stepsPoller.TotalSteps; ChunkProgressCB((float)done / (float)total); } CopyCamerasSFMFile(ImagesDir, graphName); }
public static void ExtractSubtitles(string ffmpegBinary, string VideoFile, AutoResetEvent AbortEvent) { var posFile = GetPositionsFilePath(VideoFile); var runner = new ProcRunner(ffmpegBinary, "-y", "-i", VideoFile, posFile); runner.Start(AbortEvent); }
public void ProcRunner_GetsErrOutput() { string batchFile = GenerateTestBatchFile(kAppWithErrOutput); ProcConfiguration testApp = new ProcConfiguration(batchFile); ProcRunner runner = testApp.BuildRunner(); ProcRunResults result = runner.Run("Test"); Assert.IsFalse(result.Success); Assert.AreEqual("Input: 'Test'", result.ErrorText.Trim('\r', '\n', ' ')); }
public async Task ProcRunner_GetsStdOutput_Async() { string batchFile = GenerateTestBatchFile(kAppWithOutput); ProcConfiguration testApp = new ProcConfiguration(batchFile); ProcRunner runner = testApp.BuildRunner(); ProcRunResults result = await runner.RunAsync("Test"); Assert.IsTrue(result.Success); Assert.AreEqual("Input: 'Test'", result.OutputText.Trim('\r', '\n', ' ')); }
public static void SplitFrames( string ffmpegBinary, string VideoFile, SplitProgress ProgressCB, AutoResetEvent AbortEvent, out uint NumFrames) { var ImagesDir = GetImagesDir(VideoFile); var frameTemplate = Path.Combine(ImagesDir, "%04d.jpg"); Directory.CreateDirectory(ImagesDir); var runner = new ProcRunner(ffmpegBinary, "-i", VideoFile, frameTemplate); var outputParser = new FFMPEGOutputParser(ProgressCB); runner.StderrLineEvent += outputParser.ParseLine; runner.Start(AbortEvent); NumFrames = outputParser.LastFrame; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (!disposing) { return; } _guiRunner?.Dispose(); _guiRunner = null; DeinitializeMainForm(); DeinitializeTrayIcon(); DeinitializeAgent(); DeinitializeMaster(); AppMessenger.Instance.Dispose(); }
void ShowGUI() { if (string.IsNullOrEmpty(_ac.GuiAppExe)) { // show default GUI built in this app ShowMainForm(); } else // run external process { try { if (_guiRunner == null) { var optionReplTab = new Dictionary <string, string> { ["--clientId"] = _guiClientId }; _guiRunner = new ProcRunner(_ac.GuiAppExe, optionReplTab, true); _guiRunner.Launch(); } else // was already started { // re-launch if no longer running if (!_guiRunner.IsRunning) { _guiRunner.Launch(); } else // just tell it to unhide { _guiRunner.IsShown = true; } } } catch (Exception ex) { log.Error(ex); ExceptionDialog.showException(ex, "Dirigent Exception", ""); } } }