From 570e888f3d8e4d37037d047f4151ad4826763ab0 Mon Sep 17 00:00:00 2001 From: Omar Sweidan Date: Wed, 25 May 2022 11:57:51 +0200 Subject: [PATCH] =?utf8?q?Audios=C3=A1v=20v=C3=A1laszt=C3=A1s=C3=A1nak=20l?= =?utf8?q?ehet=C5=91s=C3=A9ge?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../Controls/PlayerControls.Designer.cs | 59 +++++++++--- client/DxPlay/Controls/PlayerControls.cs | 7 +- client/DxPlay/DxPlayer.cs | 8 ++ client/DxPlay/LAVInterfaces.cs | 4 +- client/DxPlay/PlayerForm.Designer.cs | 92 +++++++++---------- client/DxPlay/PlayerForm.cs | 24 ++++- client/DxPlay/PlayerForm.resx | 12 +-- client/DxPlay/PlayerGraph.cs | 59 ++++++------ 8 files changed, 164 insertions(+), 101 deletions(-) diff --git a/client/DxPlay/Controls/PlayerControls.Designer.cs b/client/DxPlay/Controls/PlayerControls.Designer.cs index 449bc60e..35083e2a 100644 --- a/client/DxPlay/Controls/PlayerControls.Designer.cs +++ b/client/DxPlay/Controls/PlayerControls.Designer.cs @@ -1,4 +1,7 @@ -namespace DxPlay.Controls +using System; +using System.Windows.Forms; + +namespace DxPlay.Controls { partial class PlayerControls { @@ -48,6 +51,8 @@ this.btnForward = new MaestroShared.Controls.NoFocusCueButton(); this.lblPlaySpeed = new System.Windows.Forms.Label(); this.playSpeed = new DxPlay.Controls.VideoSpeedTrackbar(); + this.audioLabel = new System.Windows.Forms.Label(); + this.audioTracks = new System.Windows.Forms.ComboBox(); this.logoPanel = new System.Windows.Forms.Panel(); this.mainPanel.SuspendLayout(); this.timecodePanel.SuspendLayout(); @@ -221,7 +226,6 @@ this.controlsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.controlsPanel.Size = new System.Drawing.Size(1105, 126); this.controlsPanel.TabIndex = 21; - this.controlsPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.controlsPanel_Paint); // // buttonsPanel // @@ -235,11 +239,13 @@ this.buttonsPanel.Controls.Add(this.btnForward); this.buttonsPanel.Controls.Add(this.lblPlaySpeed); this.buttonsPanel.Controls.Add(this.playSpeed); + this.buttonsPanel.Controls.Add(this.audioLabel); + this.buttonsPanel.Controls.Add(this.audioTracks); this.buttonsPanel.Dock = System.Windows.Forms.DockStyle.Left; this.buttonsPanel.Location = new System.Drawing.Point(0, 0); this.buttonsPanel.Margin = new System.Windows.Forms.Padding(0); this.buttonsPanel.Name = "buttonsPanel"; - this.buttonsPanel.Size = new System.Drawing.Size(731, 126); + this.buttonsPanel.Size = new System.Drawing.Size(844, 126); this.buttonsPanel.TabIndex = 20; // // btnPlay @@ -267,7 +273,7 @@ this.btnRewind.FlatAppearance.BorderSize = 0; this.btnRewind.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnRewind.Image = ((System.Drawing.Image)(resources.GetObject("btnRewind.Image"))); - this.btnRewind.Location = new System.Drawing.Point(193, 4); + this.btnRewind.Location = new System.Drawing.Point(84, 4); this.btnRewind.Margin = new System.Windows.Forms.Padding(4); this.btnRewind.Name = "btnRewind"; this.btnRewind.Size = new System.Drawing.Size(72, 66); @@ -284,7 +290,7 @@ this.btnStepBack.FlatAppearance.BorderSize = 0; this.btnStepBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnStepBack.Image = global::DxPlay.Properties.Resources.baseline_skip_previous_black_24dp; - this.btnStepBack.Location = new System.Drawing.Point(273, 4); + this.btnStepBack.Location = new System.Drawing.Point(164, 4); this.btnStepBack.Margin = new System.Windows.Forms.Padding(4); this.btnStepBack.Name = "btnStepBack"; this.btnStepBack.Size = new System.Drawing.Size(72, 66); @@ -301,7 +307,7 @@ this.btnStop.FlatAppearance.BorderSize = 0; this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnStop.Image = global::DxPlay.Properties.Resources.ic_stop_black_24dp_2x; - this.btnStop.Location = new System.Drawing.Point(353, 4); + this.btnStop.Location = new System.Drawing.Point(244, 4); this.btnStop.Margin = new System.Windows.Forms.Padding(4); this.btnStop.Name = "btnStop"; this.btnStop.Size = new System.Drawing.Size(72, 66); @@ -318,7 +324,7 @@ this.btnStepForward.FlatAppearance.BorderSize = 0; this.btnStepForward.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnStepForward.Image = global::DxPlay.Properties.Resources.baseline_skip_next_black_24dp; - this.btnStepForward.Location = new System.Drawing.Point(433, 4); + this.btnStepForward.Location = new System.Drawing.Point(324, 4); this.btnStepForward.Margin = new System.Windows.Forms.Padding(4); this.btnStepForward.Name = "btnStepForward"; this.btnStepForward.Size = new System.Drawing.Size(72, 66); @@ -335,7 +341,7 @@ this.btnForward.FlatAppearance.BorderSize = 0; this.btnForward.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnForward.Image = global::DxPlay.Properties.Resources.baseline_fast_forward_black_24dp; - this.btnForward.Location = new System.Drawing.Point(513, 4); + this.btnForward.Location = new System.Drawing.Point(404, 4); this.btnForward.Margin = new System.Windows.Forms.Padding(4); this.btnForward.Name = "btnForward"; this.btnForward.Size = new System.Drawing.Size(72, 66); @@ -343,11 +349,11 @@ this.btnForward.TabStop = false; this.btnForward.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnForward.UseVisualStyleBackColor = false; - // + // // lblPlaySpeed // this.lblPlaySpeed.AutoSize = true; - this.lblPlaySpeed.Location = new System.Drawing.Point(83, 0); + this.lblPlaySpeed.Location = new System.Drawing.Point(483, 0); this.lblPlaySpeed.Name = "lblPlaySpeed"; this.lblPlaySpeed.Size = new System.Drawing.Size(22, 17); this.lblPlaySpeed.TabIndex = 27; @@ -357,15 +363,40 @@ // this.playSpeed.CurrentSpeed = 0F; this.playSpeed.LargeChange = 1; - this.playSpeed.Location = new System.Drawing.Point(592, 3); + this.playSpeed.Location = new System.Drawing.Point(511, 2); + this.playSpeed.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.playSpeed.Maximum = 5; this.playSpeed.Name = "playSpeed"; - this.playSpeed.Size = new System.Drawing.Size(136, 56); + this.playSpeed.Size = new System.Drawing.Size(106, 56); this.playSpeed.TabIndex = 26; this.playSpeed.Tag = "PlaySpeed"; this.playSpeed.TickStyle = System.Windows.Forms.TickStyle.None; this.playSpeed.Value = 2; // + // audioLabel + // + this.audioLabel.AutoSize = true; + this.audioLabel.Location = new System.Drawing.Point(623, 0); + this.audioLabel.Name = "audioLabel"; + this.audioLabel.Size = new System.Drawing.Size(44, 17); + this.audioLabel.TabIndex = 28; + this.audioLabel.Tag = ""; + this.audioLabel.Text = "Audio"; + this.audioLabel.Visible = false; + // + // audioTracks + // + this.audioTracks.AllowDrop = true; + this.audioTracks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.audioTracks.FormattingEnabled = true; + this.audioTracks.IntegralHeight = false; + this.audioTracks.ItemHeight = 16; + this.audioTracks.Location = new System.Drawing.Point(673, 3); + this.audioTracks.Name = "audioTracks"; + this.audioTracks.Size = new System.Drawing.Size(168, 24); + this.audioTracks.TabIndex = 29; + this.audioTracks.Visible = false; + // // logoPanel // this.logoPanel.AutoSize = true; @@ -397,7 +428,7 @@ ((System.ComponentModel.ISupportInitialize)(this.playSpeed)).EndInit(); this.ResumeLayout(false); - } + } #endregion @@ -421,5 +452,7 @@ private MaestroShared.Controls.NoFocusCueButton btnStepForward; private VideoSpeedTrackbar playSpeed; private System.Windows.Forms.Label lblPlaySpeed; + private Label audioLabel; + private ComboBox audioTracks; } } \ No newline at end of file diff --git a/client/DxPlay/Controls/PlayerControls.cs b/client/DxPlay/Controls/PlayerControls.cs index 98e6e8f8..6bee2b3e 100644 --- a/client/DxPlay/Controls/PlayerControls.cs +++ b/client/DxPlay/Controls/PlayerControls.cs @@ -30,10 +30,7 @@ namespace DxPlay.Controls public NoFocusCueButton StepForward { get => btnStepForward; } public Label PlaySpeedLabel { get => lblPlaySpeed; } public VideoSpeedTrackbar PlaySpeed { get => playSpeed; } - - private void controlsPanel_Paint(object sender, PaintEventArgs e) - { - - } + public Label AudioLabel { get => audioLabel; } + public ComboBox AudioTracks { get => audioTracks; } } } \ No newline at end of file diff --git a/client/DxPlay/DxPlayer.cs b/client/DxPlay/DxPlayer.cs index 24f7fc80..689b845d 100644 --- a/client/DxPlay/DxPlayer.cs +++ b/client/DxPlay/DxPlayer.cs @@ -588,5 +588,13 @@ namespace DxPlay { Graph.MediaSeeking.SetRate(value); } } + + public void SetAudioTrack(int selectedTrackIndex) + { + if (Graph != null) + { + Graph.SetAudioTrack(selectedTrackIndex); + } + } } } diff --git a/client/DxPlay/LAVInterfaces.cs b/client/DxPlay/LAVInterfaces.cs index 3aab20c6..ef7e8b4f 100644 --- a/client/DxPlay/LAVInterfaces.cs +++ b/client/DxPlay/LAVInterfaces.cs @@ -922,7 +922,7 @@ namespace DxPlay { /// /// Gets the IFileSourceFilter interface for the LAVSplitter filter - you must release this when finished using it with Marshal.ReleaseComObject /// - /// Get the Lav splitter settings interface used to control the splitter filter + /// Get the Lav Splitter settings interface used to control the Splitter filter /// - you must release this when finished using it with Marshal.ReleaseComObject /// subdirectory of your app where you store codec files (LAV*.ax) - default "codecs\" /// LAVSplitterSource filter to put into filterGraph - set the filesource on it and release when finished @@ -1021,7 +1021,7 @@ namespace DxPlay { /// /// Gets the IBaseFilter interface for the LAVSplitter filter - you must release this when finished using it with Marshal.ReleaseComObject /// - /// Get the Lav splitter settings interface used to control the splitter filter + /// Get the Lav Splitter settings interface used to control the Splitter filter /// - you must release this when finished using it with Marshal.ReleaseComObject /// subdirectory of your app where you store codec files (LAV*.ax) - default "codecs\" /// LAVSplitter filter to put into filterGraph - release when finished diff --git a/client/DxPlay/PlayerForm.Designer.cs b/client/DxPlay/PlayerForm.Designer.cs index e745714f..1a51f19a 100644 --- a/client/DxPlay/PlayerForm.Designer.cs +++ b/client/DxPlay/PlayerForm.Designer.cs @@ -88,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, 363); + this.pVideo.Size = new System.Drawing.Size(472, 295); this.pVideo.TabIndex = 0; this.pVideo.TabStop = true; this.pVideo.SizeChanged += new System.EventHandler(this.Panel1_SizeChanged); @@ -99,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 @@ -111,8 +111,8 @@ 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, 365); - this.mainSplit.SplitterDistance = 480; + this.mainSplit.Size = new System.Drawing.Size(931, 297); + this.mainSplit.SplitterDistance = 474; this.mainSplit.TabIndex = 20; // // panelPlayer @@ -121,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, 363); + this.panelPlayer.Size = new System.Drawing.Size(472, 295); this.panelPlayer.TabIndex = 0; // // tableLayoutPanel1 @@ -137,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, 300); + this.tableLayoutPanel1.Size = new System.Drawing.Size(451, 223); this.tableLayoutPanel1.TabIndex = 4; // // tabEditor @@ -148,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, 292); + this.tabEditor.Size = new System.Drawing.Size(419, 215); this.tabEditor.TabIndex = 2; // // tpMetadata @@ -166,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, 253); + this.tpMetadata.Size = new System.Drawing.Size(411, 176); this.tpMetadata.TabIndex = 0; this.tpMetadata.Text = "Metadata"; // @@ -179,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, 247); + this.trafficBrowser.Size = new System.Drawing.Size(405, 170); this.trafficBrowser.TabIndex = 0; // // tpSegments @@ -191,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(214, 192); + this.tpSegments.Size = new System.Drawing.Size(315, 145); this.tpSegments.TabIndex = 1; this.tpSegments.Text = "Segments"; this.tpSegments.UseVisualStyleBackColor = true; @@ -216,13 +216,13 @@ namespace DxPlay { 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"; this.dgSegments.RowHeadersVisible = false; this.dgSegments.RowHeadersWidth = 51; this.dgSegments.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgSegments.Size = new System.Drawing.Size(208, 161); + this.dgSegments.Size = new System.Drawing.Size(309, 110); this.dgSegments.TabIndex = 1; this.dgSegments.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.OnSegmentsCellBeginEdit); this.dgSegments.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnSegmentsCellContentClick); @@ -249,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(208, 25); + this.segmentActions.Size = new System.Drawing.Size(309, 29); this.segmentActions.TabIndex = 0; this.segmentActions.Text = "toolStrip1"; // @@ -260,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 // @@ -276,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); // @@ -287,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); // @@ -298,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 // @@ -314,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); // @@ -334,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; @@ -350,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, 300); + this.pMetadataDisplay.Location = new System.Drawing.Point(0, 223); 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(451, 72); this.pMetadataDisplay.TabIndex = 5; // // btnApprove @@ -368,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(340, 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; @@ -388,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(334, 28); this.labelSelectedMetadata.TabIndex = 13; this.labelSelectedMetadata.Text = "Selected metadata"; // @@ -398,9 +398,9 @@ 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(334, 38); this.txtSelectedID.TabIndex = 12; // // mainMenu @@ -410,7 +410,7 @@ namespace DxPlay { 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(931, 28); this.mainMenu.TabIndex = 21; this.mainMenu.Text = "menuStrip1"; // @@ -422,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); // @@ -437,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); // @@ -460,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(931, 33); this.flowLayoutPanel1.TabIndex = 23; // // btnSave // - this.btnSave.Location = new System.Drawing.Point(706, 3); + this.btnSave.Location = new System.Drawing.Point(838, 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; @@ -478,9 +478,9 @@ namespace DxPlay { // // btnCancel // - this.btnCancel.Location = new System.Drawing.Point(625, 3); + this.btnCancel.Location = new System.Drawing.Point(742, 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; @@ -492,25 +492,25 @@ 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, 389); + this.playerControls.Location = new System.Drawing.Point(0, 325); this.playerControls.Margin = new System.Windows.Forms.Padding(0); this.playerControls.Name = "playerControls"; - this.playerControls.Size = new System.Drawing.Size(784, 143); + this.playerControls.Size = new System.Drawing.Size(931, 203); 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.ClientSize = new System.Drawing.Size(931, 561); this.Controls.Add(this.mainSplit); this.Controls.Add(this.mainMenu); this.Controls.Add(this.playerControls); 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"; diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 7c744435..2dfb06da 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -1,3 +1,4 @@ +using DirectShowLib; using DxPlay.Controls; using DxPlay.Model; using DxPlay.Properties; @@ -118,10 +119,11 @@ namespace DxPlay { playerControls.StepForward.MouseUp += OnStepForwardMouseUp; playerControls.StepForward.MouseDown += OnStepForwardMouseDown; playerControls.PlaySpeed.ValueChanged += OnPlaySpeedChanged; + playerControls.AudioTracks.SelectedIndexChanged += OnAudioTrackSelected; playerControls.TrackBar.MouseDown += OnTrackBarMouseDown; playerControls.TrackBar.MouseUp += OnTrackBarMouseUp; - playerControls.TrackBar.Scroll += OnTrackBarScroll; + playerControls.TrackBar.Scroll += OnTrackBarScroll; } private void InitializeTexts() { @@ -210,6 +212,17 @@ namespace DxPlay { } model.IsRedefineSegments = redefine; + if (m_play != null) + { + m_play.Graph.SearchAudioTracks(m_play.Graph.Splitter); + if (m_play.Graph.AudioCount > 1) { + playerControls.AudioLabel.Visible = true; + m_play.Graph.AvailableAudioTracks = new List(m_play.Graph.AudioCount); + m_play.Graph.SearchAudioTracks(m_play.Graph.Splitter); + playerControls.AudioTracks.DataSource = m_play.Graph.AvailableAudioTracks; + playerControls.AudioTracks.Visible = true; + } + } //for (int i = 0; i < 100; i++) { // m_play.Seek(i); @@ -297,7 +310,6 @@ namespace DxPlay { } } - private bool buttonDown; private void OnRewindMouseUp(object sender, MouseEventArgs e) { @@ -608,5 +620,13 @@ namespace DxPlay { SetVideoSpeed((sender as VideoSpeedTrackbar).CurrentSpeed); playerControls.PlaySpeedLabel.Text = "x" + (sender as VideoSpeedTrackbar).CurrentSpeed.ToString(); } + private void OnAudioTrackSelected(object sender, EventArgs e) + { + int selectedTrackIndex = (sender as ComboBox).SelectedIndex; + if (m_play != null) + { + m_play.SetAudioTrack(selectedTrackIndex); + } + } } } diff --git a/client/DxPlay/PlayerForm.resx b/client/DxPlay/PlayerForm.resx index 11d3d89d..196f8add 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/9fKX8hkQ9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lay/PlayerGraph.cs b/client/DxPlay/PlayerGraph.cs index 2f832641..8fad9c5a 100644 --- a/client/DxPlay/PlayerGraph.cs +++ b/client/DxPlay/PlayerGraph.cs @@ -3,6 +3,7 @@ using DirectShowLib.Utils; using MaestroShared.Commons; using NLog; using System; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace DxPlay { @@ -19,6 +20,9 @@ namespace DxPlay { //public IVMRWindowlessControl9 WindowlessControl { get; private set; } private bool isDisposed; + public int AudioCount { get; set; } + public List AvailableAudioTracks { get; set; } + public IBaseFilter Splitter { get; set; } public PlayerGraph(string fileName, IntPtr handle, VideoRendererType rendererType) { @@ -35,12 +39,12 @@ namespace DxPlay { logger.Debug("Add SourceFilter to graph"); DsError.ThrowExceptionForHR(graphBuilder.AddSourceFilter(fileName, fileName, out IBaseFilter sourceFilter)); - IBaseFilter splitter = AddSplitter(graphBuilder, sourceFilter); + 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); + IBaseFilter videoDecoder = AddVideoDecoder(graphBuilder, Splitter); EnableDeinterlace(videoDecoder); IBaseFilter sampleGrabber = AddSampleGrabber(graphBuilder, videoDecoder); SampleGrabber = (ISampleGrabber)sampleGrabber; @@ -64,16 +68,15 @@ namespace DxPlay { break; } FilterGraphTools.RenderPin(graphBuilder, sampleGrabber, "Output"); - ConfigureSimpleRenderer(handle); - + ConfigureSimpleRenderer(handle); } else { logger.Warn("Video pin not available"); } - if (DsFindPin.ByName(splitter, "Audio") != null) + if (DsFindPin.ByName(Splitter, "Audio") != null) { - IBaseFilter audioDecoder = AddAudioDecoder(graphBuilder, splitter); + IBaseFilter audioDecoder = AddAudioDecoder(graphBuilder, Splitter); if (audioOnly) { throw new Exception("Audio only file is not supported."); @@ -83,24 +86,14 @@ namespace DxPlay { } else FilterGraphTools.RenderPin(graphBuilder, audioDecoder, "Output"); - - //TODO hang stream selector kivezetese a feluletre. 0. a video... - /* - IAMStreamSelect streamSelect = (IAMStreamSelect)splitter; - if (streamSelect != null) - { - streamSelect.Enable(3, AMStreamSelectEnableFlags.Enable); - } - */ - } else { logger.Warn("Audio pin not available"); } - SearchAudioTracks(splitter); - + SearchAudioTracks(Splitter); + SetAudioTrack(0); } catch (Exception e) { @@ -250,27 +243,31 @@ namespace DxPlay { logger.Debug("Add LAVSplitter to graph"); IBaseFilter splitter = LoadSplitter(graphBuilder); if (splitter == null) { - throw new Exception("Can not load splitter!"); + throw new Exception("Can not load Splitter!"); } logger.Debug("Connect SourceFilter -> LAVSplitter"); FilterGraphTools.ConnectFilters(graphBuilder, sourceFilter, "Output", splitter, "Input", true); return splitter; } - private void SearchAudioTracks(IBaseFilter splitter) + public void SearchAudioTracks(IBaseFilter splitter) { IAMStreamSelect amStreamSelect = (IAMStreamSelect)splitter; if (amStreamSelect != null) { amStreamSelect.Count(out int count); - int audioCount = 0; + AudioCount = 0; 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); + 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) { logger.Debug("Found audio channel"); - audioCount++; + AudioCount++; + if (AvailableAudioTracks != null && ppszName != null) { + AvailableAudioTracks.Add(i+". "+ppszName); + } } DsUtils.FreeAMMediaType(ppmt); if (ppObject != null) @@ -278,7 +275,7 @@ namespace DxPlay { if (ppUnk != null) DsUtils.ReleaseComObject(ppUnk); } - logger.Debug("Audio count: " + audioCount); + logger.Debug("Audio count: " + AudioCount); } } @@ -319,8 +316,8 @@ namespace DxPlay { if (splitter == null) splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Splitter"); - //if (splitter != null) - // graphBuilder.AddFilter(splitter, "LAV Splitter"); + //if (Splitter != null) + // graphBuilder.AddFilter(Splitter, "LAV Splitter"); return splitter; } @@ -353,5 +350,13 @@ namespace DxPlay { } } + public void SetAudioTrack(int selectedTrackIndex) + { + IAMStreamSelect streamSelect = (IAMStreamSelect)Splitter; + if (streamSelect != null) + { + streamSelect.Enable(selectedTrackIndex+1, AMStreamSelectEnableFlags.Enable); + } + } } } -- 2.54.0