Exemple #1
0
 public void EmitNextPlaylistElement(Playlist playlist)
 {
     if (NextPlaylistElementEvent != null) {
         NextPlaylistElementEvent (playlist);
     }
 }
Exemple #2
0
 public EditionJob(Playlist playlist, EncodingSettings encSettings)
     : base(encSettings)
 {
     Playlist = Cloner.Clone(playlist);
 }
Exemple #3
0
 public void EmitAddPlaylistElement(Playlist playlist, List<IPlaylistElement> plays)
 {
     if (AddPlaylistElementEvent != null)
         AddPlaylistElementEvent (playlist, plays);
 }
        protected virtual void OnNewRenderingJob(object sender, EventArgs args)
        {
            Playlist playlist;
            TreePath[] paths;

            playlist = new Playlist ();
            paths = treeview.Selection.GetSelectedRows ();

            foreach (var path in paths) {
                TreeIter iter;
                PlaylistPlayElement element;

                treeview.Model.GetIter (out iter, path);
                element = new PlaylistPlayElement (treeview.Model.GetValue (iter, 0) as TimelineEvent,
                    project.Description.FileSet);
                playlist.Elements.Add (element);
            }

            Config.EventsBroker.EmitRenderPlaylist (playlist);
        }
Exemple #5
0
 void HandlePlaylistElementSelectedEvent(Playlist playlist, IPlaylistElement element)
 {
     playlisttreeview1.QueueDraw ();
 }
Exemple #6
0
 public void EmitRenderPlaylist(Playlist playlist)
 {
     if (RenderPlaylist != null)
         RenderPlaylist (playlist);
 }
Exemple #7
0
 void AddImage(Playlist playlist, IPlaylistElement element, bool prepend, TreeIter parent)
 {
     Pixbuf pix = LongoMatch.Gui.Helpers.Misc.OpenImage (this);
     if (pix != null) {
         var image = new LongoMatch.Core.Common.Image (pix);
         PlaylistImage plimage = new PlaylistImage (image, new Time (5000));
         int index = playlist.Elements.IndexOf (element);
         if (!prepend) {
             index++;
         }
         playlist.Elements.Insert (index, plimage);
         (Model as TreeStore).InsertWithValues (parent, index, plimage);
     }
 }
Exemple #8
0
 void EmitRenderPlaylist(List<TimelineEvent> plays)
 {
     Playlist pl = new Playlist ();
     foreach (TimelineEvent p in plays) {
         pl.Elements.Add (new PlaylistPlayElement (p, project.Description.FileSet));
     }
     Config.EventsBroker.EmitRenderPlaylist (pl);
 }
Exemple #9
0
 void HandlePlaylistElementSelectedEvent(Playlist playlist, IPlaylistElement element)
 {
     if (element is PlaylistPlayElement) {
         loadedPlay = (element as PlaylistPlayElement).Play;
     } else {
         loadedPlay = null;
     }
 }
Exemple #10
0
        void ShowPlaylistElementMenu(Playlist playlist, IPlaylistElement element, TreeIter parent)
        {
            Menu menu;
            MenuItem edit, delete, prepend, append;

            menu = new Menu ();

            if (element is PlaylistPlayElement || element == null) {
                PlaylistPlayElement pl = element as PlaylistPlayElement;

                edit = new MenuItem (Catalog.GetString ("Edit name"));
                edit.Activated += (sender, e) => {
                    string name = Config.GUIToolkit.QueryMessage (Catalog.GetString ("Name:"), null,
                                      pl.Title);
                    if (!String.IsNullOrEmpty (name)) {
                        pl.Title = name;
                    }
                };
                menu.Append (edit);
            }

            prepend = new MenuItem (Catalog.GetString ("Insert before"));
            prepend.Submenu = CreateExternalsMenu (playlist, element, true, parent);
            menu.Append (prepend);

            append = new MenuItem (Catalog.GetString ("Insert after"));
            append.Submenu = CreateExternalsMenu (playlist, element, false, parent);
            menu.Append (append);

            delete = new MenuItem (Catalog.GetString ("Delete"));
            delete.Activated += (sender, e) => {
                playlist.Remove (element);
                (Model as TreeStore).Remove (ref selectedIter);
                Config.EventsBroker.EmitPlaylistsChanged (this);
            };
            menu.Append (delete);

            menu.ShowAll ();
            menu.Popup ();
        }
Exemple #11
0
        void ShowPlaylistMenu(Playlist playlist)
        {
            Menu menu;
            MenuItem edit, delete, render;

            menu = new Menu ();

            edit = new MenuItem (Catalog.GetString ("Edit name"));
            edit.Activated += (sender, e) => {
                string name = Config.GUIToolkit.QueryMessage (Catalog.GetString ("Name:"), null,
                                  playlist.Name);
                if (!String.IsNullOrEmpty (name)) {
                    playlist.Name = name;
                }
            };
            menu.Append (edit);

            render = new MenuItem (Catalog.GetString ("Render"));
            render.Activated += (sender, e) => {
                Config.EventsBroker.EmitRenderPlaylist (playlist);
            };
            menu.Append (render);

            delete = new MenuItem (Catalog.GetString ("Delete"));
            delete.Activated += (sender, e) => {
                project.Playlists.Remove (playlist);
                (Model as TreeStore).Remove (ref selectedIter);
                Config.EventsBroker.EmitPlaylistsChanged (this);
            };
            menu.Append (delete);

            menu.ShowAll ();
            menu.Popup ();
        }
