mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Fixed two issues regarding new mpv - thx aaaxx :)
This commit is contained in:
parent
703a799da7
commit
a83ca22973
@ -1745,6 +1745,11 @@ can edit in same subtitle file (collaboration)</Information>
|
|||||||
<Miscellaneous>Misc.</Miscellaneous>
|
<Miscellaneous>Misc.</Miscellaneous>
|
||||||
<UseDoNotBreakAfterList>Use do-not-break-after list (for auto-br)</UseDoNotBreakAfterList>
|
<UseDoNotBreakAfterList>Use do-not-break-after list (for auto-br)</UseDoNotBreakAfterList>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
<SettingsMpv>
|
||||||
|
<Title>Settings for mpv</Title>
|
||||||
|
<DownloadMpv>Download mpv dll</DownloadMpv>
|
||||||
|
<DownloadMpvFailed>Unable to download mpv - please re-try later!</DownloadMpvFailed>
|
||||||
|
</SettingsMpv>
|
||||||
<SetVideoOffset>
|
<SetVideoOffset>
|
||||||
<Title>Set video offset</Title>
|
<Title>Set video offset</Title>
|
||||||
<Description>Set video offset (subtitles should not follow real video time, but e.g. +10 hours)</Description>
|
<Description>Set video offset (subtitles should not follow real video time, but e.g. +10 hours)</Description>
|
||||||
|
@ -79,6 +79,7 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
public LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs SetMinimumDisplayTimeBetweenParagraphs;
|
public LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs SetMinimumDisplayTimeBetweenParagraphs;
|
||||||
public LanguageStructure.SetSyncPoint SetSyncPoint;
|
public LanguageStructure.SetSyncPoint SetSyncPoint;
|
||||||
public LanguageStructure.Settings Settings;
|
public LanguageStructure.Settings Settings;
|
||||||
|
public LanguageStructure.SettingsMpv SettingsMpv;
|
||||||
public LanguageStructure.SetVideoOffset SetVideoOffset;
|
public LanguageStructure.SetVideoOffset SetVideoOffset;
|
||||||
public LanguageStructure.ShowEarlierLater ShowEarlierLater;
|
public LanguageStructure.ShowEarlierLater ShowEarlierLater;
|
||||||
public LanguageStructure.ShowHistory ShowHistory;
|
public LanguageStructure.ShowHistory ShowHistory;
|
||||||
@ -2023,6 +2024,13 @@ can edit in same subtitle file (collaboration)",
|
|||||||
UseDoNotBreakAfterList = "Use do-not-break-after list (for auto-br)",
|
UseDoNotBreakAfterList = "Use do-not-break-after list (for auto-br)",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SettingsMpv = new LanguageStructure.SettingsMpv
|
||||||
|
{
|
||||||
|
Title = "Settings for mpv",
|
||||||
|
DownloadMpv = "Download mpv dll",
|
||||||
|
DownloadMpvFailed = "Unable to download mpv - please re-try later!",
|
||||||
|
};
|
||||||
|
|
||||||
SetVideoOffset = new LanguageStructure.SetVideoOffset
|
SetVideoOffset = new LanguageStructure.SetVideoOffset
|
||||||
{
|
{
|
||||||
Title = "Set video offset",
|
Title = "Set video offset",
|
||||||
|
@ -4687,6 +4687,15 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
case "Settings/UseDoNotBreakAfterList":
|
case "Settings/UseDoNotBreakAfterList":
|
||||||
language.Settings.UseDoNotBreakAfterList = reader.Value;
|
language.Settings.UseDoNotBreakAfterList = reader.Value;
|
||||||
break;
|
break;
|
||||||
|
case "SettingsMpv/Title":
|
||||||
|
language.SettingsMpv.Title = reader.Value;
|
||||||
|
break;
|
||||||
|
case "SettingsMpv/DownloadMpv":
|
||||||
|
language.SettingsMpv.DownloadMpv = reader.Value;
|
||||||
|
break;
|
||||||
|
case "SettingsMpv/DownloadMpvFailed":
|
||||||
|
language.SettingsMpv.DownloadMpvFailed = reader.Value;
|
||||||
|
break;
|
||||||
case "SetVideoOffset/Title":
|
case "SetVideoOffset/Title":
|
||||||
language.SetVideoOffset.Title = reader.Value;
|
language.SetVideoOffset.Title = reader.Value;
|
||||||
break;
|
break;
|
||||||
|
@ -1905,6 +1905,12 @@
|
|||||||
public string UseDoNotBreakAfterList { get; set; }
|
public string UseDoNotBreakAfterList { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SettingsMpv
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string DownloadMpv { get; set; }
|
||||||
|
public string DownloadMpvFailed { get; set; }
|
||||||
|
}
|
||||||
public class SetVideoOffset
|
public class SetVideoOffset
|
||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
@ -534,6 +534,7 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
public string VlcWaveTranscodeSettings { get; set; }
|
public string VlcWaveTranscodeSettings { get; set; }
|
||||||
public string VlcLocation { get; set; }
|
public string VlcLocation { get; set; }
|
||||||
public string VlcLocationRelative { get; set; }
|
public string VlcLocationRelative { get; set; }
|
||||||
|
public string MpvVideoOutput { get; set; }
|
||||||
public string MpcHcLocation { get; set; }
|
public string MpcHcLocation { get; set; }
|
||||||
public bool UseFFmpegForWaveExtraction { get; set; }
|
public bool UseFFmpegForWaveExtraction { get; set; }
|
||||||
public string FFmpegLocation { get; set; }
|
public string FFmpegLocation { get; set; }
|
||||||
@ -626,6 +627,7 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
OpenSubtitleExtraExtensions = "*.mp4;*.m4v;*.mkv;*.ts"; // matroska/mp4/m4v files (can contain subtitles)
|
OpenSubtitleExtraExtensions = "*.mp4;*.m4v;*.mkv;*.ts"; // matroska/mp4/m4v files (can contain subtitles)
|
||||||
ListViewColumnsRememberSize = true;
|
ListViewColumnsRememberSize = true;
|
||||||
VlcWaveTranscodeSettings = "acodec=s16l"; // "acodec=s16l,channels=1,ab=64,samplerate=8000";
|
VlcWaveTranscodeSettings = "acodec=s16l"; // "acodec=s16l,channels=1,ab=64,samplerate=8000";
|
||||||
|
MpvVideoOutput = "vdpau"; // mpv "vo" option
|
||||||
UseTimeFormatHHMMSSFF = false;
|
UseTimeFormatHHMMSSFF = false;
|
||||||
ClearStatusBarAfterSeconds = 10;
|
ClearStatusBarAfterSeconds = 10;
|
||||||
MoveVideo100Or500MsPlaySmallSample = false;
|
MoveVideo100Or500MsPlaySmallSample = false;
|
||||||
@ -1483,6 +1485,9 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
subNode = node.SelectSingleNode("VlcLocationRelative");
|
subNode = node.SelectSingleNode("VlcLocationRelative");
|
||||||
if (subNode != null)
|
if (subNode != null)
|
||||||
settings.General.VlcLocationRelative = subNode.InnerText.Trim();
|
settings.General.VlcLocationRelative = subNode.InnerText.Trim();
|
||||||
|
subNode = node.SelectSingleNode("MpvVideoOutput");
|
||||||
|
if (subNode != null)
|
||||||
|
settings.General.MpvVideoOutput = subNode.InnerText.Trim();
|
||||||
subNode = node.SelectSingleNode("MpcHcLocation");
|
subNode = node.SelectSingleNode("MpcHcLocation");
|
||||||
if (subNode != null)
|
if (subNode != null)
|
||||||
settings.General.MpcHcLocation = subNode.InnerText.Trim();
|
settings.General.MpcHcLocation = subNode.InnerText.Trim();
|
||||||
@ -2838,6 +2843,7 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
textWriter.WriteElementString("VlcWaveTranscodeSettings", settings.General.VlcWaveTranscodeSettings);
|
textWriter.WriteElementString("VlcWaveTranscodeSettings", settings.General.VlcWaveTranscodeSettings);
|
||||||
textWriter.WriteElementString("VlcLocation", settings.General.VlcLocation);
|
textWriter.WriteElementString("VlcLocation", settings.General.VlcLocation);
|
||||||
textWriter.WriteElementString("VlcLocationRelative", settings.General.VlcLocationRelative);
|
textWriter.WriteElementString("VlcLocationRelative", settings.General.VlcLocationRelative);
|
||||||
|
textWriter.WriteElementString("MpvVideoOutput", settings.General.MpvVideoOutput);
|
||||||
textWriter.WriteElementString("MpcHcLocation", settings.General.MpcHcLocation);
|
textWriter.WriteElementString("MpcHcLocation", settings.General.MpcHcLocation);
|
||||||
textWriter.WriteElementString("UseFFmpegForWaveExtraction", settings.General.UseFFmpegForWaveExtraction.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("UseFFmpegForWaveExtraction", settings.General.UseFFmpegForWaveExtraction.ToString(CultureInfo.InvariantCulture));
|
||||||
textWriter.WriteElementString("FFmpegLocation", settings.General.FFmpegLocation);
|
textWriter.WriteElementString("FFmpegLocation", settings.General.FFmpegLocation);
|
||||||
|
@ -12811,10 +12811,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
toolStripComboBoxFrameRate.Text = string.Format("{0:0.###}", _videoInfo.FramesPerSecond);
|
toolStripComboBoxFrameRate.Text = string.Format("{0:0.###}", _videoInfo.FramesPerSecond);
|
||||||
|
|
||||||
UiUtil.InitializeVideoPlayerAndContainer(fileName, _videoInfo, mediaPlayer, VideoLoaded, VideoEnded);
|
UiUtil.InitializeVideoPlayerAndContainer(fileName, _videoInfo, mediaPlayer, VideoLoaded, VideoEnded);
|
||||||
|
mediaPlayer.Volume = 0;
|
||||||
mediaPlayer.ShowFullscreenButton = Configuration.Settings.General.VideoPlayerShowFullscreenButton;
|
mediaPlayer.ShowFullscreenButton = Configuration.Settings.General.VideoPlayerShowFullscreenButton;
|
||||||
mediaPlayer.OnButtonClicked -= MediaPlayer_OnButtonClicked;
|
mediaPlayer.OnButtonClicked -= MediaPlayer_OnButtonClicked;
|
||||||
mediaPlayer.OnButtonClicked += MediaPlayer_OnButtonClicked;
|
mediaPlayer.OnButtonClicked += MediaPlayer_OnButtonClicked;
|
||||||
mediaPlayer.Volume = 0;
|
|
||||||
|
|
||||||
if (_videoInfo.VideoCodec != null)
|
if (_videoInfo.VideoCodec != null)
|
||||||
labelVideoInfo.Text = Path.GetFileName(fileName) + " " + _videoInfo.Width + "x" + _videoInfo.Height + " " + _videoInfo.VideoCodec.Trim();
|
labelVideoInfo.Text = Path.GetFileName(fileName) + " " + _videoInfo.Width + "x" + _videoInfo.Height + " " + _videoInfo.VideoCodec.Trim();
|
||||||
|
27
src/Forms/Settings.Designer.cs
generated
27
src/Forms/Settings.Designer.cs
generated
@ -147,6 +147,7 @@
|
|||||||
this.comboBoxlVideoPlayerPreviewFontSize = new System.Windows.Forms.ComboBox();
|
this.comboBoxlVideoPlayerPreviewFontSize = new System.Windows.Forms.ComboBox();
|
||||||
this.checkBoxVideoPlayerShowStopButton = new System.Windows.Forms.CheckBox();
|
this.checkBoxVideoPlayerShowStopButton = new System.Windows.Forms.CheckBox();
|
||||||
this.groupBoxVideoEngine = new System.Windows.Forms.GroupBox();
|
this.groupBoxVideoEngine = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonMpvSettings = new System.Windows.Forms.Button();
|
||||||
this.labelPlatform = new System.Windows.Forms.Label();
|
this.labelPlatform = new System.Windows.Forms.Label();
|
||||||
this.buttonVlcPathBrowse = new System.Windows.Forms.Button();
|
this.buttonVlcPathBrowse = new System.Windows.Forms.Button();
|
||||||
this.textBoxVlcPath = new System.Windows.Forms.TextBox();
|
this.textBoxVlcPath = new System.Windows.Forms.TextBox();
|
||||||
@ -304,6 +305,7 @@
|
|||||||
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
|
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
|
||||||
this.labelStatus = new System.Windows.Forms.Label();
|
this.labelStatus = new System.Windows.Forms.Label();
|
||||||
this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.labelMpvSettings = new System.Windows.Forms.Label();
|
||||||
this.tabControlSettings.SuspendLayout();
|
this.tabControlSettings.SuspendLayout();
|
||||||
this.tabPageGenerel.SuspendLayout();
|
this.tabPageGenerel.SuspendLayout();
|
||||||
this.groupBoxMiscellaneous.SuspendLayout();
|
this.groupBoxMiscellaneous.SuspendLayout();
|
||||||
@ -1734,6 +1736,8 @@
|
|||||||
//
|
//
|
||||||
// groupBoxVideoEngine
|
// groupBoxVideoEngine
|
||||||
//
|
//
|
||||||
|
this.groupBoxVideoEngine.Controls.Add(this.labelMpvSettings);
|
||||||
|
this.groupBoxVideoEngine.Controls.Add(this.buttonMpvSettings);
|
||||||
this.groupBoxVideoEngine.Controls.Add(this.labelPlatform);
|
this.groupBoxVideoEngine.Controls.Add(this.labelPlatform);
|
||||||
this.groupBoxVideoEngine.Controls.Add(this.buttonVlcPathBrowse);
|
this.groupBoxVideoEngine.Controls.Add(this.buttonVlcPathBrowse);
|
||||||
this.groupBoxVideoEngine.Controls.Add(this.textBoxVlcPath);
|
this.groupBoxVideoEngine.Controls.Add(this.textBoxVlcPath);
|
||||||
@ -1753,6 +1757,16 @@
|
|||||||
this.groupBoxVideoEngine.TabStop = false;
|
this.groupBoxVideoEngine.TabStop = false;
|
||||||
this.groupBoxVideoEngine.Text = "Video engine";
|
this.groupBoxVideoEngine.Text = "Video engine";
|
||||||
//
|
//
|
||||||
|
// buttonMpvSettings
|
||||||
|
//
|
||||||
|
this.buttonMpvSettings.Location = new System.Drawing.Point(466, 87);
|
||||||
|
this.buttonMpvSettings.Name = "buttonMpvSettings";
|
||||||
|
this.buttonMpvSettings.Size = new System.Drawing.Size(29, 21);
|
||||||
|
this.buttonMpvSettings.TabIndex = 29;
|
||||||
|
this.buttonMpvSettings.Text = "...";
|
||||||
|
this.buttonMpvSettings.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonMpvSettings.Click += new System.EventHandler(this.buttonMpvSettings_Click);
|
||||||
|
//
|
||||||
// labelPlatform
|
// labelPlatform
|
||||||
//
|
//
|
||||||
this.labelPlatform.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.labelPlatform.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
@ -3579,6 +3593,17 @@
|
|||||||
//
|
//
|
||||||
this.openFileDialogFFmpeg.FileName = "openFileDialog1";
|
this.openFileDialogFFmpeg.FileName = "openFileDialog1";
|
||||||
//
|
//
|
||||||
|
// labelMpvSettings
|
||||||
|
//
|
||||||
|
this.labelMpvSettings.AutoSize = true;
|
||||||
|
this.labelMpvSettings.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.labelMpvSettings.ForeColor = System.Drawing.Color.Gray;
|
||||||
|
this.labelMpvSettings.Location = new System.Drawing.Point(501, 93);
|
||||||
|
this.labelMpvSettings.Name = "labelMpvSettings";
|
||||||
|
this.labelMpvSettings.Size = new System.Drawing.Size(33, 11);
|
||||||
|
this.labelMpvSettings.TabIndex = 30;
|
||||||
|
this.labelMpvSettings.Text = "--vo=?";
|
||||||
|
//
|
||||||
// Settings
|
// Settings
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -3973,5 +3998,7 @@
|
|||||||
private System.Windows.Forms.Button buttonSsaColor;
|
private System.Windows.Forms.Button buttonSsaColor;
|
||||||
private System.Windows.Forms.CheckBox checkBoxSsaFontBold;
|
private System.Windows.Forms.CheckBox checkBoxSsaFontBold;
|
||||||
private System.Windows.Forms.CheckBox checkBoxFceSkipStep1;
|
private System.Windows.Forms.CheckBox checkBoxFceSkipStep1;
|
||||||
|
private System.Windows.Forms.Button buttonMpvSettings;
|
||||||
|
private System.Windows.Forms.Label labelMpvSettings;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -134,12 +134,11 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
if (!LibVlcDynamic.IsInstalled)
|
if (!LibVlcDynamic.IsInstalled)
|
||||||
radioButtonVideoPlayerVLC.Enabled = false;
|
radioButtonVideoPlayerVLC.Enabled = false;
|
||||||
if (!LibMpvDynamic.IsInstalled)
|
|
||||||
radioButtonVideoPlayerMPV.Enabled = false;
|
|
||||||
if (!UiUtil.IsQuartsDllInstalled)
|
if (!UiUtil.IsQuartsDllInstalled)
|
||||||
radioButtonVideoPlayerDirectShow.Enabled = false;
|
radioButtonVideoPlayerDirectShow.Enabled = false;
|
||||||
if (Logic.VideoPlayers.MpcHC.MpcHc.GetMpcHcFileName() == null)
|
if (Logic.VideoPlayers.MpcHC.MpcHc.GetMpcHcFileName() == null)
|
||||||
radioButtonVideoPlayerMpcHc.Enabled = false;
|
radioButtonVideoPlayerMpcHc.Enabled = false;
|
||||||
|
RefreshMpvSettings();
|
||||||
|
|
||||||
textBoxVlcPath.Text = gs.VlcLocation;
|
textBoxVlcPath.Text = gs.VlcLocation;
|
||||||
textBoxVlcPath.Left = labelVideoPlayerVLC.Left + labelVideoPlayerVLC.Width + 5;
|
textBoxVlcPath.Left = labelVideoPlayerVLC.Left + labelVideoPlayerVLC.Width + 5;
|
||||||
@ -337,6 +336,8 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
radioButtonVideoPlayerMPV.Text = language.MpvPlayer;
|
radioButtonVideoPlayerMPV.Text = language.MpvPlayer;
|
||||||
labelVideoPlayerMPlayer.Text = language.MpvPlayerDescription;
|
labelVideoPlayerMPlayer.Text = language.MpvPlayerDescription;
|
||||||
|
buttonMpvSettings.Left = labelVideoPlayerMPlayer.Left + labelVideoPlayerMPlayer.Width + 5;
|
||||||
|
labelMpvSettings.Left = buttonMpvSettings.Left + buttonMpvSettings.Width + 5;
|
||||||
radioButtonVideoPlayerVLC.Text = language.VlcMediaPlayer;
|
radioButtonVideoPlayerVLC.Text = language.VlcMediaPlayer;
|
||||||
labelVideoPlayerVLC.Text = language.VlcMediaPlayerDescription;
|
labelVideoPlayerVLC.Text = language.VlcMediaPlayerDescription;
|
||||||
gs.VlcLocation = textBoxVlcPath.Text;
|
gs.VlcLocation = textBoxVlcPath.Text;
|
||||||
@ -2632,5 +2633,19 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
UpdateSsaExample();
|
UpdateSsaExample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonMpvSettings_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var form = new SettingsMpv())
|
||||||
|
{
|
||||||
|
form.ShowDialog(this);
|
||||||
|
RefreshMpvSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshMpvSettings()
|
||||||
|
{
|
||||||
|
radioButtonVideoPlayerMPV.Enabled = LibMpvDynamic.IsInstalled;
|
||||||
|
labelMpvSettings.Text = "--vo=" + Configuration.Settings.General.MpvVideoOutput;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
37
src/Forms/SettingsMpv.Designer.cs
generated
37
src/Forms/SettingsMpv.Designer.cs
generated
@ -1,6 +1,6 @@
|
|||||||
namespace Nikse.SubtitleEdit.Forms
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
{
|
{
|
||||||
partial class SettingsMpv
|
sealed partial class SettingsMpv
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.buttonDownload = new System.Windows.Forms.Button();
|
this.buttonDownload = new System.Windows.Forms.Button();
|
||||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
this.comboBoxVideoOutput = new System.Windows.Forms.ComboBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.buttonOK = new System.Windows.Forms.Button();
|
this.buttonOK = new System.Windows.Forms.Button();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
@ -40,33 +40,34 @@
|
|||||||
//
|
//
|
||||||
this.buttonDownload.Location = new System.Drawing.Point(12, 24);
|
this.buttonDownload.Location = new System.Drawing.Point(12, 24);
|
||||||
this.buttonDownload.Name = "buttonDownload";
|
this.buttonDownload.Name = "buttonDownload";
|
||||||
this.buttonDownload.Size = new System.Drawing.Size(159, 23);
|
this.buttonDownload.Size = new System.Drawing.Size(186, 23);
|
||||||
this.buttonDownload.TabIndex = 0;
|
this.buttonDownload.TabIndex = 0;
|
||||||
this.buttonDownload.Text = "Download mpv dll";
|
this.buttonDownload.Text = "Download mpv dll";
|
||||||
this.buttonDownload.UseVisualStyleBackColor = true;
|
this.buttonDownload.UseVisualStyleBackColor = true;
|
||||||
this.buttonDownload.Click += new System.EventHandler((sender, e) => this.buttonDownload_Click(sender, e));
|
this.buttonDownload.Click += new System.EventHandler(this.buttonDownload_Click_1);
|
||||||
//
|
//
|
||||||
// comboBox1
|
// comboBoxVideoOutput
|
||||||
//
|
//
|
||||||
this.comboBox1.FormattingEnabled = true;
|
this.comboBoxVideoOutput.FormattingEnabled = true;
|
||||||
this.comboBox1.Items.AddRange(new object[] {
|
this.comboBoxVideoOutput.Items.AddRange(new object[] {
|
||||||
"direct3d_shaders",
|
"direct3d_shaders",
|
||||||
"direct3d ",
|
"direct3d ",
|
||||||
"sdl",
|
"sdl",
|
||||||
"vaapi"});
|
"vaapi",
|
||||||
this.comboBox1.Location = new System.Drawing.Point(12, 109);
|
"vdpau"});
|
||||||
this.comboBox1.Name = "comboBox1";
|
this.comboBoxVideoOutput.Location = new System.Drawing.Point(12, 109);
|
||||||
this.comboBox1.Size = new System.Drawing.Size(186, 21);
|
this.comboBoxVideoOutput.Name = "comboBoxVideoOutput";
|
||||||
this.comboBox1.TabIndex = 1;
|
this.comboBoxVideoOutput.Size = new System.Drawing.Size(186, 21);
|
||||||
|
this.comboBoxVideoOutput.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(12, 93);
|
this.label1.Location = new System.Drawing.Point(12, 93);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(66, 13);
|
this.label1.Size = new System.Drawing.Size(67, 13);
|
||||||
this.label1.TabIndex = 2;
|
this.label1.TabIndex = 2;
|
||||||
this.label1.Text = "Video option";
|
this.label1.Text = "Video output";
|
||||||
//
|
//
|
||||||
// buttonOK
|
// buttonOK
|
||||||
//
|
//
|
||||||
@ -78,6 +79,7 @@
|
|||||||
this.buttonOK.TabIndex = 4;
|
this.buttonOK.TabIndex = 4;
|
||||||
this.buttonOK.Text = "&OK";
|
this.buttonOK.Text = "&OK";
|
||||||
this.buttonOK.UseVisualStyleBackColor = true;
|
this.buttonOK.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
@ -90,6 +92,7 @@
|
|||||||
this.buttonCancel.TabIndex = 5;
|
this.buttonCancel.TabIndex = 5;
|
||||||
this.buttonCancel.Text = "C&ancel";
|
this.buttonCancel.Text = "C&ancel";
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||||
//
|
//
|
||||||
// labelPleaseWait
|
// labelPleaseWait
|
||||||
//
|
//
|
||||||
@ -109,7 +112,7 @@
|
|||||||
this.Controls.Add(this.buttonOK);
|
this.Controls.Add(this.buttonOK);
|
||||||
this.Controls.Add(this.buttonCancel);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.comboBox1);
|
this.Controls.Add(this.comboBoxVideoOutput);
|
||||||
this.Controls.Add(this.buttonDownload);
|
this.Controls.Add(this.buttonDownload);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.KeyPreview = true;
|
this.KeyPreview = true;
|
||||||
@ -119,7 +122,7 @@
|
|||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "SettingsMpv";
|
this.Text = "Settings for mpv";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@ -128,7 +131,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Button buttonDownload;
|
private System.Windows.Forms.Button buttonDownload;
|
||||||
private System.Windows.Forms.ComboBox comboBox1;
|
private System.Windows.Forms.ComboBox comboBoxVideoOutput;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Button buttonOK;
|
private System.Windows.Forms.Button buttonOK;
|
||||||
private System.Windows.Forms.Button buttonCancel;
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
|
@ -7,49 +7,24 @@ using Nikse.SubtitleEdit.Core;
|
|||||||
|
|
||||||
namespace Nikse.SubtitleEdit.Forms
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
{
|
{
|
||||||
public partial class SettingsMpv : Form
|
public sealed partial class SettingsMpv : Form
|
||||||
{
|
{
|
||||||
public SettingsMpv()
|
public SettingsMpv()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
labelPleaseWait.Text = string.Empty;
|
||||||
|
comboBoxVideoOutput.Text = Configuration.Settings.General.MpvVideoOutput;
|
||||||
private void buttonDownload_Click(object sender, EventArgs e)
|
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||||
{
|
buttonOK.Text = Configuration.Settings.Language.General.Ok;
|
||||||
try
|
Text = Configuration.Settings.Language.SettingsMpv.Title;
|
||||||
{
|
buttonDownload.Text = Configuration.Settings.Language.SettingsMpv.DownloadMpv;
|
||||||
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
|
|
||||||
buttonOK.Enabled = false;
|
|
||||||
buttonDownload.Enabled = false;
|
|
||||||
Refresh();
|
|
||||||
Cursor = Cursors.WaitCursor;
|
|
||||||
|
|
||||||
string url = "https://github.com/SubtitleEdit/subtitleedit/raw/master/Other/mpv-dll-64.zip";
|
|
||||||
if (IntPtr.Size*8 == 32)
|
|
||||||
{
|
|
||||||
url = "https://github.com/SubtitleEdit/subtitleedit/raw/master/Other/mpv-dll-32.zip";
|
|
||||||
}
|
|
||||||
|
|
||||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
|
||||||
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
|
||||||
wc.DownloadDataAsync(new Uri(url));
|
|
||||||
Cursor = Cursors.Default;
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
labelPleaseWait.Text = string.Empty;
|
|
||||||
buttonOK.Enabled = true;
|
|
||||||
buttonDownload.Enabled = true;
|
|
||||||
Cursor = Cursors.Default;
|
|
||||||
MessageBox.Show(exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
|
private void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Error != null )
|
if (e.Error != null )
|
||||||
{
|
{
|
||||||
MessageBox.Show("Unable to download mpv - please re-try later!");
|
MessageBox.Show(Configuration.Settings.Language.SettingsMpv.DownloadMpvFailed);
|
||||||
labelPleaseWait.Text = string.Empty;
|
labelPleaseWait.Text = string.Empty;
|
||||||
buttonOK.Enabled = true;
|
buttonOK.Enabled = true;
|
||||||
buttonDownload.Enabled = true;
|
buttonDownload.Enabled = true;
|
||||||
@ -57,7 +32,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string dictionaryFolder = Utilities.DictionaryFolder;
|
string dictionaryFolder = Configuration.DataDirectory;
|
||||||
using (var ms = new MemoryStream(e.Result))
|
using (var ms = new MemoryStream(e.Result))
|
||||||
using (ZipExtractor zip = ZipExtractor.Open(ms))
|
using (ZipExtractor zip = ZipExtractor.Open(ms))
|
||||||
{
|
{
|
||||||
@ -80,6 +55,48 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
MessageBox.Show("mpv downloaded OK");
|
MessageBox.Show("mpv downloaded OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonDownload_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
|
||||||
|
buttonOK.Enabled = false;
|
||||||
|
buttonDownload.Enabled = false;
|
||||||
|
Refresh();
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
|
string url = "https://github.com/SubtitleEdit/subtitleedit/raw/master/Other/mpv-dll-64.zip";
|
||||||
|
if (IntPtr.Size * 8 == 32)
|
||||||
|
{
|
||||||
|
url = "https://github.com/SubtitleEdit/subtitleedit/raw/master/Other/mpv-dll-32.zip";
|
||||||
|
}
|
||||||
|
|
||||||
|
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||||
|
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
||||||
|
wc.DownloadDataAsync(new Uri(url));
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
labelPleaseWait.Text = string.Empty;
|
||||||
|
buttonOK.Enabled = true;
|
||||||
|
buttonDownload.Enabled = true;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
MessageBox.Show(exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonOK_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(comboBoxVideoOutput.Text))
|
||||||
|
Configuration.Settings.General.MpvVideoOutput = comboBoxVideoOutput.Text;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,11 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
|||||||
|
|
||||||
private IntPtr _libMpvDll;
|
private IntPtr _libMpvDll;
|
||||||
private IntPtr _mpvHandle;
|
private IntPtr _mpvHandle;
|
||||||
|
private Timer _videoLoadedTimer;
|
||||||
|
private Timer _videoEndedTimer;
|
||||||
|
|
||||||
|
public override event EventHandler OnVideoLoaded;
|
||||||
|
public override event EventHandler OnVideoEnded;
|
||||||
|
|
||||||
private object GetDllType(Type type, string name)
|
private object GetDllType(Type type, string name)
|
||||||
{
|
{
|
||||||
@ -312,7 +317,12 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
|||||||
if (!string.IsNullOrEmpty(videoFileName))
|
if (!string.IsNullOrEmpty(videoFileName))
|
||||||
{
|
{
|
||||||
_mpvInitialize.Invoke(_mpvHandle);
|
_mpvInitialize.Invoke(_mpvHandle);
|
||||||
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("vo\0"), Encoding.UTF8.GetBytes("direct3d_shaders\0")); // "direct3d" for compabality with old systems
|
|
||||||
|
string videoOutput = "direct3d_shaders";
|
||||||
|
if (string.IsNullOrWhiteSpace(Configuration.Settings.General.MpvVideoOutput))
|
||||||
|
videoOutput = Configuration.Settings.General.MpvVideoOutput;
|
||||||
|
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("vo\0"), Encoding.UTF8.GetBytes(videoOutput + "\0")); // "direct3d_shaders" is default, "direct3d" could be used for compabality with old systems
|
||||||
|
|
||||||
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("keep-open\0"), Encoding.UTF8.GetBytes("always\0")); // don't auto close video
|
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("keep-open\0"), Encoding.UTF8.GetBytes("always\0")); // don't auto close video
|
||||||
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("no-sub\0"), Encoding.UTF8.GetBytes("\0")); // don't load subtitles
|
_mpvSetOptionString(_mpvHandle, Encoding.UTF8.GetBytes("no-sub\0"), Encoding.UTF8.GetBytes("\0")); // don't load subtitles
|
||||||
if (ownerControl != null)
|
if (ownerControl != null)
|
||||||
@ -323,37 +333,52 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
|||||||
}
|
}
|
||||||
_mpvCommand(_mpvHandle, new[] { "loadfile", videoFileName, null });
|
_mpvCommand(_mpvHandle, new[] { "loadfile", videoFileName, null });
|
||||||
|
|
||||||
const int mpvEventFileLoaded = 8;
|
_videoLoadedTimer = new Timer { Interval = 50 };
|
||||||
int l = 0;
|
_videoLoadedTimer.Tick += VideoLoadedTimer_Tick;
|
||||||
while (l < 10000)
|
_videoLoadedTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VideoLoadedTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_videoLoadedTimer.Stop();
|
||||||
|
const int mpvEventFileLoaded = 8;
|
||||||
|
int l = 0;
|
||||||
|
while (l < 10000)
|
||||||
|
{
|
||||||
|
|
||||||
|
Application.DoEvents();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Application.DoEvents();
|
|
||||||
var eventIdHandle = _mpvWaitEvent(_mpvHandle, 0);
|
var eventIdHandle = _mpvWaitEvent(_mpvHandle, 0);
|
||||||
var eventId = Convert.ToInt64(Marshal.PtrToStructure(eventIdHandle, typeof(int)));
|
var eventId = Convert.ToInt64(Marshal.PtrToStructure(eventIdHandle, typeof(int)));
|
||||||
if (eventId == mpvEventFileLoaded)
|
if (eventId == mpvEventFileLoaded)
|
||||||
{
|
{
|
||||||
Application.DoEvents();
|
break;
|
||||||
if (onVideoLoaded != null)
|
|
||||||
onVideoLoaded.Invoke(this, null);
|
|
||||||
Application.DoEvents();
|
|
||||||
Pause();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Application.DoEvents();
|
||||||
|
if (OnVideoLoaded != null)
|
||||||
|
OnVideoLoaded.Invoke(this, null);
|
||||||
|
Application.DoEvents();
|
||||||
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void VideoEndedTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override void DisposeVideoPlayer()
|
public override void DisposeVideoPlayer()
|
||||||
{
|
{
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override event EventHandler OnVideoLoaded;
|
|
||||||
|
|
||||||
public override event EventHandler OnVideoEnded;
|
|
||||||
|
|
||||||
private void ReleaseUnmangedResources()
|
private void ReleaseUnmangedResources()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user