AddJob() public méthode

public AddJob ( LongoMatch.Common.Job job ) : void
job LongoMatch.Common.Job
Résultat void
Exemple #1
0
        public static void StartServices(MainWindow mainWindow)
        {
            RenderingJobsManager videoRenderer;
            ProjectsManager      projectsManager;

            /* Start TemplatesService */
            ts = new TemplatesService(Config.configDirectory);

            /* Start DB services */
            db = new DataBase(Path.Combine(Config.DBDir(), Constants.DB_FILE));

            /* Start the events manager */
            eManager = new EventsManager(mainWindow);

            /* Start the hotkeys manager */
            hkManager = new HotKeysManager();
            hkManager.newMarkEvent += eManager.OnNewTag;

            /* Start the rendering jobs manager */
            videoRenderer = new RenderingJobsManager(mainWindow.RenderingStateBar);
            mainWindow.RenderPlaylistEvent += (playlist) => {
                videoRenderer.AddJob(RenderingJobsManager.ConfigureRenderingJob(playlist, mainWindow));
            };

            /* Start Game Units manager */
            guManager = new GameUnitsManager(mainWindow, mainWindow.Player);

            projectsManager = new ProjectsManager(mainWindow);
            projectsManager.OpenedProjectChanged += OnOpenedProjectChanged;
        }
        public void TestRenderedCamera()
        {
            Project p = Utils.CreateProject ();

            try {
                TimelineEvent evt = p.Timeline [0];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
                PlaylistPlayElement element = new PlaylistPlayElement (evt, p.Description.FileSet);

                // Playlist with one event
                var playlist = new Playlist ();
                playlist.Elements.Add (element);

                // Create a job
                const string outputFile = "path";
                EncodingSettings settings = new EncodingSettings (VideoStandards.P720, EncodingProfiles.MP4, EncodingQualities.Medium,
                                                25, 1, outputFile, true, true, 20);
                EditionJob job = new EditionJob (playlist, settings);

                // Mock IMultimediaToolkit and video editor
                var mtk = Mock.Of<IMultimediaToolkit> (m => m.GetVideoEditor () == Mock.Of<IVideoEditor> ());
                // and guitoolkit
                var gtk = Mock.Of<IGUIToolkit> (g => g.RenderingStateBar == Mock.Of<IRenderingStateBar> ());
                // and a video editor
                Mock<IVideoEditor> mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
                // And eventbroker
                Config.EventsBroker = Mock.Of<EventsBroker> ();

                // Create a rendering object with mocked interfaces
                RenderingJobsManager renderer = new RenderingJobsManager (mtk, gtk);
                // Start service
                renderer.Start ();

                renderer.AddJob (job);

                // Check that AddSegment is called with the right video file.
                mock.Verify (m => m.AddSegment (p.Description.FileSet [0].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());

                /* Test with a camera index bigger than the total cameras */
                renderer.CancelAllJobs ();
                mock.ResetCalls ();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (1) };
                element = new PlaylistPlayElement (evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob (playlist, settings);
                renderer.AddJob (job);
                mock.Verify (m => m.AddSegment (p.Description.FileSet [1].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());

                /* Test with the secondary camera */
                renderer.CancelAllJobs ();
                mock.ResetCalls ();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (2) };
                element = new PlaylistPlayElement (evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob (playlist, settings);
                renderer.AddJob (job);
                mock.Verify (m => m.AddSegment (p.Description.FileSet [0].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());
            } finally {
                Utils.DeleteProject (p);
            }
        }