This commit is contained in:
niksedk 2023-03-10 23:32:29 +01:00
parent f6a120128c
commit fabff607a1
3 changed files with 40 additions and 5 deletions

View File

@ -81,7 +81,7 @@ namespace Nikse.SubtitleEdit.Forms
//
this.buttonGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonGenerate.Location = new System.Drawing.Point(655, 570);
this.buttonGenerate.Location = new System.Drawing.Point(655, 404);
this.buttonGenerate.Name = "buttonGenerate";
this.buttonGenerate.Size = new System.Drawing.Size(121, 23);
this.buttonGenerate.TabIndex = 4;
@ -94,7 +94,7 @@ namespace Nikse.SubtitleEdit.Forms
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(782, 570);
this.buttonCancel.Location = new System.Drawing.Point(782, 404);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
@ -128,7 +128,7 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxSettings.Controls.Add(this.labelInputVideoFile);
this.groupBoxSettings.Location = new System.Drawing.Point(12, 13);
this.groupBoxSettings.Name = "groupBoxSettings";
this.groupBoxSettings.Size = new System.Drawing.Size(845, 551);
this.groupBoxSettings.Size = new System.Drawing.Size(845, 385);
this.groupBoxSettings.TabIndex = 0;
this.groupBoxSettings.TabStop = false;
//
@ -213,7 +213,7 @@ namespace Nikse.SubtitleEdit.Forms
this.listViewSubtitles.HideSelection = false;
this.listViewSubtitles.Location = new System.Drawing.Point(22, 98);
this.listViewSubtitles.Name = "listViewSubtitles";
this.listViewSubtitles.Size = new System.Drawing.Size(719, 447);
this.listViewSubtitles.Size = new System.Drawing.Size(719, 281);
this.listViewSubtitles.TabIndex = 25;
this.listViewSubtitles.UseCompatibleStateImageBehavior = false;
this.listViewSubtitles.View = System.Windows.Forms.View.Details;
@ -441,19 +441,21 @@ namespace Nikse.SubtitleEdit.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(869, 605);
this.ClientSize = new System.Drawing.Size(869, 439);
this.Controls.Add(this.groupBoxSettings);
this.Controls.Add(this.buttonGenerate);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.textBoxLog);
this.KeyPreview = true;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(800, 450);
this.Name = "GenerateVideoWithSoftSubs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Generate video with soft subs";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenerateVideoWithHardSubs_FormClosing);
this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown);
this.ResizeEnd += new System.EventHandler(this.GenerateVideoWithSoftSubs_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithSoftSubs_KeyDown);
this.groupBoxSettings.ResumeLayout(false);
this.groupBoxSettings.PerformLayout();

View File

@ -393,6 +393,8 @@ namespace Nikse.SubtitleEdit.Forms
private void GenerateVideoWithHardSubs_Shown(object sender, EventArgs e)
{
listViewSubtitles.AutoSizeLastColumn();
if (!File.Exists(_inputVideoFileName))
{
MessageBox.Show(string.Format(LanguageSettings.Current.Main.FileNotFound, _inputVideoFileName));
@ -478,7 +480,31 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
var list = new List<int>();
foreach (int index in listViewSubtitles.SelectedIndices)
{
list.Add(index);
}
foreach (var index in list.OrderByDescending(p => p))
{
_softSubs.RemoveAt(index);
listViewSubtitles.Items.RemoveAt(index);
}
var newIndex = list.Min(p => p);
if (newIndex < listViewSubtitles.Items.Count)
{
listViewSubtitles.Items[newIndex].Selected = true;
}
else
{
newIndex--;
if (newIndex >= 0 && newIndex < listViewSubtitles.Items.Count)
{
listViewSubtitles.Items[newIndex].Selected = true;
}
}
}
private void buttonClear_Click(object sender, EventArgs e)
@ -543,5 +569,10 @@ namespace Nikse.SubtitleEdit.Forms
{
MoveDown(listViewSubtitles);
}
private void GenerateVideoWithSoftSubs_ResizeEnd(object sender, EventArgs e)
{
listViewSubtitles.AutoSizeLastColumn();
}
}
}

View File

@ -279,6 +279,8 @@ namespace Nikse.SubtitleEdit.Logic
//TODO: check number of audio + video tracks!
var ffmpegInfo = FfmpegMediaInfo.Parse(inputVideoFileName);
var videoTrackCount = ffmpegInfo.Tracks.Count(p => p.TrackType == FfmpegTrackType.Video);
var audioTrackCount = ffmpegInfo.Tracks.Count(p => p.TrackType == FfmpegTrackType.Audio);
var isMp4 = inputVideoFileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase);