Fix for "Source resolution" in burn-in - thx Leon :)

Work on #8210
This commit is contained in:
Nikolaj Olsson 2024-04-21 19:32:10 +02:00
parent 83a7aece48
commit b56f93d99d
2 changed files with 63 additions and 40 deletions

View File

@ -113,7 +113,7 @@ namespace Nikse.SubtitleEdit.Forms
this.buttonPreview = new System.Windows.Forms.Button();
this.linkLabelHelp = new System.Windows.Forms.LinkLabel();
this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components);
this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.useSourceResolutionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.uHD3840x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.k2048x1080ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -1437,7 +1437,7 @@ namespace Nikse.SubtitleEdit.Forms
// contextMenuStripRes
//
this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.useSourceResoluton0x0ToolStripMenuItem,
this.useSourceResolutionToolStripMenuItem,
this.x2160ToolStripMenuItem,
this.uHD3840x2160ToolStripMenuItem,
this.k2048x1080ToolStripMenuItem,
@ -1453,110 +1453,111 @@ namespace Nikse.SubtitleEdit.Forms
this.x352ToolStripMenuItem,
this.x272ToolStripMenuItem});
this.contextMenuStripRes.Name = "contextMenuStripRes";
this.contextMenuStripRes.Size = new System.Drawing.Size(214, 356);
this.contextMenuStripRes.Size = new System.Drawing.Size(204, 334);
this.contextMenuStripRes.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripRes_Opening);
//
// useSourceResoluton0x0ToolStripMenuItem
// useSourceResolutionToolStripMenuItem
//
this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem";
this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)";
this.useSourceResoluton0x0ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
this.useSourceResolutionToolStripMenuItem.Name = "useSourceResolutionToolStripMenuItem";
this.useSourceResolutionToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.useSourceResolutionToolStripMenuItem.Text = "Use source resoluton";
this.useSourceResolutionToolStripMenuItem.Click += new System.EventHandler(this.useSourceResolutionToolStripMenuItem_Click);
//
// x2160ToolStripMenuItem
//
this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem";
this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x2160ToolStripMenuItem.Text = "4K (4096x2160)";
this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// uHD3840x2160ToolStripMenuItem
//
this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem";
this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)";
this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// k2048x1080ToolStripMenuItem
//
this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem";
this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)";
this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// dCI2KScope2048x858ToolStripMenuItem
//
this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem";
this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)";
this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// dCI2KFlat1998x1080ToolStripMenuItem
//
this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem";
this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)";
this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// p1920x1080ToolStripMenuItem
//
this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem";
this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)";
this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// x1080ToolStripMenuItem
//
this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem";
this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x1080ToolStripMenuItem.Text = "1440x1080";
this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// p1280x720ToolStripMenuItem
//
this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem";
this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)";
this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// x720ToolStripMenuItem
//
this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem";
this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x720ToolStripMenuItem.Text = "960x720";
this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// p848x480ToolStripMenuItem
//
this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem";
this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.p848x480ToolStripMenuItem.Text = "480p (848x480)";
this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// pAL720x576ToolStripMenuItem
//
this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem";
this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)";
this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// nTSC720x480ToolStripMenuItem
//
this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem";
this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)";
this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// x352ToolStripMenuItem
//
this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem";
this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.x352ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x352ToolStripMenuItem.Text = "640x352";
this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
// x272ToolStripMenuItem
//
this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem";
this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.x272ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x272ToolStripMenuItem.Text = "640x272";
this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
//
@ -1770,7 +1771,7 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem;
private System.Windows.Forms.ColumnHeader columnHeaderResolution;
private System.Windows.Forms.ToolStripMenuItem useSourceResoluton0x0ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem useSourceResolutionToolStripMenuItem;
private System.Windows.Forms.Button buttonOutputFileSettings;
}
}

View File

@ -317,12 +317,10 @@ namespace Nikse.SubtitleEdit.Forms
buttonOutputFileSettings.Visible = BatchMode;
var audioTracks = _mediaInfo.Tracks.Where(p => p.TrackType == FfmpegTrackType.Audio).ToList();
useSourceResoluton0x0ToolStripMenuItem.Visible = BatchMode;
if (BatchMode)
{
listViewAudioTracks.Visible = false;
numericUpDownWidth.Value = 0;
numericUpDownHeight.Value = 0;
useSourceResolutionToolStripMenuItem_Click(null, null);
}
else if (audioTracks.Count > 1)
{
@ -1537,20 +1535,7 @@ namespace Nikse.SubtitleEdit.Forms
private void MediaPlayer_OnButtonClicked(object sender, EventArgs e)
{
if (sender is PictureBox pb && pb.Name == "_pictureBoxFullscreenOver")
{
if (_previewVideo != null && !_previewVideo.IsDisposed)
{
_previewVideo.Close();
_previewVideo.Dispose();
_previewVideo = null;
}
else
{
_previewVideo = new PreviewVideo(_inputVideoFileName, _mpvSubtitleFileName, _assaSubtitle, true);
_previewVideo.Show(this);
}
}
}
private void checkBoxTargetFileSize_CheckedChanged(object sender, EventArgs e)
@ -1749,6 +1734,11 @@ namespace Nikse.SubtitleEdit.Forms
private void ResolutionPickClick(object sender, EventArgs e)
{
labelX.Left = numericUpDownWidth.Left + numericUpDownWidth.Width + 3;
numericUpDownWidth.Visible = true;
labelX.Text = "x";
numericUpDownHeight.Visible = true;
var text = (sender as ToolStripMenuItem).Text;
var match = new Regex("\\d+x\\d+").Match(text);
var parts = match.Value.Split('x');
@ -2014,6 +2004,21 @@ namespace Nikse.SubtitleEdit.Forms
: LanguageSettings.Current.AudioToText.BatchMode;
FontEnableOrDisable(BatchMode || _initialFontOn);
if (!numericUpDownWidth.Visible)
{
var item = new ToolStripMenuItem();
if (_videoInfo == null)
{
item.Text = "(1920x1080)";
}
else
{
item.Text = $"({_videoInfo.Width}x{_videoInfo.Height})";
}
ResolutionPickClick(item, null);
}
}
private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
@ -2263,5 +2268,22 @@ namespace Nikse.SubtitleEdit.Forms
form.ShowDialog(this);
}
}
private void useSourceResolutionToolStripMenuItem_Click(object sender, EventArgs e)
{
numericUpDownWidth.Visible = false;
numericUpDownHeight.Visible = false;
labelX.Left = numericUpDownWidth.Left;
labelX.Text = "Use source";
numericUpDownWidth.Value = 0;
numericUpDownHeight.Value = 0;
}
private void contextMenuStripRes_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
useSourceResolutionToolStripMenuItem.Visible = BatchMode;
}
}
}