From e24565b22ba27f8089ca2aab133a66d7634584bc Mon Sep 17 00:00:00 2001 From: Sweidan Omar Date: Thu, 13 Jan 2022 00:06:48 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C32735 --- client/DxPlay/PlayerForm.Designer.cs | 128 ++++++------ client/DxPlay/PlayerForm.cs | 283 ++++++++++++++++++--------- client/DxPlay/PlayerForm.resx | 12 +- client/DxPlay/PlayerGraph.cs | 113 +++++++---- 4 files changed, 333 insertions(+), 203 deletions(-) diff --git a/client/DxPlay/PlayerForm.Designer.cs b/client/DxPlay/PlayerForm.Designer.cs index 181d0b38..59aa4a28 100644 --- a/client/DxPlay/PlayerForm.Designer.cs +++ b/client/DxPlay/PlayerForm.Designer.cs @@ -29,8 +29,6 @@ namespace DxPlay { private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayerForm)); this.pVideo = new System.Windows.Forms.Panel(); this.mainSplit = new System.Windows.Forms.SplitContainer(); @@ -90,7 +88,7 @@ namespace DxPlay { this.pVideo.Dock = System.Windows.Forms.DockStyle.Fill; this.pVideo.Location = new System.Drawing.Point(0, 0); this.pVideo.Name = "pVideo"; - this.pVideo.Size = new System.Drawing.Size(478, 385); + this.pVideo.Size = new System.Drawing.Size(478, 349); this.pVideo.TabIndex = 0; this.pVideo.TabStop = true; this.pVideo.SizeChanged += new System.EventHandler(this.panel1_SizeChanged); @@ -101,7 +99,7 @@ namespace DxPlay { this.mainSplit.BackColor = System.Drawing.Color.Black; this.mainSplit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mainSplit.Dock = System.Windows.Forms.DockStyle.Fill; - this.mainSplit.Location = new System.Drawing.Point(0, 24); + this.mainSplit.Location = new System.Drawing.Point(0, 28); this.mainSplit.Name = "mainSplit"; // // mainSplit.Panel1 @@ -113,7 +111,7 @@ namespace DxPlay { this.mainSplit.Panel2.Controls.Add(this.tableLayoutPanel1); this.mainSplit.Panel2.Controls.Add(this.pMetadataDisplay); this.mainSplit.Panel2MinSize = 300; - this.mainSplit.Size = new System.Drawing.Size(784, 387); + this.mainSplit.Size = new System.Drawing.Size(784, 351); this.mainSplit.SplitterDistance = 480; this.mainSplit.TabIndex = 20; // @@ -123,7 +121,7 @@ namespace DxPlay { this.panelPlayer.Dock = System.Windows.Forms.DockStyle.Fill; this.panelPlayer.Location = new System.Drawing.Point(0, 0); this.panelPlayer.Name = "panelPlayer"; - this.panelPlayer.Size = new System.Drawing.Size(478, 385); + this.panelPlayer.Size = new System.Drawing.Size(478, 349); this.panelPlayer.TabIndex = 0; // // tableLayoutPanel1 @@ -139,7 +137,7 @@ namespace DxPlay { this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(298, 322); + this.tableLayoutPanel1.Size = new System.Drawing.Size(298, 277); this.tableLayoutPanel1.TabIndex = 4; // // tabEditor @@ -150,13 +148,13 @@ namespace DxPlay { this.tabEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.tabEditor.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.tabEditor.ImageList = this.imagesTabEdit; - this.tabEditor.Location = new System.Drawing.Point(23, 4); + this.tabEditor.Location = new System.Drawing.Point(28, 4); this.tabEditor.Margin = new System.Windows.Forms.Padding(0, 4, 4, 4); this.tabEditor.Multiline = true; this.tabEditor.Name = "tabEditor"; this.tabEditor.Padding = new System.Drawing.Point(10, 5); this.tabEditor.SelectedIndex = 0; - this.tabEditor.Size = new System.Drawing.Size(271, 314); + this.tabEditor.Size = new System.Drawing.Size(266, 269); this.tabEditor.TabIndex = 2; // // tpMetadata @@ -168,7 +166,7 @@ namespace DxPlay { this.tpMetadata.Location = new System.Drawing.Point(4, 4); this.tpMetadata.Name = "tpMetadata"; this.tpMetadata.Padding = new System.Windows.Forms.Padding(3); - this.tpMetadata.Size = new System.Drawing.Size(263, 275); + this.tpMetadata.Size = new System.Drawing.Size(258, 199); this.tpMetadata.TabIndex = 0; this.tpMetadata.Text = "Metadata"; // @@ -181,7 +179,7 @@ namespace DxPlay { this.trafficBrowser.Margin = new System.Windows.Forms.Padding(0); this.trafficBrowser.Name = "trafficBrowser"; this.trafficBrowser.Parameters = null; - this.trafficBrowser.Size = new System.Drawing.Size(257, 269); + this.trafficBrowser.Size = new System.Drawing.Size(252, 193); this.trafficBrowser.TabIndex = 0; // // tpSegments @@ -193,7 +191,7 @@ namespace DxPlay { this.tpSegments.Location = new System.Drawing.Point(4, 4); this.tpSegments.Name = "tpSegments"; this.tpSegments.Padding = new System.Windows.Forms.Padding(3); - this.tpSegments.Size = new System.Drawing.Size(192, 30); + this.tpSegments.Size = new System.Drawing.Size(258, 199); this.tpSegments.TabIndex = 1; this.tpSegments.Text = "Segments"; this.tpSegments.UseVisualStyleBackColor = true; @@ -206,40 +204,25 @@ namespace DxPlay { this.dgSegments.AutoGenerateColumns = false; this.dgSegments.BackgroundColor = System.Drawing.Color.White; this.dgSegments.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgSegments.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dgSegments.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgSegments.DataSource = this.bsSegments; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgSegments.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgSegments.DefaultCellStyle = dataGridViewCellStyle1; this.dgSegments.Dock = System.Windows.Forms.DockStyle.Fill; this.dgSegments.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnF2; - this.dgSegments.Location = new System.Drawing.Point(3, 28); + this.dgSegments.Location = new System.Drawing.Point(3, 32); this.dgSegments.MultiSelect = false; this.dgSegments.Name = "dgSegments"; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgSegments.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.dgSegments.RowHeadersVisible = false; + this.dgSegments.RowHeadersWidth = 51; this.dgSegments.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgSegments.Size = new System.Drawing.Size(186, 0); + this.dgSegments.Size = new System.Drawing.Size(252, 164); this.dgSegments.TabIndex = 1; this.dgSegments.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.OnSegmentsCellBeginEdit); this.dgSegments.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnSegmentsCellContentClick); @@ -254,6 +237,7 @@ namespace DxPlay { // this.segmentActions.AutoSize = false; this.segmentActions.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.segmentActions.ImageScalingSize = new System.Drawing.Size(20, 20); this.segmentActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tbDefineSegment, this.toolStripSeparator2, @@ -265,7 +249,7 @@ namespace DxPlay { this.segmentActions.Location = new System.Drawing.Point(3, 3); this.segmentActions.Name = "segmentActions"; this.segmentActions.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.segmentActions.Size = new System.Drawing.Size(186, 25); + this.segmentActions.Size = new System.Drawing.Size(252, 29); this.segmentActions.TabIndex = 0; this.segmentActions.Text = "toolStrip1"; // @@ -276,14 +260,14 @@ namespace DxPlay { this.tbDefineSegment.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tbDefineSegment.ImageTransparentColor = System.Drawing.Color.Magenta; this.tbDefineSegment.Name = "tbDefineSegment"; - this.tbDefineSegment.Size = new System.Drawing.Size(23, 22); + this.tbDefineSegment.Size = new System.Drawing.Size(29, 26); this.tbDefineSegment.Text = "toolStripButton5"; this.tbDefineSegment.Click += new System.EventHandler(this.OnDefineOneSegmentClick); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 29); // // tbPositionAsTCIn // @@ -292,7 +276,7 @@ namespace DxPlay { this.tbPositionAsTCIn.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tbPositionAsTCIn.ImageTransparentColor = System.Drawing.Color.Magenta; this.tbPositionAsTCIn.Name = "tbPositionAsTCIn"; - this.tbPositionAsTCIn.Size = new System.Drawing.Size(23, 22); + this.tbPositionAsTCIn.Size = new System.Drawing.Size(29, 26); this.tbPositionAsTCIn.Text = "toolStripButton1"; this.tbPositionAsTCIn.Click += new System.EventHandler(this.OnActualPositionToTCInToolStripMenuItem1Click); // @@ -303,7 +287,7 @@ namespace DxPlay { this.tbSplitSegment.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tbSplitSegment.ImageTransparentColor = System.Drawing.Color.Magenta; this.tbSplitSegment.Name = "tbSplitSegment"; - this.tbSplitSegment.Size = new System.Drawing.Size(23, 22); + this.tbSplitSegment.Size = new System.Drawing.Size(29, 26); this.tbSplitSegment.Text = "toolStripButton4"; this.tbSplitSegment.Click += new System.EventHandler(this.OnSplitSegmentAtCurrentPositionClick); // @@ -314,14 +298,14 @@ namespace DxPlay { this.tbPositionAsTCOut.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tbPositionAsTCOut.ImageTransparentColor = System.Drawing.Color.Magenta; this.tbPositionAsTCOut.Name = "tbPositionAsTCOut"; - this.tbPositionAsTCOut.Size = new System.Drawing.Size(23, 22); + this.tbPositionAsTCOut.Size = new System.Drawing.Size(29, 26); this.tbPositionAsTCOut.Text = "toolStripButton2"; this.tbPositionAsTCOut.Click += new System.EventHandler(this.OnActualPositionToTCOutToolStripMenuItem1Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 29); // // tbDeleteSegment // @@ -330,7 +314,7 @@ namespace DxPlay { this.tbDeleteSegment.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tbDeleteSegment.ImageTransparentColor = System.Drawing.Color.Magenta; this.tbDeleteSegment.Name = "tbDeleteSegment"; - this.tbDeleteSegment.Size = new System.Drawing.Size(23, 22); + this.tbDeleteSegment.Size = new System.Drawing.Size(29, 26); this.tbDeleteSegment.Text = "toolStripButton3"; this.tbDeleteSegment.Click += new System.EventHandler(this.OnDeleteSegmentClick); // @@ -350,7 +334,7 @@ namespace DxPlay { this.btnToggleSegmentEditor.Location = new System.Drawing.Point(0, 4); this.btnToggleSegmentEditor.Margin = new System.Windows.Forms.Padding(0, 4, 0, 0); this.btnToggleSegmentEditor.Name = "btnToggleSegmentEditor"; - this.btnToggleSegmentEditor.Size = new System.Drawing.Size(23, 63); + this.btnToggleSegmentEditor.Size = new System.Drawing.Size(28, 72); this.btnToggleSegmentEditor.TabIndex = 0; this.btnToggleSegmentEditor.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnToggleSegmentEditor.UseVisualStyleBackColor = false; @@ -366,13 +350,13 @@ namespace DxPlay { this.pMetadataDisplay.Controls.Add(this.labelSelectedMetadata, 0, 0); this.pMetadataDisplay.Controls.Add(this.txtSelectedID, 0, 1); this.pMetadataDisplay.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pMetadataDisplay.Location = new System.Drawing.Point(0, 322); + this.pMetadataDisplay.Location = new System.Drawing.Point(0, 277); this.pMetadataDisplay.Margin = new System.Windows.Forms.Padding(0); this.pMetadataDisplay.Name = "pMetadataDisplay"; this.pMetadataDisplay.RowCount = 2; this.pMetadataDisplay.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.pMetadataDisplay.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.pMetadataDisplay.Size = new System.Drawing.Size(298, 63); + this.pMetadataDisplay.Size = new System.Drawing.Size(298, 72); this.pMetadataDisplay.TabIndex = 5; // // btnApprove @@ -384,10 +368,10 @@ namespace DxPlay { this.btnApprove.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnApprove.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.btnApprove.Image = ((System.Drawing.Image)(resources.GetObject("btnApprove.Image"))); - this.btnApprove.Location = new System.Drawing.Point(196, 29); + this.btnApprove.Location = new System.Drawing.Point(187, 32); this.btnApprove.Margin = new System.Windows.Forms.Padding(0, 4, 0, 0); this.btnApprove.Name = "btnApprove"; - this.btnApprove.Size = new System.Drawing.Size(102, 30); + this.btnApprove.Size = new System.Drawing.Size(111, 30); this.btnApprove.TabIndex = 17; this.btnApprove.Text = "Approve"; this.btnApprove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; @@ -404,7 +388,7 @@ namespace DxPlay { this.labelSelectedMetadata.Location = new System.Drawing.Point(3, 0); this.labelSelectedMetadata.Name = "labelSelectedMetadata"; this.labelSelectedMetadata.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5); - this.labelSelectedMetadata.Size = new System.Drawing.Size(190, 25); + this.labelSelectedMetadata.Size = new System.Drawing.Size(181, 28); this.labelSelectedMetadata.TabIndex = 13; this.labelSelectedMetadata.Text = "Selected metadata"; // @@ -414,18 +398,19 @@ namespace DxPlay { this.txtSelectedID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtSelectedID.Dock = System.Windows.Forms.DockStyle.Fill; this.txtSelectedID.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.txtSelectedID.Location = new System.Drawing.Point(3, 28); + this.txtSelectedID.Location = new System.Drawing.Point(3, 31); this.txtSelectedID.Name = "txtSelectedID"; - this.txtSelectedID.Size = new System.Drawing.Size(190, 32); + this.txtSelectedID.Size = new System.Drawing.Size(181, 38); this.txtSelectedID.TabIndex = 12; // // mainMenu // + this.mainMenu.ImageScalingSize = new System.Drawing.Size(20, 20); this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem}); this.mainMenu.Location = new System.Drawing.Point(0, 0); this.mainMenu.Name = "mainMenu"; - this.mainMenu.Size = new System.Drawing.Size(784, 24); + this.mainMenu.Size = new System.Drawing.Size(784, 28); this.mainMenu.TabIndex = 21; this.mainMenu.Text = "menuStrip1"; // @@ -437,14 +422,14 @@ namespace DxPlay { this.toolStripSeparator3, this.menuRedefineSegments}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); this.fileToolStripMenuItem.Text = "File"; // // menuOpenFile // this.menuOpenFile.Name = "menuOpenFile"; this.menuOpenFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.menuOpenFile.Size = new System.Drawing.Size(215, 22); + this.menuOpenFile.Size = new System.Drawing.Size(269, 26); this.menuOpenFile.Text = "Open file"; this.menuOpenFile.Click += new System.EventHandler(this.menuOpenFile_Click); // @@ -452,20 +437,20 @@ namespace DxPlay { // this.menuApprove.Name = "menuApprove"; this.menuApprove.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.menuApprove.Size = new System.Drawing.Size(215, 22); + this.menuApprove.Size = new System.Drawing.Size(269, 26); this.menuApprove.Text = "Approve"; this.menuApprove.Click += new System.EventHandler(this.OnApprove); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(212, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(266, 6); // // menuRedefineSegments // this.menuRedefineSegments.Name = "menuRedefineSegments"; this.menuRedefineSegments.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); - this.menuRedefineSegments.Size = new System.Drawing.Size(215, 22); + this.menuRedefineSegments.Size = new System.Drawing.Size(269, 26); this.menuRedefineSegments.Text = "Redefine segments"; this.menuRedefineSegments.Click += new System.EventHandler(this.OnRedefineSegments); // @@ -475,17 +460,17 @@ namespace DxPlay { this.flowLayoutPanel1.Controls.Add(this.btnSave); this.flowLayoutPanel1.Controls.Add(this.btnCancel); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 532); + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 528); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.flowLayoutPanel1.Size = new System.Drawing.Size(784, 29); + this.flowLayoutPanel1.Size = new System.Drawing.Size(784, 33); this.flowLayoutPanel1.TabIndex = 23; // // btnSave // - this.btnSave.Location = new System.Drawing.Point(706, 3); + this.btnSave.Location = new System.Drawing.Point(691, 3); this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 23); + this.btnSave.Size = new System.Drawing.Size(90, 27); this.btnSave.TabIndex = 0; this.btnSave.Text = "Save"; this.btnSave.UseVisualStyleBackColor = true; @@ -493,9 +478,9 @@ namespace DxPlay { // // btnCancel // - this.btnCancel.Location = new System.Drawing.Point(625, 3); + this.btnCancel.Location = new System.Drawing.Point(595, 3); this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.Size = new System.Drawing.Size(90, 27); this.btnCancel.TabIndex = 1; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; @@ -507,16 +492,16 @@ namespace DxPlay { this.playerControls.BackColor = System.Drawing.Color.Transparent; this.playerControls.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.playerControls.Dock = System.Windows.Forms.DockStyle.Bottom; - this.playerControls.Location = new System.Drawing.Point(0, 411); + this.playerControls.Location = new System.Drawing.Point(0, 379); this.playerControls.Margin = new System.Windows.Forms.Padding(0); this.playerControls.Name = "playerControls"; - this.playerControls.Size = new System.Drawing.Size(784, 121); + this.playerControls.Size = new System.Drawing.Size(784, 149); this.playerControls.TabIndex = 22; // // PlayerForm // this.AllowDrop = true; - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(784, 561); this.Controls.Add(this.mainSplit); @@ -525,7 +510,7 @@ namespace DxPlay { this.Controls.Add(this.flowLayoutPanel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; - this.MinimumSize = new System.Drawing.Size(640, 480); + this.MinimumSize = new System.Drawing.Size(768, 554); this.Name = "PlayerForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MediaCube Player"; @@ -599,5 +584,4 @@ namespace DxPlay { private System.Windows.Forms.SplitContainer mainSplit; private System.Windows.Forms.Panel pVideo; } -} - +} \ No newline at end of file diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index b17625f4..4265ff76 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -1,6 +1,7 @@ using DxPlay.Model; using DxPlay.Properties; using MaestroShared.Commons; +using MaestroShared.Controls; using MaestroShared.Metadata; using NLog; using System; @@ -9,10 +10,13 @@ using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; +using Logger = NLog.Logger; -namespace DxPlay { +namespace DxPlay +{ - public partial class PlayerForm : Form { + public partial class PlayerForm : Form + { private const string TITLE = "MediaCube Player"; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private const string DEFAULT_FILE_FILTER = "MXF files (*.MXF)|*.MXF"; @@ -27,11 +31,14 @@ namespace DxPlay { private bool isPauseButtonClicked = false; private DxPlaySettings settings; - public DxPlaySettings Settings { - get { + public DxPlaySettings Settings + { + get + { return settings; } - set { + set + { settings = value ?? throw new NullReferenceException("DxPlaySettings"); Model = new DxPlayModel(value); //default 1 kell legyen: HTV uj szegmens = elozo szegmens vege + 1 @@ -41,9 +48,11 @@ namespace DxPlay { } private DxPlayModel model; - public DxPlayModel Model { + public DxPlayModel Model + { get { return model; } - set { + set + { model = value ?? throw new NullReferenceException("DxPlayModel"); ApplyModel(); } @@ -62,7 +71,8 @@ namespace DxPlay { public bool openFileDialogOpened; - private void ApplyModel() { + private void ApplyModel() + { bsSegments.DataSource = model.Segments; dgSegments.AutoGenerateColumns = true; mainMenu.DataBindings.Add(new Binding("Visible", model, "IsMenuVisible", false, DataSourceUpdateMode.Never)); @@ -70,11 +80,14 @@ namespace DxPlay { menuApprove.DataBindings.Add(new Binding("Enabled", model, "IsApproveEnabled", false, DataSourceUpdateMode.Never)); //menuRedefineSegments.DataBindings.Add(new Binding("Enabled", model, "IsRedefineSegmentsEnabled", false, DataSourceUpdateMode.Never)); - if (model.IsMenuVisible) { + if (model.IsMenuVisible) + { btnApprove.DataBindings.Add(new Binding("Enabled", model, "IsApproveEnabled", false, DataSourceUpdateMode.Never)); tpSegments.DataBindings.Add(new Binding("Enabled", model, "IsSegmentEditorVisible", false, DataSourceUpdateMode.Never)); txtSelectedID.DataBindings.Add(new Binding("Text", model, "ID", false, DataSourceUpdateMode.Never)); - } else { + } + else + { pMetadataDisplay.Visible = false; tabEditor.TabPages.Remove(tpMetadata); } @@ -91,19 +104,24 @@ namespace DxPlay { } - private void OnSelectedIDChanged(string ID, int variantID, string serialID, string text, List selected) { + private void OnSelectedIDChanged(string ID, int variantID, string serialID, string text, List selected) + { //logger.Info("Selected ID: " + ID); - try { + try + { model.SelectedSegments = selected; model.VariantID = variantID; model.ID = ID; - } catch (Exception e) { + } + catch (Exception e) + { MsgBox.Error(e.Message); logger.Error(e); } } - public PlayerForm() { + public PlayerForm() + { InitializeComponent(); playerControls.Pause.Click += Pause_Click; @@ -118,11 +136,17 @@ namespace DxPlay { playerControls.StepForward.MouseUp += OnStepForwardMouseUp; playerControls.StepForward.MouseDown += OnStepForwardMouseDown; + playerControls.TrackBar.MouseDown += OnTrackBarMouseDown; playerControls.TrackBar.MouseUp += OnTrackBarMouseUp; playerControls.TrackBar.Scroll += OnTrackBarScroll; } + private void OnPlaySpeedValueChanged(object sender, EventArgs e) + { + Console.WriteLine(sender.GetType()); + } + private void Pause_Click(object sender, EventArgs e) { if (!isPauseButtonClicked) @@ -132,7 +156,8 @@ namespace DxPlay { } } - private void InitializeTexts() { + private void InitializeTexts() + { tpMetadata.Text = Settings.Resource("METADATA", Resources.METADATA); tpSegments.Text = Settings.Resource("SEGMENTS", Resources.SEGMENTS); tbPositionAsTCIn.Text = Settings.Resource("POSITIONASTCIN", Resources.POSITIONASTCIN); @@ -157,14 +182,17 @@ namespace DxPlay { playerControls.Duration.Text = Settings.Resource("LENGTH", Resources.LENGTH); } - private void CloseForm() { + private void CloseForm() + { m_play?.Dispose(); Close(); } - private void Cueue() { + private void Cueue() + { m_play = null; - try { + try + { //m_mediaDescription = MediaDetector.GetDescription(selectedFile); m_mediaDescription = new MediaDescription() { fileName = model.CurrentFile.FullName }; @@ -175,26 +203,32 @@ namespace DxPlay { throw new Exception(model.CurrentFile.FullName); m_play.PlayEvent += new DxPlayEvent(OnPlayEvent); - if (m_mediaDescription != null) { + if (m_mediaDescription != null) + { playerControls.TrackBar.Maximum = m_mediaDescription.Duration.Frames; playerControls.StartTC.Text = m_mediaDescription.FirstFrame.ToString(); playerControls.EndTC.Text = m_mediaDescription.Duration.ToString(); } - } catch (Exception ce) { + } + catch (Exception ce) + { MessageBox.Show("Az állomány nem tölthetõ be. A rendszer üzenete: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error); CloseForm(); } } - private void Form1_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) { + private void Form1_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.Length == 1) e.Effect = DragDropEffects.Copy; } } - public void OpenFile(FileInfo fileInfo, bool redefine) { + public void OpenFile(FileInfo fileInfo, bool redefine) + { logger.Debug("Open {0}", fileInfo.FullName); if (m_play != null) @@ -204,15 +238,19 @@ namespace DxPlay { model.CurrentFile = fileInfo; Cueue(); - if (model.IsMenuVisible) { + if (model.IsMenuVisible) + { tabEditor.SelectedTab = tpMetadata; trafficBrowser.ClearLookup(); openFileDialog.InitialDirectory = fileInfo.Directory.FullName; openFileDialog.Filter = DEFAULT_FILE_FILTER; string id = fileInfo.Name.Replace(fileInfo.Extension, ""); - try { + try + { model.Lookup(id); - } catch (Exception e) { + } + catch (Exception e) + { MsgBox.Error(e.Message); logger.Error(e); } @@ -228,51 +266,63 @@ namespace DxPlay { } - private void Form1_DragDrop(object sender, DragEventArgs e) { + private void Form1_DragDrop(object sender, DragEventArgs e) + { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); FileInfo fileInfo = new FileInfo(files[0]); OpenFile(fileInfo, false); } - private void panel1_MouseDown(object sender, MouseEventArgs e) { - if (m_play != null && e.Button == MouseButtons.Left) { + private void panel1_MouseDown(object sender, MouseEventArgs e) + { + if (m_play != null && e.Button == MouseButtons.Left) + { DateTime currentClick = DateTime.Now; - if ((currentClick - lastClick).TotalMilliseconds < 300) { + if ((currentClick - lastClick).TotalMilliseconds < 300) + { m_play.ToggleFullscreen(); logger.Debug("Fullscreen"); - } else + } + else lastClick = currentClick; } } - private void panel1_SizeChanged(object sender, EventArgs e) { + private void panel1_SizeChanged(object sender, EventArgs e) + { if (m_play != null) m_play.UpdateVideoWindow(); } - private void OnTrackBarMouseDown(object sender, MouseEventArgs e) { + private void OnTrackBarMouseDown(object sender, MouseEventArgs e) + { trackBarAtUser = true; lastClick = DateTime.Now; } - private void OnTrackBarMouseUp(object sender, MouseEventArgs e) { + private void OnTrackBarMouseUp(object sender, MouseEventArgs e) + { trackBarAtUser = false; } - private void OnTrackBarScroll(object sender, ScrollEventArgs e) { + private void OnTrackBarScroll(object sender, ScrollEventArgs e) + { if (m_play != null) m_play.Seek(playerControls.TrackBar.Value); } - private void PlayOrPause() { + private void PlayOrPause() + { if (m_play == null) return; - if (m_play.State == GraphState.Playing) { + if (m_play.State == GraphState.Playing) + { Pause(); return; } - if (m_play.State == GraphState.Completed) { + if (m_play.State == GraphState.Completed) + { m_play.Stop(); } m_play.Play(); @@ -293,27 +343,35 @@ namespace DxPlay { } } - private void UpdatePlayButton() { - if (m_play.State == GraphState.Playing) { + private void UpdatePlayButton() + { + if (m_play.State == GraphState.Playing) + { playerControls.Play.Image = Resources.ic_pause_black_24dp_2x; tooltips.SetToolTip(playerControls.Play, Settings.Resource("PAUSE", Resources.PAUSE)); - } else { + } + else + { playerControls.Play.Image = Resources.ic_play_arrow_black_24dp_2x; tooltips.SetToolTip(playerControls.Play, Settings.Resource("PLAY", Resources.PLAY)); } } - private void Pause() { + private void Pause() + { m_play.Pause(); UpdatePlayButton(); } - private void OnPlayClick(object sender, EventArgs e) { + private void OnPlayClick(object sender, EventArgs e) + { PlayOrPause(); } - private void OnStopClick(object sender, EventArgs e) { - if (m_play != null && m_play.State != GraphState.Stopped) { + private void OnStopClick(object sender, EventArgs e) + { + if (m_play != null && m_play.State != GraphState.Stopped) + { m_play.Stop(); } } @@ -321,70 +379,92 @@ namespace DxPlay { private bool buttonDown; - private void OnRewindMouseUp(object sender, MouseEventArgs e) { + private void OnRewindMouseUp(object sender, MouseEventArgs e) + { buttonDown = false; } - private void OnRewindMouseDown(object sender, MouseEventArgs e) { + private void OnRewindMouseDown(object sender, MouseEventArgs e) + { buttonDown = true; - do { - m_play.Rewind(10); - Application.DoEvents(); + do + { + if (m_play != null && m_play.State == GraphState.Playing) + { + m_play.Rewind(10); + Application.DoEvents(); + } } while (buttonDown); } - private void OnForwardMouseUp(object sender, MouseEventArgs e) { + private void OnForwardMouseUp(object sender, MouseEventArgs e) + { buttonDown = false; } - private void OnForwardMouseDown(object sender, EventArgs e) { + private void OnForwardMouseDown(object sender, EventArgs e) + { buttonDown = true; - do { - m_play.Forward(10); - Application.DoEvents(); + do + { + if (m_play != null && m_play.State == GraphState.Playing) + { + m_play.Forward(10); + Application.DoEvents(); + } } while (buttonDown); } - private void OnStepBackMouseUp(object sender, MouseEventArgs e) { + private void OnStepBackMouseUp(object sender, MouseEventArgs e) + { buttonDown = false; } - private void OnStepBackMouseDown(object sender, MouseEventArgs e) { + private void OnStepBackMouseDown(object sender, MouseEventArgs e) + { buttonDown = true; - do { + do + { m_play.Rewind(1); Application.DoEvents(); } while (buttonDown); } - private void OnStepForwardMouseUp(object sender, MouseEventArgs e) { + private void OnStepForwardMouseUp(object sender, MouseEventArgs e) + { buttonDown = false; } - private void OnStepForwardMouseDown(object sender, EventArgs e) { + private void OnStepForwardMouseDown(object sender, EventArgs e) + { buttonDown = true; - do { + do + { m_play.Forward(1); Application.DoEvents(); } while (buttonDown); } - private void Rewind() { + private void Rewind() + { if (m_play == null) return; int step = ModifierKeys.HasFlag(Keys.Control) ? 10 : 1; m_play.Rewind(step); } - private void Forward() { + private void Forward() + { if (m_play == null) return; int step = ModifierKeys.HasFlag(Keys.Control) ? 10 : 1; m_play.Forward(step); } - private void PlayerForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { - if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Space || e.KeyCode == Keys.Escape) { + private void PlayerForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Space || e.KeyCode == Keys.Escape) + { e.IsInputKey = false; } } @@ -399,7 +479,8 @@ namespace DxPlay { // } //} - private void PlayerForm_Load(object sender, EventArgs e) { + private void PlayerForm_Load(object sender, EventArgs e) + { //DisableHotKeysDefaults(this.Controls); InterceptKeys.Start(); @@ -416,24 +497,29 @@ namespace DxPlay { trafficBrowser.BackColor = BackColor; //Csak standalone modban - if (Model.IsMenuVisible) { + if (Model.IsMenuVisible) + { trafficBrowser.IDChangedEvent += OnSelectedIDChanged; model.InitializeTrafficIntegration(trafficBrowser); } } - private void PlayerForm_KeyDown(object sender, KeyEventArgs e) { + private void PlayerForm_KeyDown(object sender, KeyEventArgs e) + { if (dgSegments.IsCurrentCellInEditMode) return; - if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Space || e.KeyCode == Keys.Escape) { + if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Space || e.KeyCode == Keys.Escape) + { e.Handled = true; e.SuppressKeyPress = true; } } - public static bool ApplicationIsActivated() { + public static bool ApplicationIsActivated() + { var activatedHandle = GetForegroundWindow(); - if (activatedHandle == IntPtr.Zero) { + if (activatedHandle == IntPtr.Zero) + { return false; // No window is currently activated } @@ -450,15 +536,18 @@ namespace DxPlay { [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int GetWindowThreadProcessId(IntPtr handle, out int processId); - private bool HandleHotKey(Keys keyCode) { + private bool HandleHotKey(Keys keyCode) + { logger.Debug("Key pressed " + keyCode); if (!ApplicationIsActivated() || trafficBrowser.ContainsFocus || openFileDialogOpened || dgSegments.IsCurrentCellInEditMode || (m_play != null && !m_play.IsFullscreen() && !ContainsFocus)) return false; logger.Debug("Handling " + keyCode); bool result = false; - switch (keyCode) { + switch (keyCode) + { case Keys.Return: - if (m_play != null && ModifierKeys.HasFlag(Keys.Shift)) { + if (m_play != null && ModifierKeys.HasFlag(Keys.Shift)) + { m_play.ToggleFullscreen(); result = true; } @@ -495,7 +584,8 @@ namespace DxPlay { return result; } - private void OnPlayEvent() { + private void OnPlayEvent() + { if (!IsHandleCreated || Disposing || IsDisposed || m_play == null) return; @@ -521,24 +611,29 @@ namespace DxPlay { } - private void PlayerForm_FormClosing(object sender, FormClosingEventArgs e) { + private void PlayerForm_FormClosing(object sender, FormClosingEventArgs e) + { //if (m_play != null) // m_play.Dispose(); } - private void ProcessCommandLine() { + private void ProcessCommandLine() + { String[] arguments = Environment.GetCommandLineArgs(); - if (arguments.Length > 1) { + if (arguments.Length > 1) + { FileInfo fi = new FileInfo(arguments[1]); if (fi.Exists) OpenFile(fi, false); } } - private void PlayerForm_Shown(object sender, EventArgs e) { + private void PlayerForm_Shown(object sender, EventArgs e) + { logger.Debug("PlayerForm_Shown"); InitializeTexts(); - if (true.Equals(Settings?.Player?.SegmentEditor) && true.Equals(Settings?.IsStandalone)) { + if (true.Equals(Settings?.Player?.SegmentEditor) && true.Equals(Settings?.IsStandalone)) + { mainMenu.Visible = true; } @@ -548,25 +643,29 @@ namespace DxPlay { m_play.Play(); } - private void PlayerForm_FormClosed(object sender, FormClosedEventArgs e) { + private void PlayerForm_FormClosed(object sender, FormClosedEventArgs e) + { InterceptKeys.Stop(); if (m_play != null) m_play.Dispose(); } - private void menuOpenFile_Click(object sender, EventArgs e) { + private void menuOpenFile_Click(object sender, EventArgs e) + { openFileDialogOpened = true; if (openFileDialog.ShowDialog() == DialogResult.OK) OpenFile(new FileInfo(openFileDialog.FileName), false); openFileDialogOpened = false; } - private void OnApprove(object sender, EventArgs e) { + private void OnApprove(object sender, EventArgs e) + { if (m_play == null) return; - try { + try + { m_play.Seek(0); m_play.Dispose(); @@ -582,16 +681,20 @@ namespace DxPlay { btnApprove.Text = Settings.Resource("APPROVE", Resources.APPROVE); model.IsRedefineSegments = false; - } catch (Exception ex) { + } + catch (Exception ex) + { logger.Error(ex); MsgBox.Error(ex.Message); } } - private void OnRedefineSegments(object sender, EventArgs e) { + private void OnRedefineSegments(object sender, EventArgs e) + { openFileDialogOpened = true; - if (openFileDialog.ShowDialog() == DialogResult.OK) { + if (openFileDialog.ShowDialog() == DialogResult.OK) + { model.RedefineSegmentMediaID = Path.GetFileNameWithoutExtension(openFileDialog.FileName); model.IsRedefineSegments = true; OpenFile(new FileInfo(openFileDialog.FileName), true); @@ -601,12 +704,14 @@ namespace DxPlay { btnApprove.Text = Settings.Resource("REDEFINE", Resources.REDEFINE); } - private void btnSave_Click(object sender, EventArgs e) { + private void btnSave_Click(object sender, EventArgs e) + { settings.Segments = model.Segments; CloseForm(); } - private void btnCancel_Click(object sender, EventArgs e) { + private void btnCancel_Click(object sender, EventArgs e) + { CloseForm(); } } diff --git a/client/DxPlay/PlayerForm.resx b/client/DxPlay/PlayerForm.resx index 9a2c4936..45243086 100644 --- a/client/DxPlay/PlayerForm.resx +++ b/client/DxPlay/PlayerForm.resx @@ -127,7 +127,7 @@ iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAC8SURBVDhP1ZO9DcIwFISfqKGjpaENG4S/GZiEOiWMkR2Y + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAC8SURBVDhP1ZO9DcIwFISfqKGjpaENG4S/GZiEOiWMkR2Y gREo2IEVaBDcOXnS48m24lRw0qf4nHeXxFLkZ3UC15GcQVAF3uAGYoM5mGF2BWTfG15LpdmdNb6Ib3ro lkkNKtJ9fgJLY9KZrTWpIvICLZgDq+Ii8gQNsNKZjTW5ogtYAq/BRXcQDjIhza6t8UVTMOmWSX0V8aBo joA3SmCG2RrIDDz6jTEwy46gBfBPi4WIn2M2K/9fKX8hkQ9xw2LrlhXH8QAAAABJRU5ErkJggg== @@ -136,7 +136,7 @@ iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABOSURBVDhPYxgFVAWOUJoiUALE/4HYB8wjE8AMmQbmkQmo + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABOSURBVDhPYxgFVAWOUJoiUALE/4HYB8wjE8AMmQbmkQmo asg8MI8C0ADEMIMYQQKUgG4gpoqrQABmGEXhBAMww3zBPAqBG5QeBWQBBgYAaigQp+qpuEkAAAAASUVO RK5CYII= @@ -144,7 +144,7 @@ iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABlSURBVDhPYxjZ4AAUUwxGDUIFFUDcD2HCATaDQGoKIEzs + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABlSURBVDhPYxjZ4AAUUwxGDUIFFUDcD2HCATaDQGoKIEzs oIGRkfE/kEY2DN2gfqiaBggXN+hGMwzZIJgh3RAuYQAzrB2IYQa1k2oIDMAM+wHC5BoCA2DDKDUEBkAG UGzIkAUMDABv+SVD4UMwTwAAAABJRU5ErkJggg== @@ -152,7 +152,7 @@ iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABOSURBVDhPYxgFFAMnKE0R8APi/0BcAuZRCKYBMdUMmwfE + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABOSURBVDhPYxgFFAMnKE0R8APi/0BcAuZRCKYBMdUMmwfE VDGMEYiXADHFhoEMgrmqASRADkA2pBskQC6giiH+QEyxITDgBqVHAcWAgQEAtZ4QxOLkcD0AAAAASUVO RK5CYII= @@ -160,7 +160,7 @@ iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABvSURBVDhPYxhZwBVK4wOOUBoncAPi/0DcDuZhByA5kBon + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABvSURBVDhPYxhZwBVK4wOOUBoncAPi/0DcDuZhByA5kBon MA8P6AdiXIbBDAGpIQpgM4xkQ2AAZlg9EDdA2SQbAgPTgBhkAEWGgADMVRQZBDME5C2yvQYzhKLAxmYI DBBtGFUTJDFZhBg1wwMwMAAAvx8nVwi8b+UAAAAASUVORK5CYII= @@ -173,7 +173,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABo - CAAAAk1TRnQBSQFMAgEBAgEAAWgBAgFoAQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAZABAgGQAQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/client/DxPlay/PlayerGraph.cs b/client/DxPlay/PlayerGraph.cs index 921010f6..beee83bc 100644 --- a/client/DxPlay/PlayerGraph.cs +++ b/client/DxPlay/PlayerGraph.cs @@ -5,8 +5,10 @@ using NLog; using System; using System.Runtime.InteropServices; -namespace DxPlay { - public class PlayerGraph : FilterGraph, IDisposable { +namespace DxPlay +{/*lejatsztasi sebesseg megkeresese */ + public class PlayerGraph : FilterGraph, IDisposable + { #if DEBUG private DsROTEntry m_DsRot; #endif @@ -20,8 +22,10 @@ namespace DxPlay { private bool isDisposed; - public PlayerGraph(string fileName, IntPtr handle, VideoRendererType rendererType) { - try { + public PlayerGraph(string fileName, IntPtr handle, VideoRendererType rendererType) + { + try + { MediaSeeking = this as IMediaSeeking; MediaControl = this as IMediaControl; MediaEvent = this as IMediaEvent; @@ -35,14 +39,16 @@ namespace DxPlay { IBaseFilter splitter = AddSplitter(graphBuilder, sourceFilter); bool audioOnly = true; - if (DsFindPin.ByName(splitter, "Video") != null) { + if (DsFindPin.ByName(splitter, "Video") != null) + { audioOnly = false; IBaseFilter videoDecoder = AddVideoDecoder(graphBuilder, splitter); EnableDeinterlace(videoDecoder); IBaseFilter sampleGrabber = AddSampleGrabber(graphBuilder, videoDecoder); SampleGrabber = (ISampleGrabber)sampleGrabber; - switch (rendererType) { + switch (rendererType) + { case VideoRendererType.VM7: AddVM7Renderer(graphBuilder, sampleGrabber); break; @@ -62,38 +68,49 @@ namespace DxPlay { FilterGraphTools.RenderPin(graphBuilder, sampleGrabber, "Output"); ConfigureSimpleRenderer(handle); - } else { + } + else + { logger.Warn("Video pin not available"); } - if (DsFindPin.ByName(splitter, "Audio") != null) { + if (DsFindPin.ByName(splitter, "Audio") != null) + { IBaseFilter audioDecoder = AddAudioDecoder(graphBuilder, splitter); - if (audioOnly) { + if (audioOnly) + { throw new Exception("Audio only file is not supported."); //IBaseFilter sampleGrabber = AddSampleGrabber(graphBuilder, audioDecoder); //SampleGrabber = (ISampleGrabber)sampleGrabber; //FilterGraphTools.RenderPin(graphBuilder, sampleGrabber, "Output"); - } else + } + else FilterGraphTools.RenderPin(graphBuilder, audioDecoder, "Output"); - } else { + } + else + { logger.Warn("Audio pin not available"); } SearchAudioTracks(splitter); - } catch (Exception e) { + } + catch (Exception e) + { logger.Error(e.Message); throw e; } } - private void EnableDeinterlace(IBaseFilter videoDecoder) { + private void EnableDeinterlace(IBaseFilter videoDecoder) + { logger.Debug("Enable YADIF deinterlace"); ILAVVideoSettings settings = (ILAVVideoSettings)videoDecoder; settings.SetSWDeintMode(LAVSWDeintModes.SWDeintMode_YADIF); settings.SetSWDeintOutput(LAVDeintOutput.DeintOutput_FramePer2Field); } - private IBaseFilter AddAudioDecoder(IGraphBuilder graphBuilder, IBaseFilter splitter) { + private IBaseFilter AddAudioDecoder(IGraphBuilder graphBuilder, IBaseFilter splitter) + { logger.Debug("Add LAVAudio to graph"); IBaseFilter audioDecoder = null; audioDecoder = LoadAudioDecoder(graphBuilder); @@ -105,20 +122,24 @@ namespace DxPlay { return audioDecoder; } - private IBaseFilter AddVM9Renderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) { + private IBaseFilter AddVM9Renderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) + { logger.Debug("Add VideoMixingRenderer9 to graph"); IBaseFilter videoRenderer = (IBaseFilter)new VideoMixingRenderer9(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(videoRenderer, "Video Mixing Renderer 9")); logger.Debug("Connect SampleGrabber -> VideoMixingRenderer9"); - try { + try + { //IVMRFilterConfig9 filterConfig = (IVMRFilterConfig9) videoRenderer; //filterConfig.SetRenderingMode(VMR9Mode.Windowless); //WindowlessControl = (IVMRWindowlessControl9) videoRenderer; //WindowlessControl.SetVideoClippingWindow(handle); //WindowlessControl.SetAspectRatioMode(VMR9AspectRatioMode.LetterBox); FilterGraphTools.ConnectFilters(graphBuilder, sampleGrabber, "Output", videoRenderer, "VMR Input0", true); - } catch (Exception e) { + } + catch (Exception e) + { logger.Error(e); graphBuilder.RemoveFilter(videoRenderer); logger.Info("Trying default VideoRenderer instead Video Mixing Renderer 9"); @@ -128,20 +149,24 @@ namespace DxPlay { return videoRenderer; } - private IBaseFilter AddVM7Renderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) { + private IBaseFilter AddVM7Renderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) + { logger.Debug("Add VideoMixingRenderer7 to graph"); IBaseFilter videoRenderer = (IBaseFilter)new VideoMixingRenderer(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(videoRenderer, "Video Mixing Renderer 7")); logger.Debug("Connect SampleGrabber -> VideoMixingRenderer7"); - try { + try + { //IVMRFilterConfig9 filterConfig = (IVMRFilterConfig9) videoRenderer; //filterConfig.SetRenderingMode(VMR9Mode.Windowless); //WindowlessControl = (IVMRWindowlessControl9) videoRenderer; //WindowlessControl.SetVideoClippingWindow(handle); //WindowlessControl.SetAspectRatioMode(VMR9AspectRatioMode.LetterBox); FilterGraphTools.ConnectFilters(graphBuilder, sampleGrabber, "Output", videoRenderer, "VMR Input0", true); - } catch (Exception e) { + } + catch (Exception e) + { logger.Error(e); graphBuilder.RemoveFilter(videoRenderer); logger.Info("Trying default VideoRenderer instead Video Mixing Renderer 7"); @@ -151,7 +176,8 @@ namespace DxPlay { return videoRenderer; } - private void ConfigureSimpleRenderer(IntPtr handle) { + private void ConfigureSimpleRenderer(IntPtr handle) + { // Set the output window int hr; @@ -170,14 +196,16 @@ namespace DxPlay { DsError.ThrowExceptionForHR(hr); } - private IBaseFilter AddDefaultRenderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) { + private IBaseFilter AddDefaultRenderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) + { logger.Debug("Add default VideoRenderer to graph"); IBaseFilter videoRenderer = (IBaseFilter)new VideoRendererDefault(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(videoRenderer, "VideoRendererDefault")); //FilterGraphTools.ConnectFilters(graphBuilder, sampleGrabber, "Output", videoRenderer, "VMR Input0", true); return videoRenderer; } - private IBaseFilter AddEVRRenderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) { + private IBaseFilter AddEVRRenderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber) + { logger.Debug("Add EVR VideoRenderer to graph"); IBaseFilter videoRenderer = (IBaseFilter)new EnhancedVideoRenderer(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(videoRenderer, "EnhancedVideoRenderer")); @@ -185,7 +213,8 @@ namespace DxPlay { return videoRenderer; } - private IBaseFilter AddSampleGrabber(IGraphBuilder graphBuilder, IBaseFilter videoDecoder) { + private IBaseFilter AddSampleGrabber(IGraphBuilder graphBuilder, IBaseFilter videoDecoder) + { logger.Debug("Add SampleGrabber to graph"); IBaseFilter grabber = (IBaseFilter)new SampleGrabber(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(grabber, "Sample Grabber")); @@ -194,7 +223,8 @@ namespace DxPlay { return grabber; } - private IBaseFilter AddVideoDecoder(IGraphBuilder graphBuilder, IBaseFilter splitter) { + private IBaseFilter AddVideoDecoder(IGraphBuilder graphBuilder, IBaseFilter splitter) + { logger.Debug("Add LAVVideo to graph"); IBaseFilter videoDecoder = LoadVideoDecoder(graphBuilder); @@ -206,7 +236,8 @@ namespace DxPlay { return videoDecoder; } - private IBaseFilter AddSplitter(IGraphBuilder graphBuilder, IBaseFilter sourceFilter) { + private IBaseFilter AddSplitter(IGraphBuilder graphBuilder, IBaseFilter sourceFilter) + { logger.Debug("Add LAVSplitter to graph"); IBaseFilter splitter = LoadSplitter(graphBuilder); if (splitter == null) @@ -216,14 +247,18 @@ namespace DxPlay { return splitter; } - private void SearchAudioTracks(IBaseFilter splitter) { + private void SearchAudioTracks(IBaseFilter splitter) + { IAMStreamSelect amStreamSelect = (IAMStreamSelect)splitter; - if (amStreamSelect != null) { + if (amStreamSelect != null) + { amStreamSelect.Count(out int count); int audioCount = 0; - for (int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) + { amStreamSelect.Info(i, out AMMediaType ppmt, out AMStreamSelectInfoFlags pdwFlags, out int plcid, out int pdwGroup, out string ppszName, out object ppObject, out object ppUnk); - if (ppmt.majorType == MediaType.Audio) { + if (ppmt.majorType == MediaType.Audio) + { logger.Debug("Found audio channel"); audioCount++; } @@ -237,7 +272,8 @@ namespace DxPlay { } } - private IBaseFilter LoadVideoDecoder(IGraphBuilder graphBuilder) { + private IBaseFilter LoadVideoDecoder(IGraphBuilder graphBuilder) + { IBaseFilter videoDecoder = null; ILAVVideoSettings lavVideoSettings; videoDecoder = FilterProvider.GetVideoFilter(out lavVideoSettings); @@ -248,7 +284,8 @@ namespace DxPlay { return videoDecoder; } - private IBaseFilter LoadAudioDecoder(IGraphBuilder graphBuilder) { + private IBaseFilter LoadAudioDecoder(IGraphBuilder graphBuilder) + { IBaseFilter audioDecoder = null; ILAVAudioSettings lavAudioSettings; ILAVAudioStatus lavAudioStatus; @@ -260,7 +297,8 @@ namespace DxPlay { return audioDecoder; } - private IBaseFilter LoadSplitter(IGraphBuilder graphBuilder) { + private IBaseFilter LoadSplitter(IGraphBuilder graphBuilder) + { IBaseFilter splitter = null; ILAVSplitterSettings lavSplitterSettings; splitter = FilterProvider.GetSplitter(out lavSplitterSettings); @@ -273,8 +311,10 @@ namespace DxPlay { } // Shut down capture - public void Dispose() { - lock (this) { + public void Dispose() + { + lock (this) + { if (isDisposed) return; logger.Debug("Dispose"); @@ -283,7 +323,8 @@ namespace DxPlay { m_DsRot.Dispose(); #endif IMediaControl mediaCtrl = (IMediaControl)this; - if (mediaCtrl != null) { + if (mediaCtrl != null) + { mediaCtrl.Stop(); IGraphBuilder graphBuilder = (IGraphBuilder)mediaCtrl; FilterGraphTools.DisconnectAllPins(graphBuilder); -- 2.54.0