git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Mon, 6 Nov 2017 17:10:17 +0000 (17:10 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Mon, 6 Nov 2017 17:10:17 +0000 (17:10 +0000)
client/DxPlay/DxPlayer.cs
client/DxPlay/PlayerForm.cs
client/Maestro/Configuration/configuration-editor.json
client/Maestro/Configuration/configuration-playout-ingest.json
client/Maestro/MaestroForm.Designer.cs
client/Maestro/MaestroForm.Source.cs
client/Maestro/Program.cs
client/Maestro/Resources/installforge-installer-project.ifp
client/Maestro/Sources/FileSystemSource.cs

index b1e9f86e237030aefd2d3763871eeb0ab9f84be5..828c73c02a954d54571a38d7009d898b7b2a6af7 100644 (file)
@@ -12,6 +12,7 @@ using System.ComponentModel;
 using System.Drawing.Imaging;\r
 using System.Drawing.Drawing2D;\r
 using System.Collections.Generic;\r
+using Myriadbits.MXF;\r
 \r
 namespace DxPlay {\r
     \r
@@ -55,7 +56,7 @@ namespace DxPlay {
         private IBaseFilter m_videoRenderer = null;\r
         private object tcLock = new object();\r
         Bitmap m_Bitmap = null;\r
-\r
+        public bool IsError { get; set; }\r
 #if DEBUG\r
         // Allow you to "Connect to remote graph" from GraphEdit\r
         DsROTEntry m_DsRot;\r
@@ -226,6 +227,7 @@ namespace DxPlay {
             //}\r
 \r
             try {\r
+                IsError = false;\r
                 m_FilterGraph = new FilterGraph() as IFilterGraph2;\r
 \r
                 IGraphBuilder graphBuilder = m_FilterGraph as IGraphBuilder;\r
@@ -298,6 +300,7 @@ namespace DxPlay {
             }\r
             catch (Exception e) {\r
                 Debug.WriteLine(e.Message);\r
+                IsError = true;\r
             }\r
             finally {\r
             }\r
@@ -316,7 +319,10 @@ namespace DxPlay {
             DsError.ThrowExceptionForHR(hr);\r
             MediaDescription.duration = new Timecode();\r
             MediaDescription.Duration.Set(ReferenceTimeToFrames(duration));\r
-            MediaDescription.firstFrame = new Timecode();\r
+            //MXFFile mxf = new MXFFile(MediaDescription.FileName);\r
+            //mxf.Inspect();\r
+            //MediaDescription.firstFrame = new Timecode(mxf.FirstSystemItem.UserDateFullFrameNb, MediaDescription.FrameRate);\r
+            //MediaDescription.firstFrame = new Timecode();\r
             CurrentTC = new Timecode(MediaDescription.FirstFrame);\r
         }\r
 \r
index 83a7e8992fdcd0c4db787913a74f8edf142a4073..cd8ce2433c35436abfd331f5a4b90a37cb19b759 100644 (file)
@@ -60,11 +60,14 @@ namespace DxPlay {
         private void cueue() {\r
             m_play = null;\r
             try {\r
-                //m_mediaDescription = MediaDetector.GetDescription(selectedFile);\r
-                m_mediaDescription = new MediaDescription() { fileName = selectedFile };\r
+                m_mediaDescription = MediaDetector.GetDescription(selectedFile);\r
+                //m_mediaDescription = new MediaDescription() { fileName = selectedFile };\r
                 trackBar1.Value = 0;\r
                 trackBar1.Minimum = 0;\r
                 m_play = new DxPlayer(panelVideo, ref m_mediaDescription);\r
+                if (m_play.IsError)\r
+                    throw new Exception(selectedFile);                \r
+\r
                 m_play.PlayEvent += new DxPlayEvent(playEvent);\r
                 if (m_mediaDescription != null) {\r
                     trackBar1.Maximum = m_mediaDescription.Duration.Frames;\r
@@ -73,7 +76,8 @@ namespace DxPlay {
                 }\r
             }\r
             catch (Exception ce) {\r
-                MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                MessageBox.Show("Az állomány nem tölthetõ be: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                Close();\r
             }\r
         }\r
 \r
@@ -122,8 +126,8 @@ namespace DxPlay {
                 m_play = null;\r
             }\r
             cueue();\r
-            BringToFront();\r
-            Activate();\r
+            //BringToFront();\r
+            //Activate();\r
         }\r
 \r
         private void Form1_DragDrop(object sender, DragEventArgs e) {\r
index 8b84f8a3b70274ad5b2d8a134b02c5355c3c5f7b..fee8893aec8ab59e9804820c89dbdaca42eeeff5 100644 (file)
@@ -1,6 +1,6 @@
 {\r
   "title": "Szerkesztő",\r
-  "active": true,\r
+  "active": false,\r
   "startInTray": false,\r
   "enableCustomMetadataId": true,\r
   "player": {\r
index 26deea8e58c1943f195505a3dc4e19bd8aebd214..bb755209e47a3fb9ea8b6b38310dd3e5934435de 100644 (file)
@@ -1,6 +1,6 @@
 {\r
   "title": "Lebony betöltő",\r
-  "active": false,\r
+  "active": true,\r
   "startInTray": false,\r
   "enableCustomMetadataId": true,\r
   "player": {\r
index 04146eb249c0223e26795c3ff13fe16a7421a7c3..0dc81cd3f68fbebba2ad6f4daa8f5141bd8a6d87 100644 (file)
@@ -177,14 +177,14 @@ namespace Maestro {
             this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
             this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
             this.dgSource.EnableHeadersVisualStyles = false;\r
-            this.dgSource.Location = new System.Drawing.Point(10, 51);\r
+            this.dgSource.Location = new System.Drawing.Point(10, 47);\r
             this.dgSource.Name = "dgSource";\r
             this.dgSource.RowHeadersVisible = false;\r
             dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
             this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle17;\r
             this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
             this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
-            this.dgSource.Size = new System.Drawing.Size(347, 348);\r
+            this.dgSource.Size = new System.Drawing.Size(347, 352);\r
             this.dgSource.TabIndex = 0;\r
             this.dgSource.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.sourceGridView_CellContentClick);\r
             this.dgSource.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellEnter);\r
@@ -198,24 +198,24 @@ namespace Maestro {
             // \r
             this.pSourceFilter.AutoSize = true;\r
             this.pSourceFilter.ColumnCount = 2;\r
-            this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 94.5245F));\r
-            this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.475504F));\r
+            this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
+            this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
             this.pSourceFilter.Controls.Add(this.txtSourceFilter, 0, 0);\r
             this.pSourceFilter.Controls.Add(this.btnClearFilter, 1, 0);\r
             this.pSourceFilter.Dock = System.Windows.Forms.DockStyle.Top;\r
             this.pSourceFilter.Location = new System.Drawing.Point(10, 23);\r
             this.pSourceFilter.Margin = new System.Windows.Forms.Padding(0);\r
             this.pSourceFilter.Name = "pSourceFilter";\r
-            this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 4, 0, 4);\r
+            this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 0, 0, 4);\r
             this.pSourceFilter.RowCount = 1;\r
-            this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));\r
-            this.pSourceFilter.Size = new System.Drawing.Size(347, 28);\r
+            this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
+            this.pSourceFilter.Size = new System.Drawing.Size(347, 24);\r
             this.pSourceFilter.TabIndex = 17;\r
             // \r
             // txtSourceFilter\r
             // \r
             this.txtSourceFilter.Dock = System.Windows.Forms.DockStyle.Fill;\r
-            this.txtSourceFilter.Location = new System.Drawing.Point(0, 4);\r
+            this.txtSourceFilter.Location = new System.Drawing.Point(0, 0);\r
             this.txtSourceFilter.Margin = new System.Windows.Forms.Padding(0);\r
             this.txtSourceFilter.Name = "txtSourceFilter";\r
             this.txtSourceFilter.Size = new System.Drawing.Size(328, 20);\r
@@ -225,7 +225,7 @@ namespace Maestro {
             // btnClearFilter\r
             // \r
             this.btnClearFilter.Image = global::Maestro.Properties.Resources.ic_clear_black_24dp_1x;\r
-            this.btnClearFilter.Location = new System.Drawing.Point(328, 4);\r
+            this.btnClearFilter.Location = new System.Drawing.Point(328, 0);\r
             this.btnClearFilter.Margin = new System.Windows.Forms.Padding(0);\r
             this.btnClearFilter.Name = "btnClearFilter";\r
             this.btnClearFilter.Size = new System.Drawing.Size(19, 20);\r
index 0587ec383e50871cbeeec08e16ae20d1f7b4884c..b8d28d3f3a630fdeb3aa04479ad6d5e2d1845587 100644 (file)
@@ -70,7 +70,7 @@ namespace Maestro {
         }\r
 \r
         private void dataGridSource_CellMouseEnter(object sender, DataGridViewCellEventArgs e) {\r
-            if (IsPlayColumn(e.ColumnIndex))\r
+            if (e.RowIndex > -1 && IsPlayColumn(e.ColumnIndex))\r
                 dgSource.Cursor = Cursors.Hand;\r
         }\r
 \r
@@ -107,7 +107,8 @@ namespace Maestro {
                     PlayerForm player = new PlayerForm();\r
                     player.AutoStart = Configuration.Player.AutoStart;\r
                     player.Open(fileSourceItem.FileInfo);\r
-                    player.ShowDialog();\r
+                    if (!player.IsDisposed)\r
+                        player.ShowDialog();\r
                     Cursor = Cursors.Default;\r
                 }));\r
             }\r
index 784c5681b75d9e36dc1dc2b8be5219ebf994c3ca..9f1ab25fb1ba97ea2bb75eef2efe489615111f8f 100644 (file)
@@ -7,6 +7,7 @@ using NLog.Targets;
 using System;\r
 using System.Collections.Concurrent;\r
 using System.Collections.Generic;\r
+using System.Diagnostics;\r
 using System.Drawing;\r
 using System.IO;\r
 using System.Linq;\r
@@ -47,10 +48,17 @@ namespace Maestro {
                 }\r
                 finally {\r
                     if (hasHandle) {\r
-                        Application.EnableVisualStyles();\r
-                        Application.SetCompatibleTextRenderingDefault(false);\r
-                        Application.Run(new TrayApplicationContext());\r
-                        mutex.ReleaseMutex();\r
+                        try {\r
+                            Application.EnableVisualStyles();\r
+                            Application.SetCompatibleTextRenderingDefault(false);\r
+                            Application.Run(new TrayApplicationContext());\r
+                        }\r
+                        catch (Exception e) {\r
+                            Debug.WriteLine(e.Message);\r
+                        }\r
+                        finally {\r
+                            mutex.ReleaseMutex();\r
+                        }\r
                     }\r
                 }\r
             }\r
index dd18bcad46c80b80f2098aae6614a7c2005a6b90..6fcbde34d01abd9928357559b0f4b17b817748fd 100644 (file)
Binary files a/client/Maestro/Resources/installforge-installer-project.ifp and b/client/Maestro/Resources/installforge-installer-project.ifp differ
index 7c4f65ed7214a2c2153aad1fc80b4d79d448e212..cea9113d30fb7edae34b081031a93805d0b56437 100644 (file)
@@ -40,18 +40,21 @@ namespace Maestro.Sources {
                         DataPropertyName = "Name",\r
                         HeaderText = StringResources.NEV,\r
                         AutoSizeMode = DataGridViewAutoSizeColumnMode.None,\r
-                        Width = 200\r
+                        Width = 200,\r
+                        SortMode = DataGridViewColumnSortMode.Automatic\r
                     },\r
                     new DataGridViewTextBoxColumn(){\r
                         DataPropertyName = "FormattedSize",\r
                         HeaderText = StringResources.MERET,\r
                         AutoSizeMode = DataGridViewAutoSizeColumnMode.None,\r
-                        Width = 100\r
+                        Width = 100,\r
+                        SortMode = DataGridViewColumnSortMode.Automatic\r
                     },\r
                     new DataGridViewTextBoxColumn() {\r
                         DataPropertyName = "Created",\r
                         HeaderText = StringResources.LETREHOZVA,\r
-                        AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells\r
+                        AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells,\r
+                        SortMode = DataGridViewColumnSortMode.Automatic\r
                     }\r
                 };\r
                 foreach (DataGridViewColumn column in result) {\r
@@ -61,14 +64,40 @@ namespace Maestro.Sources {
             }\r
         }\r
 \r
