Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
        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', ' '));
        }
Esempio n. 4
0
        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', ' '));
        }
Esempio n. 5
0
    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;
    }
Esempio n. 6
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (!disposing)
            {
                return;
            }

            _guiRunner?.Dispose();
            _guiRunner = null;

            DeinitializeMainForm();
            DeinitializeTrayIcon();
            DeinitializeAgent();
            DeinitializeMaster();

            AppMessenger.Instance.Dispose();
        }
Esempio n. 7
0
        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", "");
                }
            }
        }