Exemple #12
0
        void FillElementAndPlaylist(TreeIter iter, out Playlist playlist, out IPlaylistElement element)
        {
            TreeIter parent;

            var obj = Model.GetValue (iter, 0);
            if (obj is IPlaylistElement) {
                Model.IterParent (out parent, iter);
                element = obj as IPlaylistElement;
                playlist = Model.GetValue (parent, 0) as Playlist;
            } else {
                element = null;
                playlist = obj as Playlist;
            }
        }
Exemple #13
0
 Menu CreateExternalsMenu(Playlist playlist, IPlaylistElement element, bool prepend, TreeIter parent)
 {
     Menu addMenu = new Menu ();
     MenuItem video = new MenuItem (Catalog.GetString ("External video"));
     video.Activated += (sender, e) => AddVideo (playlist, element, prepend, parent);
     addMenu.Append (video);
     MenuItem stillImage = new MenuItem (Catalog.GetString ("External image"));
     stillImage.Activated += (sender, e) => AddImage (playlist, element, prepend, parent);
     addMenu.Append (stillImage);
     return addMenu;
 }
Exemple #14
0
 void AddVideo(Playlist playlist, IPlaylistElement element, bool prepend, TreeIter parent)
 {
     MediaFile file = LongoMatch.Gui.Helpers.Misc.OpenFile (this);
     if (file != null) {
         PlaylistVideo video = new PlaylistVideo (file);
         int index = playlist.Elements.IndexOf (element);
         if (!prepend) {
             index++;
         }
         playlist.Elements.Insert (index, video);
         (Model as TreeStore).InsertWithValues (parent, index, video);
     }
 }
Exemple #15
0
 public void EmitPlaylistElementSelected(Playlist playlist, IPlaylistElement element)
 {
     if (PlaylistElementSelectedEvent != null)
         PlaylistElementSelectedEvent (playlist, element);
 }
Exemple #16
0
        void RenderPlay(Project project, TimelineEvent play)
        {
            Playlist playlist;
            EncodingSettings settings;
            EditionJob job;
            string outputDir, outputProjectDir, outputFile;

            if (Config.AutoRenderDir == null ||
                !Directory.Exists (Config.AutoRenderDir)) {
                outputDir = Config.VideosDir;
            } else {
                outputDir = Config.AutoRenderDir;
            }

            outputProjectDir = Path.Combine (outputDir,
                Utils.SanitizePath (project.Description.DateTitle));
            outputFile = String.Format ("{0}-{1}.mp4", play.EventType.Name, play.Name);
            outputFile = Utils.SanitizePath (outputFile, ' ');
            outputFile = Path.Combine (outputProjectDir, outputFile);
            try {
                PlaylistPlayElement element;

                Directory.CreateDirectory (outputProjectDir);
                settings = EncodingSettings.DefaultRenderingSettings (outputFile);
                playlist = new Playlist ();
                element = new PlaylistPlayElement (play, project.Description.FileSet);
                playlist.Elements.Add (element);
                job = new EditionJob (playlist, settings);
                renderer.AddJob (job);
            } catch (Exception ex) {
                Log.Exception (ex);
            }
        }
Exemple #17
0
 public void EmitPreviousPlaylistElement(Playlist playlist)
 {
     if (PreviousPlaylistElementEvent != null) {
         PreviousPlaylistElementEvent (playlist);
     }
 }
        public void FixtureSetup()
        {
            playerMock = new Mock<IPlayer> ();
            playerMock.SetupAllProperties ();
            /* Mock properties without setter */
            playerMock.Setup (p => p.CurrentTime).Returns (() => currentTime);
            playerMock.Setup (p => p.StreamLength).Returns (() => streamLength);
            playerMock.Setup (p => p.Play ()).Raises (p => p.StateChange += null, this, true);
            playerMock.Setup (p => p.Pause ()).Raises (p => p.StateChange += null, this, false);

            mtkMock = new Mock<IMultimediaToolkit> ();
            mtkMock.Setup (m => m.GetPlayer ()).Returns (playerMock.Object);
            mtkMock.Setup (m => m.GetMultiPlayer ()).Throws (new Exception ());
            Config.MultimediaToolkit = mtkMock.Object;

            var ftk = new Mock<IGUIToolkit> ();
            ftk.Setup (m => m.Invoke (It.IsAny<EventHandler> ())).Callback<EventHandler> (e => e (null, null));
            Config.GUIToolkit = ftk.Object;

            Config.EventsBroker = new EventsBroker ();

            mfs = new MediaFileSet ();
            mfs.Add (new MediaFile { FilePath = "test1", VideoWidth = 320, VideoHeight = 240, Par = 1 });
            mfs.Add (new MediaFile { FilePath = "test2", VideoWidth = 320, VideoHeight = 240, Par = 1 });

            evt = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
                CamerasConfig = new List<CameraConfig> { new CameraConfig (0) }
            };
            plImage = new PlaylistImage (Utils.LoadImageFromFile (), new Time (5));
            playlist = new Playlist ();
            playlist.Elements.Add (new PlaylistPlayElement (evt));
            playlist.Elements.Add (plImage);
        }
        public static void RenderPlaylist(Playlist playlist, int count, bool isExpanded, IDrawingToolkit tk,
		                                   IContext context, Area backgroundArea, Area cellArea)
        {
            Point textP = new Point (StyleConf.ListTextOffset, cellArea.Start.Y);
            tk.Context = context;
            tk.Begin ();
            RenderBackgroundAndText (isExpanded, tk, backgroundArea, textP, cellArea.Width - textP.X, playlist.Name);
            RenderCount (isExpanded, Config.Style.PaletteActive, count, tk, backgroundArea, cellArea);
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
        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);
            }
        }