+        public bool SupportsSorting {\r
+            get => false;\r
+        }\r
+\r
+        public bool IsSorted {\r
+            get => true;\r
+        }\r
+\r
+        public PropertyDescriptor SortProperty {\r
+            get; set;\r
+        }\r
+\r
+        public ListSortDirection SortDirection { get; set; }\r
+\r
+        public void ApplySort(PropertyDescriptor property, ListSortDirection direction) {\r
+            SortProperty = property;\r
+            SortDirection = direction;\r
+            if (cache == null) {\r
+\r
+            }\r
+            \r
+        }\r
+\r
+        public void RemoveSort(PropertyDescriptor property, ListSortDirection direction) {\r
+        }\r
+\r
         public string Filter {\r
-            get => filter; set {\r
+            get => filter;\r
+            set {\r
                 filter = value;\r
-                if (String.IsNullOrEmpty(filter)) {\r
+                if (String.IsNullOrEmpty(filter))\r
                     RemoveFilter();\r
-                } else {\r
+                else\r
                     ApplyFilter(filter);\r
-                }\r
             }\r
         }\r
 \r
@@ -77,8 +106,31 @@ namespace Maestro.Sources {
                 cache = new List<FileSourceItem>(this);\r
             Clear();\r
             IEnumerable<FileSourceItem> filteredItems = cache.Where(i => (i.Name == null) ? false : i.Name.ToLower().Contains(filter.ToLower()));\r
-            filteredItems.ToList().ForEach(i => parent.SafeCall(() => Add(i)));\r
 \r
+            switch (SortDirection) {\r
+                case ListSortDirection.Ascending:\r
+                    filteredItems.OrderBy(i => getValue(i)).ToList().ForEach(i => Add(i));\r
+                    break;\r
+                case ListSortDirection.Descending:\r
+                    filteredItems.OrderByDescending(i => getValue(i)).ToList().ForEach(i => Add(i));\r
+                    break;\r
+            }\r
+        }\r
+\r
+        private object getValue(FileSourceItem i) {\r
+            object result = null;\r
+            switch (SortProperty.Name) {\r
+                case "Name":\r
+                    result = i.Name;\r
+                    break;\r
+                case "FormattedSize":\r
+                    result = i.FormattedSize;\r
+                    break;\r
+                case "Created":\r
+                    result = i.Created;\r
+                    break;\r
+            }\r
+            return result;\r
         }\r
 \r
         public void RemoveFilter() {\r
@@ -87,7 +139,7 @@ namespace Maestro.Sources {
             Shutdown();\r
         }\r
 \r
-        public ListSortDescriptionCollection SortDescriptions => throw new NotImplementedException();\r
+        public ListSortDescriptionCollection SortDescriptions => null;\r
 \r
         public bool SupportsAdvancedSorting => throw new NotImplementedException();\r
 \r
@@ -156,6 +208,8 @@ namespace Maestro.Sources {
         private void initializeList(string path) {\r
             string[] files = Directory.GetFiles(path);\r
             var fileSourceItems = files.Select(f => CreateItem(new FileInfo(f), false)).OrderByDescending(i => i.Created);\r
+            SortProperty = TypeDescriptor.GetProperties(typeof(FileSourceItem)).Find("Created", false);\r
+            SortDirection = ListSortDirection.Descending;    \r
             try {\r
                 fileSourceItems.Where(x => x.CanHandle(acceptableExtensions)).ToList().ForEach(i => parent.SafeCall(() => Add(i)));\r
             }\r