mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Merge branch 'master' of https://github.com/SubtitleEdit/subtitleedit
This commit is contained in:
commit
0f574fa180
@ -1795,7 +1795,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
return v / count;
|
||||
}
|
||||
|
||||
internal void GenerateTimeCodes(Subtitle subtitle, double startFromSeconds, int blockSizeMilliseconds, int mininumVolumePercent, int maximumVolumePercent, int defaultMilliseconds)
|
||||
internal void GenerateTimeCodes(double startFromSeconds, int mininumVolumePercent, int maximumVolumePercent, int defaultMilliseconds)
|
||||
{
|
||||
int begin = SecondsToXPosition(startFromSeconds);
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public string NewSource { get; set; }
|
||||
public string NewTarget { get; set; }
|
||||
|
||||
internal void Initialize(Subtitle subtitle, string languageId, string hunspellName, string source)
|
||||
internal void Initialize(string languageId, string hunspellName, string source)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
textBoxOcrFixKey.Text = source;
|
||||
|
@ -122,7 +122,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (p.Text.Length > minLength || p.Text.Contains(Environment.NewLine))
|
||||
{
|
||||
string text = Utilities.AutoBreakLine(p.Text, 5, minLength, MergeLinesShorterThan, language);
|
||||
string text = Utilities.AutoBreakLine(p.Text, 5, MergeLinesShorterThan, language);
|
||||
if (text != p.Text)
|
||||
{
|
||||
AddToListView(p, text);
|
||||
|
@ -775,7 +775,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
item.SubItems[3].Text = "OCR...";
|
||||
var vobSubOcr = new VobSubOcr();
|
||||
vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, true);
|
||||
vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr);
|
||||
sub = vobSubOcr.SubtitleFromOcr;
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (checkBoxRemoveTextForHI.Checked)
|
||||
{
|
||||
p.Text = _removeForHI.RemoveTextFromHearImpaired(p.Text, prevText);
|
||||
p.Text = _removeForHI.RemoveTextFromHearImpaired(p.Text);
|
||||
}
|
||||
if (checkBoxRemoveFormatting.Checked)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName);
|
||||
if (info != null && info.Success)
|
||||
{
|
||||
return info.FramesPerSecond.ToString();
|
||||
|
@ -26,7 +26,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName);
|
||||
if (info != null && info.Success)
|
||||
{
|
||||
numericUpDownVideoWidth.Value = info.Width;
|
||||
|
@ -8,11 +8,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class DCinemaPropertiesInterop : Form
|
||||
{
|
||||
|
||||
private Logic.Subtitle _subtitle;
|
||||
private string _videoFileName;
|
||||
|
||||
public DCinemaPropertiesInterop(Subtitle _subtitle, string _videoFileName)
|
||||
public DCinemaPropertiesInterop()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -44,9 +40,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelFadeDownTime.Text = l.FadeDownTime;
|
||||
}
|
||||
|
||||
this._subtitle = _subtitle;
|
||||
this._videoFileName = _videoFileName;
|
||||
|
||||
foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
||||
{
|
||||
comboBoxLanguage.Items.Add(x.EnglishName);
|
||||
|
@ -8,15 +8,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class DCinemaPropertiesSmpte : Form
|
||||
{
|
||||
private Subtitle _subtitle;
|
||||
private string _videoFileName;
|
||||
|
||||
public DCinemaPropertiesSmpte()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DCinemaPropertiesSmpte(Subtitle _subtitle, string _videoFileName)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -44,9 +36,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonGenerateID.Text = l.Generate;
|
||||
buttonGenFontUri.Text = l.Generate;
|
||||
|
||||
this._subtitle = _subtitle;
|
||||
this._videoFileName = _videoFileName;
|
||||
|
||||
foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
||||
{
|
||||
comboBoxLanguage.Items.Add(x.TwoLetterISOLanguageName);
|
||||
|
@ -80,7 +80,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var fi = new FileInfo(VideoFileName);
|
||||
start = fi.CreationTime;
|
||||
VideoInfo vi = Utilities.GetVideoInfo(VideoFileName, null);
|
||||
VideoInfo vi = Utilities.GetVideoInfo(VideoFileName);
|
||||
durationInSeconds = vi.TotalMilliseconds / 1000.0;
|
||||
if (durationInSeconds < 1)
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
j++;
|
||||
}
|
||||
comboBoxLanguage.SelectedIndex = languageIndex;
|
||||
AddFixActions(subtitle, threeLetterISOLanguageName);
|
||||
AddFixActions(threeLetterISOLanguageName);
|
||||
_originalSubtitle = new Subtitle(subtitle); // copy constructor
|
||||
_subtitle = new Subtitle(subtitle); // copy constructor
|
||||
_format = format;
|
||||
@ -229,7 +229,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
comboBoxLanguage.SelectedIndex = languageIndex;
|
||||
|
||||
AddFixActions(subtitle, threeLetterISOLanguageName);
|
||||
AddFixActions(threeLetterISOLanguageName);
|
||||
|
||||
_originalSubtitle = new Subtitle(subtitle); // copy constructor
|
||||
_subtitle = new Subtitle(subtitle); // copy constructor
|
||||
@ -278,7 +278,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
comboBoxLanguage.SelectedIndex = languageIndex;
|
||||
|
||||
AddFixActions(subtitle, threeLetterISOLanguageName);
|
||||
AddFixActions(threeLetterISOLanguageName);
|
||||
|
||||
_originalSubtitle = new Subtitle(subtitle); // copy constructor
|
||||
_subtitle = new Subtitle(subtitle); // copy constructor
|
||||
@ -340,7 +340,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Activate();
|
||||
}
|
||||
|
||||
private void AddFixActions(Subtitle subtitle, string threeLetterISOLanguageName)
|
||||
private void AddFixActions(string threeLetterISOLanguageName)
|
||||
{
|
||||
_turkishAnsiIndex = -1;
|
||||
_danishLetterIIndex = -1;
|
||||
@ -4225,8 +4225,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
string oldText = p.Text;
|
||||
|
||||
FixSpanishInvertedLetter("?", "¿", p, last, ref wasLastLineClosed, i, fixAction, ref fixCount);
|
||||
FixSpanishInvertedLetter("!", "¡", p, last, ref wasLastLineClosed, i, fixAction, ref fixCount);
|
||||
FixSpanishInvertedLetter("?", "¿", p, last, ref wasLastLineClosed, fixAction, ref fixCount);
|
||||
FixSpanishInvertedLetter("!", "¡", p, last, ref wasLastLineClosed, fixAction, ref fixCount);
|
||||
|
||||
if (p.Text != oldText)
|
||||
{
|
||||
@ -4240,7 +4240,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
LogStatus(_language.FixSpanishInvertedQuestionAndExclamationMarks, fixCount.ToString());
|
||||
}
|
||||
|
||||
private void FixSpanishInvertedLetter(string mark, string inverseMark, Paragraph p, Paragraph last, ref bool wasLastLineClosed, int i, string fixAction, ref int fixCount)
|
||||
private void FixSpanishInvertedLetter(string mark, string inverseMark, Paragraph p, Paragraph last, ref bool wasLastLineClosed, string fixAction, ref int fixCount)
|
||||
{
|
||||
if (p.Text.Contains(mark))
|
||||
{
|
||||
@ -5385,7 +5385,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.Tools.MergeLinesShorterThan, Language);
|
||||
string s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.Tools.MergeLinesShorterThan, Language);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines.Length == 2)
|
||||
{
|
||||
@ -5449,7 +5449,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var ci = (CultureInfo)comboBoxLanguage.SelectedItem;
|
||||
_autoDetectGoogleLanguage = ci.TwoLetterISOLanguageName;
|
||||
AddFixActions(_subtitle, ci.ThreeLetterISOLanguageName);
|
||||
AddFixActions(ci.ThreeLetterISOLanguageName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private LibVlcDynamic _libVlc;
|
||||
private VideoInfo _videoInfo;
|
||||
//long startMilliseconds = 0;
|
||||
Subtitle _subtitle;
|
||||
public Subtitle SubtitleFromOcr;
|
||||
//private System.Windows.Forms.Timer timer1;
|
||||
private const int lineChecksWidth = 50;
|
||||
@ -43,14 +42,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_videoFileName = openFileDialogVideo.FileName;
|
||||
tbFileName.Text = openFileDialogVideo.FileName;
|
||||
_videoInfo = Utilities.GetVideoInfo(_videoFileName, null);
|
||||
_videoInfo = Utilities.GetVideoInfo(_videoFileName);
|
||||
var oldPlayer = Configuration.Settings.General.VideoPlayer;
|
||||
Configuration.Settings.General.VideoPlayer = "VLC";
|
||||
Utilities.InitializeVideoPlayerAndContainer(_videoFileName, _videoInfo, mediaPlayer, VideoLoaded, null);
|
||||
Configuration.Settings.General.VideoPlayer = oldPlayer;
|
||||
_libVlc = mediaPlayer.VideoPlayer as LibVlcDynamic;
|
||||
|
||||
_subtitle = new Subtitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public List<double> SceneChangesInSeconds = new List<double>();
|
||||
private double _frameRate = 25;
|
||||
public ImportSceneChanges(VideoInfo videoInfo, string videoFileName)
|
||||
public ImportSceneChanges(VideoInfo videoInfo)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (videoInfo != null && videoInfo.FramesPerSecond > 1)
|
||||
|
@ -1308,7 +1308,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum)
|
||||
SetDurationInSeconds((double)durationInSeconds);
|
||||
|
||||
MovePrevNext(e, paragraph, beforeParagraph, index);
|
||||
MovePrevNext(e, beforeParagraph, index);
|
||||
|
||||
if (original != null)
|
||||
{
|
||||
@ -1381,7 +1381,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitle.Paragraphs[index] = paragraph;
|
||||
_makeHistoryPaused = true;
|
||||
|
||||
MovePrevNext(e, paragraph, beforeParagraph, index);
|
||||
MovePrevNext(e, beforeParagraph, index);
|
||||
}
|
||||
|
||||
SubtitleListview1.SetStartTime(index, paragraph);
|
||||
@ -1393,7 +1393,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_makeHistoryPaused = false;
|
||||
}
|
||||
|
||||
private void MovePrevNext(Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e, Paragraph paragraph, Paragraph beforeParagraph, int index)
|
||||
private void MovePrevNext(Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e, Paragraph beforeParagraph, int index)
|
||||
{
|
||||
if (e.MovePreviousOrNext)
|
||||
{
|
||||
@ -2656,7 +2656,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (imageCount > 2 && imageCount >= _subtitle.Paragraphs.Count - 2)
|
||||
{
|
||||
if (ContinueNewOrExit())
|
||||
ImportAndOcrSrt(fileName, _subtitle);
|
||||
ImportAndOcrSrt(_subtitle);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -2677,7 +2677,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var subtitle = new Subtitle();
|
||||
satBoxPng.LoadSubtitle(subtitle, list, fileName);
|
||||
if (ContinueNewOrExit())
|
||||
ImportAndOcrSrt(fileName, subtitle);
|
||||
ImportAndOcrSrt(subtitle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3267,7 +3267,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_formPositionsAndSizes.SavePositionAndSize(formSubOcr);
|
||||
}
|
||||
|
||||
private void ImportAndOcrSrt(string fileName, Subtitle subtitle)
|
||||
private void ImportAndOcrSrt(Subtitle subtitle)
|
||||
{
|
||||
var formSubOcr = new VobSubOcr();
|
||||
_formPositionsAndSizes.SetPositionAndSize(formSubOcr);
|
||||
@ -4191,7 +4191,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
_videoFileName = openFileDialog1.FileName;
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName);
|
||||
if (info != null && info.Success)
|
||||
{
|
||||
string oldFrameRate = toolStripComboBoxFrameRate.Text;
|
||||
@ -5187,7 +5187,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
double lengthInSeconds = 0;
|
||||
if (mediaPlayer.VideoPlayer != null)
|
||||
lengthInSeconds = mediaPlayer.Duration;
|
||||
split. Initialize(_subtitle, _fileName, GetCurrentSubtitleFormat(), GetCurrentEncoding(), lengthInSeconds);
|
||||
split. Initialize(_subtitle, _fileName, GetCurrentSubtitleFormat());
|
||||
if (split.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
ShowStatus(_language.SubtitleSplitted);
|
||||
@ -7630,22 +7630,22 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string s = currentParagraph.Text;
|
||||
var arr = Utilities.RemoveHtmlTags(s, true).Replace(Environment.NewLine, "\n").Split('\n');
|
||||
if (arr.Length != 2 || arr[0].Length > Configuration.Settings.General.SubtitleLineMaximumLength || arr[1].Length > Configuration.Settings.General.SubtitleLineMaximumLength)
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.Tools.MergeLinesShorterThan, language);
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.Tools.MergeLinesShorterThan, language);
|
||||
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, Configuration.Settings.General.SubtitleLineMaximumLength, 20, language);
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, 20, language);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, Convert.ToInt32(Configuration.Settings.General.SubtitleLineMaximumLength * 0.7), 18, language);
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, 18, language);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, Convert.ToInt32(Configuration.Settings.General.SubtitleLineMaximumLength * 0.5), 15, language);
|
||||
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, 15, language);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
@ -7810,23 +7810,23 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Utilities.AutoBreakLine(originalCurrent.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.Tools.MergeLinesShorterThan, languageOriginal);
|
||||
string s = Utilities.AutoBreakLine(originalCurrent.Text, 5, Configuration.Settings.Tools.MergeLinesShorterThan, languageOriginal);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, Configuration.Settings.General.SubtitleLineMaximumLength, 20, languageOriginal);
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, 20, languageOriginal);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, Convert.ToInt32(Configuration.Settings.General.SubtitleLineMaximumLength * 0.7), 18, languageOriginal);
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, 18, languageOriginal);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, Convert.ToInt32(Configuration.Settings.General.SubtitleLineMaximumLength * 0.5), 15, languageOriginal);
|
||||
string s = Utilities.AutoBreakLine(lines[0], 3, 15, languageOriginal);
|
||||
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
if (lines.Length == 2)
|
||||
@ -9964,7 +9964,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private static Subtitle LoadMp4SubtitleForSync(string fileName, Logic.Mp4.Boxes.Trak mp4SubtitleTrack)
|
||||
private static Subtitle LoadMp4SubtitleForSync(Logic.Mp4.Boxes.Trak mp4SubtitleTrack)
|
||||
{
|
||||
var subtitle = new Subtitle();
|
||||
if (mp4SubtitleTrack.Mdia.IsVobSubSubtitle)
|
||||
@ -10525,7 +10525,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
vobSubOcr.ShowIcon = true;
|
||||
}
|
||||
_formPositionsAndSizes.SetPositionAndSize(vobSubOcr);
|
||||
if (vobSubOcr.Initialize(fileName, Configuration.Settings.VobSubOcr, true, this))
|
||||
if (vobSubOcr.Initialize(fileName, Configuration.Settings.VobSubOcr, this))
|
||||
{
|
||||
if (vobSubOcr.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
@ -12189,7 +12189,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int indexFixed = autoBreakUnbreakLines.FixedParagraphs.IndexOf(p);
|
||||
if (indexFixed >= 0)
|
||||
{
|
||||
p.Text = Utilities.AutoBreakLine(p.Text, 5, autoBreakUnbreakLines.MininumLength, autoBreakUnbreakLines.MergeLinesShorterThan, language);
|
||||
p.Text = Utilities.AutoBreakLine(p.Text, 5, autoBreakUnbreakLines.MergeLinesShorterThan, language);
|
||||
SubtitleListview1.SetText(index, p.Text);
|
||||
SubtitleListview1.SyntaxColorLine(_subtitle.Paragraphs, index, p);
|
||||
}
|
||||
@ -12674,7 +12674,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (mp4SubtitleTracks.Count == 1)
|
||||
{
|
||||
sub = LoadMp4SubtitleForSync(fileName, mp4SubtitleTracks[0]);
|
||||
sub = LoadMp4SubtitleForSync(mp4SubtitleTracks[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -12682,7 +12682,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
subtitleChooser.Initialize(mp4SubtitleTracks);
|
||||
if (subtitleChooser.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
sub = LoadMp4SubtitleForSync(fileName, mp4SubtitleTracks[0]);
|
||||
sub = LoadMp4SubtitleForSync(mp4SubtitleTracks[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13143,7 +13143,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private static VideoInfo ShowVideoInfo(string fileName)
|
||||
{
|
||||
return Utilities.GetVideoInfo(fileName, delegate { Application.DoEvents(); });
|
||||
return Utilities.GetVideoInfo(fileName);
|
||||
}
|
||||
|
||||
private void TryToFindAndOpenVideoFile(string fileNameNoExtension)
|
||||
@ -16396,7 +16396,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_networkSession.InsertLine(insertIndex, insertParagraph);
|
||||
doReFill = true;
|
||||
}
|
||||
_networkSession.CheckForAndSubmitUpdates(updates); // updates only (no inserts/deletes)
|
||||
_networkSession.CheckForAndSubmitUpdates(); // updates only (no inserts/deletes)
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -18520,7 +18520,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (formatType == typeof(TimedText10) || formatType == typeof(ItunesTimedText))
|
||||
{
|
||||
var styles = new TimedTextStyles(_subtitle, GetCurrentSubtitleFormat());
|
||||
var styles = new TimedTextStyles(_subtitle);
|
||||
if (styles.ShowDialog(this) == DialogResult.OK)
|
||||
_subtitle.Header = styles.Header;
|
||||
}
|
||||
@ -18716,14 +18716,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (GetCurrentSubtitleFormat().GetType() == typeof(DCSubtitle))
|
||||
{
|
||||
var properties = new DCinemaPropertiesInterop(_subtitle, _videoFileName);
|
||||
var properties = new DCinemaPropertiesInterop();
|
||||
_formPositionsAndSizes.SetPositionAndSize(properties, true);
|
||||
properties.ShowDialog(this);
|
||||
_formPositionsAndSizes.SavePositionAndSize(properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
var properties = new DCinemaPropertiesSmpte(_subtitle, _videoFileName);
|
||||
var properties = new DCinemaPropertiesSmpte();
|
||||
_formPositionsAndSizes.SetPositionAndSize(properties, true);
|
||||
properties.ShowDialog(this);
|
||||
_formPositionsAndSizes.SavePositionAndSize(properties);
|
||||
@ -18773,7 +18773,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (GetCurrentSubtitleFormat().GetType() == typeof(TimedText10) || GetCurrentSubtitleFormat().GetType() == typeof(ItunesTimedText))
|
||||
{
|
||||
var properties = new TimedTextProperties(_subtitle, _videoFileName);
|
||||
var properties = new TimedTextProperties(_subtitle);
|
||||
_formPositionsAndSizes.SetPositionAndSize(properties, true);
|
||||
properties.ShowDialog(this);
|
||||
_formPositionsAndSizes.SavePositionAndSize(properties);
|
||||
@ -18850,7 +18850,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitle.Paragraphs.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
audioVisualizer.GenerateTimeCodes(_subtitle, startFrom, form.BlockSize, form.VolumeMinimum, form.VolumeMaximum, form.DefaultMilliseconds);
|
||||
audioVisualizer.GenerateTimeCodes(form.BlockSize, form.VolumeMinimum, form.VolumeMaximum, form.DefaultMilliseconds);
|
||||
if (IsFramesRelevant && CurrentFrameRate > 0)
|
||||
_subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(CurrentFrameRate);
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
@ -19463,7 +19463,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void toolStripMenuItemImportSceneChanges_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new ImportSceneChanges(_videoInfo, _videoFileName);
|
||||
var form = new ImportSceneChanges(_videoInfo);
|
||||
_formPositionsAndSizes.SetPositionAndSize(form);
|
||||
if (form.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
@ -19666,7 +19666,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_formPositionsAndSizes.SetPositionAndSize(form);
|
||||
if (form.ShowDialog(this) == DialogResult.OK && form.Subtitle.Paragraphs.Count > 0)
|
||||
{
|
||||
ImportAndOcrSrt("images", form.Subtitle);
|
||||
ImportAndOcrSrt(form.Subtitle);
|
||||
}
|
||||
_formPositionsAndSizes.SavePositionAndSize(form);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.Items.Clear();
|
||||
SubtitleListview1.BeginUpdate();
|
||||
int count;
|
||||
_mergedSubtitle = MergeLinesWithSameTimeCodes(_subtitle, mergedIndexes, out count, true, checkBoxAutoBreakOn.Checked, true, (int)numericUpDownMaxMillisecondsBetweenLines.Value);
|
||||
_mergedSubtitle = MergeLinesWithSameTimeCodes(_subtitle, mergedIndexes, out count, true, checkBoxAutoBreakOn.Checked, (int)numericUpDownMaxMillisecondsBetweenLines.Value);
|
||||
NumberOfMerges = count;
|
||||
|
||||
SubtitleListview1.Fill(_subtitle);
|
||||
@ -139,7 +139,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.Items.Clear();
|
||||
SubtitleListview1.BeginUpdate();
|
||||
int count;
|
||||
_mergedSubtitle = MergeLinesWithSameTimeCodes(_subtitle, mergedIndexes, out count, false, checkBoxAutoBreakOn.Checked, true, (int)numericUpDownMaxMillisecondsBetweenLines.Value);
|
||||
_mergedSubtitle = MergeLinesWithSameTimeCodes(_subtitle, mergedIndexes, out count, false, checkBoxAutoBreakOn.Checked, (int)numericUpDownMaxMillisecondsBetweenLines.Value);
|
||||
NumberOfMerges = count;
|
||||
SubtitleListview1.Fill(_subtitle);
|
||||
foreach (var index in mergedIndexes)
|
||||
@ -151,7 +151,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
groupBoxLinesFound.Text = string.Format(Configuration.Settings.Language.MergeTextWithSameTimeCodes.NumberOfMergesX, NumberOfMerges);
|
||||
}
|
||||
|
||||
public Subtitle MergeLinesWithSameTimeCodes(Subtitle subtitle, List<int> mergedIndexes, out int numberOfMerges, bool clearFixes, bool reBreak, bool lineAfterNext, int maxMsBetween)
|
||||
public Subtitle MergeLinesWithSameTimeCodes(Subtitle subtitle, List<int> mergedIndexes, out int numberOfMerges, bool clearFixes, bool reBreak, int maxMsBetween)
|
||||
{
|
||||
listViewFixes.BeginUpdate();
|
||||
List<int> removed = new List<int>();
|
||||
|
@ -75,7 +75,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
DialogResult = DialogResult.Abort;
|
||||
}
|
||||
|
||||
internal void Initialize(string word, List<string> suggestions, string line, string[] words, int i, Bitmap bitmap)
|
||||
internal void Initialize(string word, List<string> suggestions, string line, Bitmap bitmap)
|
||||
{
|
||||
_originalWord = word;
|
||||
OriginalWholeText = line;
|
||||
|
@ -154,7 +154,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
prevIndex++;
|
||||
|
||||
_removeTextForHILib.WarningIndex = prevIndex;
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text, prevText);
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text);
|
||||
bool hit = p.Text.Replace(" ", string.Empty) != newText.Replace(" ", string.Empty);
|
||||
if (hit)
|
||||
{
|
||||
@ -213,7 +213,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
prevText = prev.Text;
|
||||
|
||||
_removeTextForHILib.Settings = GetSettings();
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text, prevText);
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text);
|
||||
if (string.IsNullOrEmpty(newText))
|
||||
{
|
||||
_subtitle.Paragraphs.RemoveAt(i);
|
||||
|
@ -128,7 +128,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
videoPlayerContainer1.VideoPlayer.DisposeVideoPlayer();
|
||||
}
|
||||
|
||||
VideoInfo videoInfo = Utilities.GetVideoInfo(fileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo videoInfo = Utilities.GetVideoInfo(fileName);
|
||||
|
||||
Utilities.InitializeVideoPlayerAndContainer(fileName, videoInfo, videoPlayerContainer1, VideoStartLoaded, VideoStartEnded);
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string _prefix = string.Empty;
|
||||
string _postfix = string.Empty;
|
||||
Hunspell _hunspell;
|
||||
string _dictionaryFolder;
|
||||
Paragraph _currentParagraph;
|
||||
int _currentIndex;
|
||||
string _currentWord;
|
||||
@ -1009,7 +1008,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public void DoSpellCheck(bool autoDetect, Subtitle subtitle, string dictionaryFolder, Main mainWindow, int startLine)
|
||||
{
|
||||
_subtitle = subtitle;
|
||||
_dictionaryFolder = dictionaryFolder;
|
||||
LanguageStructure.Main mainLanguage = Configuration.Settings.Language.Main;
|
||||
_mainWindow = mainWindow;
|
||||
|
||||
|
@ -11,8 +11,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public sealed partial class Split : Form
|
||||
{
|
||||
Subtitle _subtitle;
|
||||
SubtitleFormat _format;
|
||||
Encoding _encoding;
|
||||
public bool ShowBasic { get; private set; }
|
||||
int _totalNumberOfCharacters;
|
||||
bool _loading = true;
|
||||
@ -63,7 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(Subtitle subtitle, string fileName, SubtitleFormat format, Encoding encoding, double lengthInSeconds)
|
||||
public void Initialize(Subtitle subtitle, string fileName, SubtitleFormat format)
|
||||
{
|
||||
ShowBasic = false;
|
||||
_subtitle = subtitle;
|
||||
@ -72,8 +70,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
textBoxFileName.Text = fileName;
|
||||
_fileName = fileName;
|
||||
_format = format;
|
||||
_encoding = encoding;
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
_totalNumberOfCharacters += p.Text.Length;
|
||||
labelLines.Text = string.Format(Configuration.Settings.Language.Split.NumberOfLinesX, _subtitle.Paragraphs.Count);
|
||||
|
@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string dialogText = string.Empty;
|
||||
if (p.Text.Contains("-"))
|
||||
{
|
||||
dialogText = Utilities.AutoBreakLine(p.Text, 5, 100, 1, language);
|
||||
dialogText = Utilities.AutoBreakLine(p.Text, 5, 1, language);
|
||||
string[] arr = dialogText.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
if (arr.Length == 2 && (arr[0].StartsWith("-") || arr[0].StartsWith("<i>-")) && (arr[1].StartsWith("-") || arr[1].StartsWith("<i>-")))
|
||||
isDialog = true;
|
||||
|
@ -153,7 +153,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName);
|
||||
if (info != null && info.Success)
|
||||
{
|
||||
splitTimeUpDownAdjust.TimeCode = new TimeCode(info.TotalMilliseconds);
|
||||
|
@ -260,7 +260,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName, delegate { Application.DoEvents(); });
|
||||
VideoInfo info = Utilities.GetVideoInfo(openFileDialog1.FileName);
|
||||
if (info != null && info.Success)
|
||||
{
|
||||
numericUpDownVideoWidth.Value = info.Width;
|
||||
|
@ -10,19 +10,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public partial class TimedTextProperties : Form
|
||||
{
|
||||
private Subtitle _subtitle;
|
||||
private string _videoFileName;
|
||||
private XmlDocument _xml;
|
||||
private XmlNode _xmlHead;
|
||||
private XmlNamespaceManager _nsmgr;
|
||||
private string _NA;
|
||||
|
||||
public TimedTextProperties(Subtitle subtitle, string videoFileName)
|
||||
public TimedTextProperties(Subtitle subtitle)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this._subtitle = subtitle;
|
||||
this._videoFileName = videoFileName;
|
||||
_NA = "[" + Configuration.Settings.Language.General.NotAvailable + "]";
|
||||
_NA = "[" + Configuration.Settings.Language.General.NotAvailable + "]";
|
||||
comboBoxDropMode.Items[0] = _NA;
|
||||
comboBoxTimeBase.Items[0] = _NA;
|
||||
comboBoxDefaultStyle.Items.Add(_NA);
|
||||
|
@ -14,7 +14,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public sealed partial class TimedTextStyles : Form
|
||||
{
|
||||
private Subtitle _subtitle = null;
|
||||
private SubtitleFormat _format = null;
|
||||
private XmlDocument _xml;
|
||||
private XmlNode _xmlHead;
|
||||
private XmlNamespaceManager _nsmgr;
|
||||
@ -22,12 +21,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private Timer _previewTimer = new Timer();
|
||||
public string Header { get { return _xml.OuterXml; } }
|
||||
|
||||
public TimedTextStyles(Subtitle subtitle, SubtitleFormat format)
|
||||
public TimedTextStyles(Subtitle subtitle)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_subtitle = subtitle;
|
||||
_format = format;
|
||||
_xml = new XmlDocument();
|
||||
try
|
||||
{
|
||||
@ -199,13 +197,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (node.Attributes["tts:fontSize"] != null)
|
||||
fontSize = node.Attributes["tts:fontSize"].Value;
|
||||
|
||||
AddStyle(name, fontFamily, fontWeight, fontStyle, fontColor, fontSize);
|
||||
AddStyle(name, fontFamily, fontColor, fontSize);
|
||||
}
|
||||
if (listViewStyles.Items.Count > 0)
|
||||
listViewStyles.Items[0].Selected = true;
|
||||
}
|
||||
|
||||
private void AddStyle(string name, string fontFamily, string fontWeight, string fontStyle, string color, string fontSize)
|
||||
private void AddStyle(string name, string fontFamily, string color, string fontSize)
|
||||
{
|
||||
var item = new ListViewItem(name.Trim());
|
||||
item.UseItemStyleForSubItems = false;
|
||||
@ -401,7 +399,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
name = "new" + count;
|
||||
count++;
|
||||
}
|
||||
AddStyle(name, "Arial", "normal", "normal", "white", "100%");
|
||||
AddStyle(name, "Arial", "white", "100%");
|
||||
AddStyleToXml(name, "Arial", "normal", "normal", "white", "100%");
|
||||
listViewStyles.Items[listViewStyles.Items.Count - 1].Selected = true;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private VideoInfo ShowVideoInfo(string fileName)
|
||||
{
|
||||
_videoInfo = Utilities.GetVideoInfo(fileName, delegate { Application.DoEvents(); });
|
||||
_videoInfo = Utilities.GetVideoInfo(fileName);
|
||||
var info = new FileInfo(fileName);
|
||||
long fileSizeInBytes = info.Length;
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
nbmp.ReplaceTransparentWith(Color.Black);
|
||||
|
||||
//get nocr matches
|
||||
Nikse.SubtitleEdit.Forms.VobSubOcr.CompareMatch match = vobSubOcr.GetNOcrCompareMatchNew(item, nbmp, nOcrDb, _unItalicFactor, false, false);
|
||||
Nikse.SubtitleEdit.Forms.VobSubOcr.CompareMatch match = vobSubOcr.GetNOcrCompareMatchNew(item, nbmp, nOcrDb, false, false);
|
||||
if (match == null)
|
||||
{
|
||||
listBoxInspectItems.Items.Add("?");
|
||||
@ -233,7 +233,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var match = _matchList[index];
|
||||
|
||||
var vobSubOcrNOcrCharacter = new VobSubOcrNOcrCharacter();
|
||||
vobSubOcrNOcrCharacter.Initialize(_bitmap, img, new Point(0, 0), false, expandSelectionList.Count > 1, null, null, _vobSubOcr);
|
||||
vobSubOcrNOcrCharacter.Initialize(_bitmap, img, new Point(0, 0), false, expandSelectionList.Count > 1);
|
||||
DialogResult result = vobSubOcrNOcrCharacter.ShowDialog(this);
|
||||
bool expandSelection = false;
|
||||
bool shrinkSelection = false;
|
||||
@ -259,7 +259,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
img = VobSubOcr.GetExpandedSelection(new NikseBitmap(_bitmap), expandSelectionList, false); // true
|
||||
}
|
||||
|
||||
vobSubOcrNOcrCharacter.Initialize(_bitmap2, img, new Point(0, 0), false, expandSelectionList.Count > 1, null, null, _vobSubOcr);
|
||||
vobSubOcrNOcrCharacter.Initialize(_bitmap2, img, new Point(0, 0), false, expandSelectionList.Count > 1);
|
||||
result = vobSubOcrNOcrCharacter.ShowDialog(this);
|
||||
|
||||
if (result == DialogResult.OK && vobSubOcrNOcrCharacter.ShrinkSelection)
|
||||
|
@ -120,7 +120,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
Bitmap bmp = GenerateImageFromTextWithStyle(s, bold);
|
||||
var nbmp = new NikseBitmap(bmp);
|
||||
nbmp.MakeTwoColor(210, 280);
|
||||
nbmp.MakeTwoColor(280);
|
||||
var list = NikseBitmapImageSplitter.SplitBitmapToLettersNew(nbmp, 10, false, false, 25);
|
||||
if (list.Count == 1)
|
||||
{
|
||||
|
@ -100,9 +100,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public int NumberOfPixelsIsSpace;
|
||||
public bool RightToLeft;
|
||||
public float MaxErrorPercent;
|
||||
public XmlDocument CompareDoc { get; set; }
|
||||
|
||||
public ImageCompareThreadParameter(Bitmap picture, int index, List<CompareItem> compareBitmaps, BackgroundWorker self, int increment, int numberOfPixelsIsSpace, bool rightToLeft, float maxErrorPercent, XmlDocument compareDoc)
|
||||
public ImageCompareThreadParameter(Bitmap picture, int index, List<CompareItem> compareBitmaps, BackgroundWorker self, int increment, int numberOfPixelsIsSpace, bool rightToLeft, float maxErrorPercent)
|
||||
{
|
||||
Self = self;
|
||||
Picture = picture;
|
||||
@ -116,7 +115,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
NumberOfPixelsIsSpace = numberOfPixelsIsSpace;
|
||||
RightToLeft = rightToLeft;
|
||||
MaxErrorPercent = maxErrorPercent;
|
||||
CompareDoc = compareDoc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,12 +273,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
VobSubOcrNOcrCharacter _vobSubOcrNOcrCharacter = new VobSubOcrNOcrCharacter();
|
||||
int _nocrLastLowercaseHeight = -1;
|
||||
int _nocrLastUppercaseHeight = -1;
|
||||
List<BackgroundWorker> _nocrThreads = null;
|
||||
bool _nocrThreadsStop = false;
|
||||
string[] _nocrThreadResults = null;
|
||||
public const int NocrMinColor = 300;
|
||||
|
||||
List<BackgroundWorker> _icThreads = null;
|
||||
bool _icThreadsStop = false;
|
||||
string[] _icThreadResults = null;
|
||||
|
||||
@ -508,9 +504,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
internal void InitializeBatch(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, bool useNewSubIdxCode)
|
||||
internal void InitializeBatch(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings)
|
||||
{
|
||||
Initialize(vobSubFileName, vobSubOcrSettings, useNewSubIdxCode, null);
|
||||
Initialize(vobSubFileName, vobSubOcrSettings, null);
|
||||
FormVobSubOcr_Shown(null, null);
|
||||
|
||||
int max = GetSubtitleCount();
|
||||
@ -590,7 +586,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SetButtonsEnabledAfterOcrDone();
|
||||
}
|
||||
|
||||
internal bool Initialize(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, bool useNewSubIdxCode, Main main)
|
||||
internal bool Initialize(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, Main main)
|
||||
{
|
||||
_main = main;
|
||||
buttonOK.Enabled = false;
|
||||
@ -1374,7 +1370,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return returnBmp;
|
||||
|
||||
var n = new NikseBitmap(returnBmp);
|
||||
n.MakeTwoColor(210, 280);
|
||||
n.MakeTwoColor(280);
|
||||
returnBmp.Dispose();
|
||||
return n.GetBitmap();
|
||||
}
|
||||
@ -1504,7 +1500,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return new Point((int)Math.Round(p.X + (height - p.Y) * unItalicFactor - moveLeftPixels), p.Y);
|
||||
}
|
||||
|
||||
private static NOcrChar NOcrFindExpandedMatch(NikseBitmap nbmp, ImageSplitterItem targetItem, int topMargin, List<NOcrChar> nOcrChars)
|
||||
private static NOcrChar NOcrFindExpandedMatch(NikseBitmap nbmp, ImageSplitterItem targetItem, List<NOcrChar> nOcrChars)
|
||||
{
|
||||
// var nbmp = new NikseBitmap(parentBitmap);
|
||||
int w = targetItem.NikseBitmap.Width;
|
||||
@ -1518,7 +1514,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
while (index < oc.LinesForeground.Count && ok)
|
||||
{
|
||||
NOcrPoint op = oc.LinesForeground[index];
|
||||
foreach (Point point in op.GetPoints(oc.Width, oc.Height))
|
||||
foreach (Point point in op.GetPoints())
|
||||
{
|
||||
Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
|
||||
if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
|
||||
@ -1540,7 +1536,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
while (index < oc.LinesBackground.Count && ok)
|
||||
{
|
||||
NOcrPoint op = oc.LinesBackground[index];
|
||||
foreach (Point point in op.GetPoints(oc.Width, oc.Height))
|
||||
foreach (Point point in op.GetPoints())
|
||||
{
|
||||
Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
|
||||
if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
|
||||
@ -1608,7 +1604,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return null;
|
||||
}
|
||||
|
||||
private static NOcrChar NOcrFindBestMatch(NikseBitmap parentBitmap, ImageSplitterItem targetItem, int topMargin, out bool italic, List<NOcrChar> nOcrChars, double unItalicFactor, bool tryItalicScaling, bool deepSeek)
|
||||
private static NOcrChar NOcrFindBestMatch(ImageSplitterItem targetItem, int topMargin, out bool italic, List<NOcrChar> nOcrChars, double unItalicFactor, bool tryItalicScaling, bool deepSeek)
|
||||
{
|
||||
italic = false;
|
||||
var nbmp = targetItem.NikseBitmap;
|
||||
@ -2065,7 +2061,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// bool unitalicOk = true;
|
||||
// foreach (var spi in list)
|
||||
// {
|
||||
// var m = NOcrFindBestMatch(parentBitmap, spi, topMargin, out italic, nOcrChars, unItalicFactor, false, true);
|
||||
// var m = NOcrFindBestMatch(spi, topMargin, out italic, nOcrChars, unItalicFactor, false, true);
|
||||
// if (m == null)
|
||||
// {
|
||||
// if (spi.Bitmap.Width > 2)
|
||||
@ -2277,7 +2273,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
|
||||
private static NOcrChar NOcrFindBestMatchNew(NikseBitmap parentBitmap, ImageSplitterItem targetItem, int topMargin, out bool italic, NOcrDb nOcrDb, double unItalicFactor, bool tryItalicScaling, bool deepSeek)
|
||||
private static NOcrChar NOcrFindBestMatchNew(ImageSplitterItem targetItem, int topMargin, out bool italic, NOcrDb nOcrDb, bool tryItalicScaling, bool deepSeek)
|
||||
{
|
||||
italic = false;
|
||||
var nbmp = targetItem.NikseBitmap;
|
||||
@ -2614,7 +2610,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// bool unitalicOk = true;
|
||||
// foreach (var spi in list)
|
||||
// {
|
||||
// var m = NOcrFindBestMatch(parentBitmap, spi, topMargin, out italic, nOcrChars, unItalicFactor, false, true);
|
||||
// var m = NOcrFindBestMatch(spi, topMargin, out italic, nOcrChars, unItalicFactor, false, true);
|
||||
// if (m == null)
|
||||
// {
|
||||
// if (spi.Bitmap.Width > 2)
|
||||
@ -2674,14 +2670,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return c;
|
||||
}
|
||||
|
||||
internal CompareMatch GetNOcrCompareMatch(ImageSplitterItem targetItem, NikseBitmap parentBitmap, NOcrDb nOcrDb, double unItalicFactor, bool tryItalicScaling, bool deepSeek)
|
||||
internal CompareMatch GetNOcrCompareMatch(ImageSplitterItem targetItem, NikseBitmap parentBitmap, NOcrDb nOcrDb, bool tryItalicScaling, bool deepSeek)
|
||||
{
|
||||
bool italic;
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, nOcrDb.OcrCharacters);
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, nOcrDb.OcrCharacters);
|
||||
if (expandedResult != null)
|
||||
return new CompareMatch(expandedResult.Text, expandedResult.Italic, expandedResult.ExpandCount, null, expandedResult);
|
||||
|
||||
var result = NOcrFindBestMatchNew(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, out italic, nOcrDb, unItalicFactor, tryItalicScaling, deepSeek);
|
||||
var result = NOcrFindBestMatchNew(targetItem, targetItem.Y - targetItem.ParentY, out italic, nOcrDb, tryItalicScaling, deepSeek);
|
||||
if (result == null)
|
||||
{
|
||||
if (checkBoxNOcrCorrect.Checked)
|
||||
@ -2718,14 +2714,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
|
||||
internal CompareMatch GetNOcrCompareMatchNew(ImageSplitterItem targetItem, NikseBitmap parentBitmap, NOcrDb nOcrDb, double unItalicFactor, bool tryItalicScaling, bool deepSeek)
|
||||
internal CompareMatch GetNOcrCompareMatchNew(ImageSplitterItem targetItem, NikseBitmap parentBitmap, NOcrDb nOcrDb, bool tryItalicScaling, bool deepSeek)
|
||||
{
|
||||
bool italic;
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, nOcrDb.OcrCharactersExpanded);
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, nOcrDb.OcrCharactersExpanded);
|
||||
if (expandedResult != null)
|
||||
return new CompareMatch(expandedResult.Text, expandedResult.Italic, expandedResult.ExpandCount, null, expandedResult);
|
||||
|
||||
var result = NOcrFindBestMatchNew(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, out italic, nOcrDb, unItalicFactor, tryItalicScaling, deepSeek);
|
||||
var result = NOcrFindBestMatchNew(targetItem, targetItem.Y - targetItem.ParentY, out italic, nOcrDb, tryItalicScaling, deepSeek);
|
||||
if (result == null)
|
||||
{
|
||||
if (checkBoxNOcrCorrect.Checked)
|
||||
@ -2766,11 +2762,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
internal static CompareMatch GetNOcrCompareMatch(ImageSplitterItem targetItem, NikseBitmap parentBitmap, NOcrThreadParameter p)
|
||||
{
|
||||
bool italic;
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, p.NOcrChars);
|
||||
var expandedResult = NOcrFindExpandedMatch(parentBitmap, targetItem, p.NOcrChars);
|
||||
if (expandedResult != null)
|
||||
return new CompareMatch(expandedResult.Text, expandedResult.Italic, expandedResult.ExpandCount, null, expandedResult);
|
||||
|
||||
var result = NOcrFindBestMatch(parentBitmap, targetItem, targetItem.Y - targetItem.ParentY, out italic, p.NOcrChars, p.UnItalicFactor, p.AdvancedItalicDetection, true);
|
||||
var result = NOcrFindBestMatch(targetItem, targetItem.Y - targetItem.ParentY, out italic, p.NOcrChars, p.UnItalicFactor, p.AdvancedItalicDetection, true);
|
||||
if (result == null)
|
||||
return null;
|
||||
|
||||
@ -2919,7 +2915,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
|
||||
private CompareMatch GetCompareMatchNew(ImageSplitterItem targetItem, NikseBitmap parentBitmap, out CompareMatch secondBestGuess, List<ImageSplitterItem> list, int listIndex)
|
||||
private CompareMatch GetCompareMatchNew(ImageSplitterItem targetItem, out CompareMatch secondBestGuess, List<ImageSplitterItem> list, int listIndex)
|
||||
{
|
||||
double maxDiff = (double)numericUpDownMaxErrorPct.Value;
|
||||
secondBestGuess = null;
|
||||
@ -4050,11 +4046,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
{
|
||||
CompareMatch bestGuess;
|
||||
CompareMatch match = GetCompareMatchNew(item, parentBitmap, out bestGuess, list, index);
|
||||
CompareMatch match = GetCompareMatchNew(item, out bestGuess, list, index);
|
||||
if (match == null) // Try line OCR if no image compare match
|
||||
{
|
||||
if (_nOcrDb != null && _nOcrDb.OcrCharacters.Count > 0)
|
||||
match = GetNOcrCompareMatchNew(item, parentBitmap, _nOcrDb, _unItalicFactor, true, true);
|
||||
match = GetNOcrCompareMatchNew(item, parentBitmap, _nOcrDb, true, true);
|
||||
}
|
||||
|
||||
if (match == null)
|
||||
@ -4187,7 +4183,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_binOcrLastUppercaseHeight = height;
|
||||
}
|
||||
|
||||
private void SaveNOcr(string fileName)
|
||||
private void SaveNOcr()
|
||||
{
|
||||
|
||||
try
|
||||
@ -4270,7 +4266,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
item.Y += nbmp.CropTopTransparent(0);
|
||||
nbmp.CropTransparentSidesAndBottom(0, true);
|
||||
nbmp.ReplaceTransparentWith(Color.Black);
|
||||
GetNOcrCompareMatch(item, nikseBitmap, _nOcrDb, _unItalicFactor, false, false);
|
||||
GetNOcrCompareMatch(item, nikseBitmap, _nOcrDb, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4329,7 +4325,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
item.NikseBitmap.ReplaceTransparentWith(Color.Black);
|
||||
}
|
||||
|
||||
_vobSubOcrNOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, expandSelectionList.Count > 1, null, _lastAdditions, this);
|
||||
_vobSubOcrNOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, expandSelectionList.Count > 1);
|
||||
DialogResult result = _vobSubOcrNOcrCharacter.ShowDialog(this);
|
||||
_manualOcrDialogPosition = _vobSubOcrNOcrCharacter.FormPosition;
|
||||
if (result == DialogResult.OK && _vobSubOcrNOcrCharacter.ShrinkSelection)
|
||||
@ -4374,10 +4370,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
CompareMatch match = GetNOcrCompareMatchNew(item, nbmpInput, _nOcrDb, _unItalicFactor, checkBoxNOcrItalic.Checked, !checkBoxNOcrCorrect.Checked);
|
||||
CompareMatch match = GetNOcrCompareMatchNew(item, nbmpInput, _nOcrDb, checkBoxNOcrItalic.Checked, !checkBoxNOcrCorrect.Checked);
|
||||
if (match == null)
|
||||
{
|
||||
_vobSubOcrNOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, false, null, _lastAdditions, this);
|
||||
_vobSubOcrNOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, false);
|
||||
DialogResult result = _vobSubOcrNOcrCharacter.ShowDialog(this);
|
||||
_manualOcrDialogPosition = _vobSubOcrNOcrCharacter.FormPosition;
|
||||
if (result == DialogResult.OK && _vobSubOcrNOcrCharacter.ExpandSelection)
|
||||
@ -5397,7 +5393,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
_nocrThreadsStop = false;
|
||||
_nocrThreads = new List<BackgroundWorker>();
|
||||
_nocrThreadResults = new string[_subtitle.Paragraphs.Count];
|
||||
int noOfThreads = Environment.ProcessorCount - 1;
|
||||
if (noOfThreads >= max)
|
||||
@ -5454,7 +5449,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (comboBoxOcrMethod.SelectedIndex == 1)
|
||||
{
|
||||
_icThreadsStop = false;
|
||||
_icThreads = new List<BackgroundWorker>();
|
||||
_icThreadResults = new string[_subtitle.Paragraphs.Count];
|
||||
int noOfThreads = Environment.ProcessorCount - 2; // -1 or -2?
|
||||
if (noOfThreads >= max)
|
||||
@ -5468,7 +5462,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
Application.DoEvents();
|
||||
var bw = new BackgroundWorker();
|
||||
var p = new ImageCompareThreadParameter(GetSubtitleBitmap(start + i), start + i, _compareBitmaps, bw, noOfThreads, (int)numericUpDownPixelsIsSpace.Value, checkBoxRightToLeft.Checked, (float)numericUpDownMaxErrorPct.Value, _compareDoc);
|
||||
var p = new ImageCompareThreadParameter(GetSubtitleBitmap(start + i), start + i, _compareBitmaps, bw, noOfThreads, (int)numericUpDownPixelsIsSpace.Value, checkBoxRightToLeft.Checked, (float)numericUpDownMaxErrorPct.Value);
|
||||
bw.DoWork += ImageCompareThreadDoWork;
|
||||
bw.RunWorkerCompleted += ImageCompareThreadRunWorkerCompleted;
|
||||
bw.RunWorkerAsync(p);
|
||||
@ -5606,7 +5600,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
internal void SaveNOcrWithCurrentLanguage()
|
||||
{
|
||||
SaveNOcr(GetNOcrLanguageFileName());
|
||||
SaveNOcr();
|
||||
}
|
||||
|
||||
private static Bitmap ResizeBitmap(Bitmap b, int width, int height)
|
||||
@ -7571,7 +7565,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
CompareMatch bestGuess;
|
||||
CompareMatch match;
|
||||
if (_binaryOcrDb != null)
|
||||
match = GetCompareMatchNew(item, parentBitmap, out bestGuess, list, index);
|
||||
match = GetCompareMatchNew(item, out bestGuess, list, index);
|
||||
else
|
||||
match = GetCompareMatch(item, parentBitmap, out bestGuess, list, index);
|
||||
if (match == null)
|
||||
@ -8026,7 +8020,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
text = text.Substring(text.IndexOf(":") + 1).Trim().ToLower();
|
||||
var form = new AddToOcrReplaceList();
|
||||
form.Initialize(_subtitle, _languageId, comboBoxDictionaries.Text, text);
|
||||
form.Initialize(_languageId, comboBoxDictionaries.Text, text);
|
||||
if (form.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
comboBoxDictionaries_SelectedIndexChanged(null, null);
|
||||
@ -8198,7 +8192,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void comboBoxNOcrLanguage_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
_nOcrDb = null;
|
||||
_nocrThreads = null;
|
||||
}
|
||||
|
||||
private void buttonSpellCheckDownload_Click(object sender, EventArgs e)
|
||||
|
@ -9,9 +9,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class VobSubOcrNOcrCharacter : Form
|
||||
{
|
||||
|
||||
VobSubOcr _vobSubForm;
|
||||
List<VobSubOcr.ImageCompareAddition> _additions;
|
||||
NOcrChar _nocrChar = null;
|
||||
bool _drawLineOn;
|
||||
bool _startDone;
|
||||
@ -72,7 +69,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showShrink, VobSubOcr.CompareMatch bestGuess, List<VobSubOcr.ImageCompareAddition> additions, VobSubOcr vobSubForm)
|
||||
internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showShrink)
|
||||
{
|
||||
listBoxLinesForeground.Items.Clear();
|
||||
listBoxlinesBackground.Items.Clear();
|
||||
@ -85,8 +82,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ExpandSelection = false;
|
||||
|
||||
textBoxCharacters.Text = string.Empty;
|
||||
_vobSubForm = vobSubForm;
|
||||
_additions = additions;
|
||||
_nocrChar = new NOcrChar();
|
||||
_nocrChar.MarginTop = character.Y - character.ParentY;
|
||||
_imageWidth = character.NikseBitmap.Width;
|
||||
@ -162,7 +157,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
foreach (NOcrPoint op in _nocrChar.LinesBackground)
|
||||
{
|
||||
foreach (Point point in op.GetPoints(nbmp.Width, nbmp.Height))
|
||||
foreach (Point point in op.GetPoints())
|
||||
{
|
||||
if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
return segment;
|
||||
}
|
||||
|
||||
private static SupSegment ParseSegmentHeaderFromMatroska(byte[] buffer, StringBuilder log)
|
||||
private static SupSegment ParseSegmentHeaderFromMatroska(byte[] buffer)
|
||||
{
|
||||
var segment = new SupSegment();
|
||||
segment.Type = buffer[0];
|
||||
@ -392,7 +392,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// <param name="pic">SubPicture object containing info about the current caption</param>
|
||||
/// <param name="msg">reference to message string</param>
|
||||
/// <param name="buffer">Raw data buffer, starting right after segment</param>
|
||||
private static PcsObject ParsePcs(byte[] buffer, SupSegment segment, int offset)
|
||||
private static PcsObject ParsePcs(byte[] buffer, int offset)
|
||||
{
|
||||
var pcs = new PcsObject();
|
||||
// composition_object:
|
||||
@ -432,7 +432,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
pcs.PcsObjects = new List<PcsObject>();
|
||||
for (int compObjIndex = 0; compObjIndex < compositionObjectCount; compObjIndex++)
|
||||
{
|
||||
PcsObject pcsObj = ParsePcs(buffer, segment, offset);
|
||||
PcsObject pcsObj = ParsePcs(buffer, offset);
|
||||
pcs.PcsObjects.Add(pcsObj);
|
||||
sb.AppendLine();
|
||||
sb.AppendFormat("ObjId: {0}, WinId: {1}, Forced: {2}, X: {3}, Y: {4}",
|
||||
@ -575,7 +575,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
// Read segment header
|
||||
ms.Read(headerBuffer, 0, headerBuffer.Length);
|
||||
if (fromMatroskaFile)
|
||||
segment = ParseSegmentHeaderFromMatroska(headerBuffer, log);
|
||||
segment = ParseSegmentHeaderFromMatroska(headerBuffer);
|
||||
else
|
||||
segment = ParseSegmentHeader(headerBuffer, log);
|
||||
position += headerBuffer.Length;
|
||||
|
@ -105,24 +105,6 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// </summary>
|
||||
public List<List<PaletteInfo>> Palettes;
|
||||
|
||||
internal ImageObject ObjectIdImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ImageObjects == null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Invalid Blu-ray SupPicture - ImageObjects is null - BluRaySupPictures.cs: internal ImageObject ObjectIdImage");
|
||||
return null;
|
||||
}
|
||||
if (ObjectId < ImageObjects.Count)
|
||||
{
|
||||
return ImageObjects[ObjectId];
|
||||
}
|
||||
System.Diagnostics.Debug.WriteLine("Invalid Blu-ray SupPicture index - BluRaySupPictures.cs: internal ImageObject ObjectIdImage");
|
||||
return ImageObjects[ImageObjects.Count - 1];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create RLE buffer from bitmap
|
||||
/// </summary>
|
||||
|
@ -85,6 +85,6 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
|
||||
public static int CropOfsY { get; set; }
|
||||
|
||||
public static double fpsTrg = FpsPal;
|
||||
public const double fpsTrg = FpsPal;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// <summary>
|
||||
/// Convert a long integer to a C-style hex string with leading zeroes
|
||||
/// </summary>
|
||||
public static string ToHex(int number, int index, int digits)
|
||||
public static string ToHex(int number, int digits)
|
||||
{
|
||||
string s = string.Format("{0:X}", number);
|
||||
if (s.Length < digits)
|
||||
|
@ -24,10 +24,6 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
return _successCount == 1;
|
||||
}
|
||||
private set
|
||||
{
|
||||
Done = value;
|
||||
}
|
||||
}
|
||||
public string LatestVersionNumber { get; set; }
|
||||
public string LatestChangeLog { get; set; }
|
||||
|
@ -66,7 +66,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
return newText;
|
||||
}
|
||||
|
||||
public string RemoveColon(string text, string prevText)
|
||||
public string RemoveColon(string text)
|
||||
{
|
||||
if (!Settings.RemoveTextBeforeColon)
|
||||
return text;
|
||||
@ -325,7 +325,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
return newText;
|
||||
}
|
||||
|
||||
public string RemoveTextFromHearImpaired(string text, string prevText)
|
||||
public string RemoveTextFromHearImpaired(string text)
|
||||
{
|
||||
if (Settings.RemoveWhereContains && Settings.RemoveIfTextContains.Length > 0 && text.Contains(Settings.RemoveIfTextContains))
|
||||
{
|
||||
@ -333,7 +333,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
}
|
||||
|
||||
string oldText = text;
|
||||
text = RemoveColon(text, prevText);
|
||||
text = RemoveColon(text);
|
||||
string pre = " >-\"'‘`´♪¿¡.…—";
|
||||
string post = " -\"'`´♪.!?:…—";
|
||||
if (Settings.RemoveTextBetweenCustomTags)
|
||||
@ -398,7 +398,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
text = st.Pre + sb.ToString().Trim() + st.Post;
|
||||
text = text.Replace("<i></i>", string.Empty).Trim();
|
||||
text = RemoveColon(text, prevText);
|
||||
text = RemoveColon(text);
|
||||
text = RemoveLineIfAllUppercase(text);
|
||||
text = RemoveHearImpairedtagsInsideLine(text);
|
||||
if (Settings.RemoveInterjections)
|
||||
|
@ -176,9 +176,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
[DllImport("libvlc")]
|
||||
internal static extern IntPtr libvlc_new(int argc, [MarshalAs(UnmanagedType.LPArray)] string[] argv);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern IntPtr libvlc_get_version();
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern void libvlc_release(IntPtr libVlc);
|
||||
|
||||
@ -193,10 +190,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
internal static extern void libvlc_media_release(IntPtr media);
|
||||
|
||||
|
||||
// LibVLC Video Controls - http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__video.html#g8f55326b8b51aecb59d8b8a446c3f118
|
||||
[DllImport("libvlc")]
|
||||
internal static extern void libvlc_video_get_size(IntPtr mediaPlayer, UInt32 number, out UInt32 x, out UInt32 y);
|
||||
|
||||
// LibVLC Audio Controls - http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__audio.html
|
||||
[DllImport("libvlc")]
|
||||
internal static extern int libvlc_audio_get_track_count(IntPtr mediaPlayer);
|
||||
|
||||
@ -227,18 +221,12 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
[DllImport("libvlc")]
|
||||
internal static extern void libvlc_media_player_set_hwnd(IntPtr mediaPlayer, IntPtr windowsHandle);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern int libvlc_media_player_is_playing(IntPtr mediaPlayer);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern Int64 libvlc_media_player_get_time(IntPtr mediaPlayer);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern void libvlc_media_player_set_time(IntPtr mediaPlayer, Int64 position);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern float libvlc_media_player_get_fps(IntPtr mediaPlayer);
|
||||
|
||||
[DllImport("libvlc")]
|
||||
internal static extern byte libvlc_media_player_get_state(IntPtr mediaPlayer);
|
||||
|
||||
|
@ -217,7 +217,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
||||
AddToWsUserLog(CurrentUser, index, "UPD", true);
|
||||
}
|
||||
|
||||
public void CheckForAndSubmitUpdates(IEnumerable<SeNetworkService.SeUpdate> updates)
|
||||
public void CheckForAndSubmitUpdates()
|
||||
{
|
||||
// check for changes in text/time codes (not insert/delete)
|
||||
if (LastSubtitle != null)
|
||||
|
@ -376,7 +376,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
for (int x = 0; x < Width; x++)
|
||||
{
|
||||
int color = GetDvdColor(x, y, backgroundBuffer, patternBuffer, emphasis1Buffer, emphasis2Buffer);
|
||||
int color = GetDvdColor(patternBuffer, emphasis1Buffer, emphasis2Buffer);
|
||||
|
||||
if (lastColor == -1)
|
||||
{
|
||||
@ -525,7 +525,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
indexHalfNibble = !indexHalfNibble;
|
||||
}
|
||||
|
||||
private int GetDvdColor(int x, int y, byte[] background, byte[] pattern, byte[] emphasis1, byte[] emphasis2)
|
||||
private int GetDvdColor(byte[] pattern, byte[] emphasis1, byte[] emphasis2)
|
||||
{
|
||||
_pixelAddress += 4;
|
||||
int a = _bitmapData[_pixelAddress + 3];
|
||||
@ -1033,7 +1033,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
internal void MakeTwoColor(int minAlpha, int minRgb)
|
||||
internal void MakeTwoColor(int minRgb)
|
||||
{
|
||||
byte[] buffer = new byte[4];
|
||||
buffer[0] = 0; // B
|
||||
|
@ -190,7 +190,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (size == bmp.Height)
|
||||
{
|
||||
if (size > 100)
|
||||
return SplitVerticalTransparentOrBlack(bmp, 8);
|
||||
return SplitVerticalTransparentOrBlack(bmp);
|
||||
else
|
||||
parts.Add(new ImageSplitterItem(0, startY, bmp));
|
||||
}
|
||||
@ -203,7 +203,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return parts;
|
||||
}
|
||||
|
||||
public static List<ImageSplitterItem> SplitVerticalTransparentOrBlack(NikseBitmap bmp, int lineMinHeight)
|
||||
public static List<ImageSplitterItem> SplitVerticalTransparentOrBlack(NikseBitmap bmp)
|
||||
{
|
||||
int startY = 0;
|
||||
int size = 0;
|
||||
@ -302,7 +302,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (size == bmp.Height)
|
||||
{
|
||||
if (size > 100)
|
||||
return SplitVerticalTransparentOrBlack(bmp, minLineHeight);
|
||||
return SplitVerticalTransparentOrBlack(bmp);
|
||||
else
|
||||
parts.Add(new ImageSplitterItem(0, startY, bmp));
|
||||
}
|
||||
@ -834,24 +834,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return list;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, NikseBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
int maxDiff = bmp1.Width * bmp1.Height / 5;
|
||||
|
||||
for (int x = 1; x < bmp1.Width; x++)
|
||||
{
|
||||
for (int y = 1; y < bmp1.Height; y++)
|
||||
{
|
||||
if (!IsColorClose(bmp1.GetPixel(x, y), bmp2.GetPixel(x, y), 20))
|
||||
different++;
|
||||
}
|
||||
if (different > maxDiff)
|
||||
return different + 10;
|
||||
}
|
||||
return different;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(ManagedBitmap bmp1, NikseBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
|
@ -66,7 +66,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
OcrCharactersExpanded = listExpanded;
|
||||
}
|
||||
|
||||
public static int FindExactMatch(NOcrChar ocrChar)
|
||||
public static int FindExactMatch()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
return PointPixelsToPercent(End, width, height);
|
||||
}
|
||||
|
||||
public List<Point> GetPoints(int width, int height)
|
||||
public List<Point> GetPoints()
|
||||
{
|
||||
return GetPoints(Start, End);
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
if (word.Length == 1 && sb.Length > 1 && sb.ToString().EndsWith("-"))
|
||||
doFixWord = false;
|
||||
if (doFixWord)
|
||||
fixedWord = FixCommonWordErrors(word.ToString(), lastWord);
|
||||
fixedWord = FixCommonWordErrors(word.ToString());
|
||||
else
|
||||
fixedWord = word.ToString();
|
||||
}
|
||||
@ -453,7 +453,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
if (word.Length == 1 && sb.Length > 1 && sb.ToString().EndsWith("-"))
|
||||
doFixWord = false;
|
||||
if (doFixWord)
|
||||
fixedWord = FixCommonWordErrors(word.ToString(), lastWord);
|
||||
fixedWord = FixCommonWordErrors(word.ToString());
|
||||
else
|
||||
fixedWord = word.ToString();
|
||||
|
||||
@ -594,7 +594,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
if (lastWord != null && lastWord.ToUpper().Contains("COLOR="))
|
||||
fixedWord = word.ToString();
|
||||
else
|
||||
fixedWord = FixCommonWordErrorsQuick(word.ToString(), lastWord);
|
||||
fixedWord = FixCommonWordErrorsQuick(word.ToString());
|
||||
sb.Append(fixedWord);
|
||||
lastWord = fixedWord;
|
||||
word = new StringBuilder();
|
||||
@ -608,7 +608,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
}
|
||||
if (word.Length > 0) // last word
|
||||
{
|
||||
string fixedWord = FixCommonWordErrorsQuick(word.ToString(), lastWord);
|
||||
string fixedWord = FixCommonWordErrorsQuick(word.ToString());
|
||||
sb.Append(fixedWord);
|
||||
}
|
||||
return sb.ToString();
|
||||
@ -637,7 +637,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
return text;
|
||||
}
|
||||
|
||||
private string FixCommonWordErrors(string word, string lastWord)
|
||||
private string FixCommonWordErrors(string word)
|
||||
{
|
||||
if (Configuration.Settings.Tools.OcrFixUseHardcodedRules)
|
||||
{
|
||||
@ -820,7 +820,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
return pre + word + post;
|
||||
}
|
||||
|
||||
private string FixCommonWordErrorsQuick(string word, string lastWord)
|
||||
private string FixCommonWordErrorsQuick(string word)
|
||||
{
|
||||
//always replace list
|
||||
foreach (string letter in _partialWordReplaceListAlways.Keys)
|
||||
@ -1488,7 +1488,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
|
||||
if (promptForFixingErrors && line.Length == 1 && !IsWordKnownOrNumber(line, line))
|
||||
{
|
||||
SpellcheckOcrTextResult res = SpellcheckOcrText(line, bitmap, new string[1] { line}, 0, line, localIgnoreWords);
|
||||
SpellcheckOcrTextResult res = SpellcheckOcrText(line, bitmap, line, localIgnoreWords);
|
||||
if (res.FixedWholeLine || res.Fixed)
|
||||
return res.Line;
|
||||
wordsNotFound++;
|
||||
@ -1686,7 +1686,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
if (word.EndsWith("</i>"))
|
||||
word = word.Remove(word.Length-4, 4);
|
||||
|
||||
SpellcheckOcrTextResult res = SpellcheckOcrText(line, bitmap, words, i, word, suggestions);
|
||||
SpellcheckOcrTextResult res = SpellcheckOcrText(line, bitmap, word, suggestions);
|
||||
|
||||
if (res.FixedWholeLine)
|
||||
{
|
||||
@ -1741,10 +1741,10 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
/// Spellcheck for OCR
|
||||
/// </summary>
|
||||
/// <returns>True, if word is fixed</returns>
|
||||
private SpellcheckOcrTextResult SpellcheckOcrText(string line, Bitmap bitmap, string[] words, int i, string word, List<string> suggestions)
|
||||
private SpellcheckOcrTextResult SpellcheckOcrText(string line, Bitmap bitmap, string word, List<string> suggestions)
|
||||
{
|
||||
var result = new SpellcheckOcrTextResult { Fixed = false, FixedWholeLine = false, Line = null, Word = null };
|
||||
_spellCheck.Initialize(word, suggestions, line, words, i, bitmap);
|
||||
_spellCheck.Initialize(word, suggestions, line, bitmap);
|
||||
_spellCheck.ShowDialog(_parentForm);
|
||||
switch (_spellCheck.ActionResult)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public static void Save(string fileName, Subtitle subtitle)
|
||||
public static void Save(string fileName)
|
||||
{
|
||||
var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
|
||||
fs.Close();
|
||||
|
@ -34,7 +34,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
|
||||
rtBox.Text = ToF4Text(subtitle, title);
|
||||
rtBox.Text = ToF4Text(subtitle);
|
||||
string rtf = rtBox.Rtf;
|
||||
rtBox.Dispose();
|
||||
return rtf;
|
||||
|
@ -38,7 +38,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
return subtitle.Paragraphs.Count > _errorCount;
|
||||
}
|
||||
|
||||
public static string ToF4Text(Subtitle subtitle, string title)
|
||||
public static string ToF4Text(Subtitle subtitle)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
double lastEndTimeMilliseconds = -1;
|
||||
@ -55,7 +55,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
return ToF4Text(subtitle, title);
|
||||
return ToF4Text(subtitle);
|
||||
}
|
||||
|
||||
private static string EncodeTimeCode(TimeCode time)
|
||||
|
@ -43,7 +43,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
</style>
|
||||
</transcript>".Replace("'", "\"");
|
||||
xml.LoadXml(template);
|
||||
xml.DocumentElement.SelectSingleNode("content").Attributes["content"].Value = ToF4Text(subtitle, title);
|
||||
xml.DocumentElement.SelectSingleNode("content").Attributes["content"].Value = ToF4Text(subtitle);
|
||||
|
||||
return ToUtf8XmlString(xml);
|
||||
}
|
||||
|
@ -32,71 +32,6 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
return subtitle.Paragraphs.Count > _errorCount;
|
||||
}
|
||||
|
||||
private static int GetLastIndexOfSpace(string s, int endCount)
|
||||
{
|
||||
int end = endCount;
|
||||
if (end >= s.Length)
|
||||
end = s.Length - 1;
|
||||
|
||||
int i = end;
|
||||
while (i > 0)
|
||||
{
|
||||
if (s[i] == ' ')
|
||||
return i;
|
||||
i--;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static string AutoBreakLineMax4Lines(string text, int maxLength)
|
||||
{
|
||||
string s = text.Replace(Environment.NewLine, " ");
|
||||
s = s.Replace(" ", " ");
|
||||
var sb = new StringBuilder();
|
||||
int i = GetLastIndexOfSpace(s, maxLength);
|
||||
if (i > 0)
|
||||
{
|
||||
sb.AppendLine(s.Substring(0, i));
|
||||
s = s.Remove(0, i).Trim();
|
||||
if (s.Length <= maxLength)
|
||||
i = s.Length;
|
||||
else
|
||||
i = GetLastIndexOfSpace(s, maxLength);
|
||||
if (i > 0)
|
||||
{
|
||||
sb.AppendLine(s.Substring(0, i));
|
||||
s = s.Remove(0, i).Trim();
|
||||
if (s.Length <= maxLength)
|
||||
i = s.Length;
|
||||
else
|
||||
i = GetLastIndexOfSpace(s, maxLength);
|
||||
if (i > 0)
|
||||
{
|
||||
sb.AppendLine(s.Substring(0, i));
|
||||
s = s.Remove(0, i).Trim();
|
||||
if (s.Length <= maxLength)
|
||||
i = s.Length;
|
||||
else
|
||||
i = GetLastIndexOfSpace(s, maxLength);
|
||||
if (i > 0)
|
||||
{
|
||||
sb.AppendLine(s.Substring(0, i));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
@ -186,7 +121,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
if (match.Success)
|
||||
{
|
||||
TimeCode startTime = ParseTimeCode(s.Substring(0, match.Length - 1));
|
||||
string text = GetSccText(s.Substring(match.Index), ref _errorCount);
|
||||
string text = GetSccText(s.Substring(match.Index));
|
||||
|
||||
if (text == "942c 942c" || text == "942c")
|
||||
{
|
||||
@ -216,7 +151,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
subtitle.Renumber(1);
|
||||
}
|
||||
|
||||
public static string GetSccText(string s, ref int errorCount)
|
||||
public static string GetSccText(string s)
|
||||
{
|
||||
string[] parts = s.Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
var sb = new StringBuilder();
|
||||
|
@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Save(string fileName, Subtitle subtitle)
|
||||
public void Save(string fileName)
|
||||
{
|
||||
var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
|
||||
fs.Close();
|
||||
|
@ -580,7 +580,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
if (allOk)
|
||||
return text;
|
||||
|
||||
text = Utilities.AutoBreakLine(text, 1, 32, 4, language);
|
||||
text = Utilities.AutoBreakLine(text, 1, 4, language);
|
||||
lines = text.Trim().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
allOk = true;
|
||||
foreach (string line in lines)
|
||||
|
@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int number = 0;
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
WriteParagraph(fs, p, number);
|
||||
WriteParagraph(p);
|
||||
number++;
|
||||
}
|
||||
|
||||
@ -51,10 +51,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
private static void WriteParagraph(FileStream fs, Paragraph p, int number)
|
||||
private static void WriteParagraph(Paragraph p)
|
||||
{
|
||||
WriteTimeCode(fs, p.StartTime);
|
||||
WriteTimeCode(fs, p.EndTime);
|
||||
WriteTimeCode();
|
||||
WriteTimeCode();
|
||||
|
||||
string text = p.Text;
|
||||
if (Utilities.CountTagInText(text, Environment.NewLine)> 1)
|
||||
@ -71,7 +71,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
}
|
||||
|
||||
private static void WriteTimeCode(FileStream fs, TimeCode timeCode)
|
||||
private static void WriteTimeCode()
|
||||
{
|
||||
// write 8 bytes time code
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
subtitle.Renumber(1);
|
||||
}
|
||||
|
||||
private string EncodeTimeCode(TimeCode time)
|
||||
private static string EncodeTimeCode(TimeCode time)
|
||||
{
|
||||
string s = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, MillisecondsToFramesMaxFrameRate(time.Milliseconds));
|
||||
return AddSpaces(s);
|
||||
|
@ -10,7 +10,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
||||
public int MagazineAndPacketAddress { get; set; }
|
||||
public byte[] DataBlock { get; set; }
|
||||
|
||||
public EbuPesDataFieldText(byte[] buffer, int index, int length)
|
||||
public EbuPesDataFieldText(byte[] buffer, int index)
|
||||
{
|
||||
FieldParity = (buffer[index] & Helper.B00100000) > 0;
|
||||
LineOffset = buffer[index] & Helper.B00011111;
|
||||
|
@ -44,7 +44,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static VideoInfo GetVideoInfo(string fileName, EventHandler event1)
|
||||
public static VideoInfo GetVideoInfo(string fileName)
|
||||
{
|
||||
VideoInfo info = TryReadVideoInfoViaAviHeader(fileName);
|
||||
if (info.Success)
|
||||
@ -351,7 +351,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
public static string AutoBreakLine(string text, string language)
|
||||
{
|
||||
return AutoBreakLine(text, 5, Configuration.Settings.General.SubtitleLineMaximumLength, Configuration.Settings.Tools.MergeLinesShorterThan, language);
|
||||
return AutoBreakLine(text, 5, Configuration.Settings.Tools.MergeLinesShorterThan, language);
|
||||
}
|
||||
|
||||
public static string AutoBreakLine(string text)
|
||||
@ -429,7 +429,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (text == null || text.Length < 3)
|
||||
return text;
|
||||
|
||||
string s = AutoBreakLine(text, 0, maximumLineLength, 0, language);
|
||||
string s = AutoBreakLine(text, 0, 0, language);
|
||||
|
||||
var arr = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
if ((arr.Length < 2 && arr[0].Length <= maximumLineLength) || (arr[0].Length <= maximumLineLength && arr[1].Length <= maximumLineLength))
|
||||
@ -540,7 +540,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
|
||||
|
||||
public static string AutoBreakLine(string text, int mininumLength, int maximumLength, int mergeLinesShorterThan, string language)
|
||||
public static string AutoBreakLine(string text, int maximumLength, int mergeLinesShorterThan, string language)
|
||||
{
|
||||
if (text == null || text.Length < 3)
|
||||
return text;
|
||||
|
@ -259,12 +259,12 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (AviRiffData.ckidMainAVIHeader == FourCC)
|
||||
{
|
||||
// Main AVI header
|
||||
DecodeAVIHeader(rp, unpaddedLength, paddedLength);
|
||||
DecodeAVIHeader(rp, paddedLength);
|
||||
}
|
||||
else if (AviRiffData.ckidAVIStreamHeader == FourCC)
|
||||
{
|
||||
// Stream header
|
||||
DecodeAVIStream(rp, unpaddedLength, paddedLength);
|
||||
DecodeAVIStream(rp, paddedLength);
|
||||
}
|
||||
else if (AviRiffData.ckidAVIISFT == FourCC)
|
||||
{
|
||||
@ -328,7 +328,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DecodeAVIHeader(RiffParser rp, int unpaddedLength, int length)
|
||||
private unsafe void DecodeAVIHeader(RiffParser rp, int length)
|
||||
{
|
||||
//if (length < sizeof(AVIMAINHEADER))
|
||||
//{
|
||||
@ -355,7 +355,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DecodeAVIStream(RiffParser rp, int unpaddedLength, int length)
|
||||
private unsafe void DecodeAVIStream(RiffParser rp, int length)
|
||||
{
|
||||
byte[] ba = new byte[length];
|
||||
|
||||
|
@ -14,11 +14,6 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
||||
private System.Windows.Forms.Control _ownerControl;
|
||||
private System.Windows.Forms.Form _parentForm;
|
||||
|
||||
private static byte[] StringToCharPointer(string s)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(s + "\0");
|
||||
}
|
||||
|
||||
public override string PlayerName
|
||||
{
|
||||
get { return "VLC Lib Mono"; }
|
||||
|
@ -124,7 +124,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
internal void WriteHeader(Stream fromStream, Stream toStream, int sampleRate, int numberOfChannels, int bitsPerSample, int dataSize)
|
||||
internal void WriteHeader(Stream toStream, int sampleRate, int numberOfChannels, int bitsPerSample, int dataSize)
|
||||
{
|
||||
const int fmtChunckSize = 16;
|
||||
const int headerSize = 44;
|
||||
@ -295,7 +295,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
public void WritePeakSamples(Stream stream)
|
||||
{
|
||||
Header.WriteHeader(_stream, stream, PeaksPerSecond, 1, 16, PeakSamples.Count * 2);
|
||||
Header.WriteHeader(stream, PeaksPerSecond, 1, 16, PeakSamples.Count * 2);
|
||||
WritePeakData(stream);
|
||||
stream.Flush();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace Test
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
string text = "Man over P.A.:\r\nGive back our homes.";
|
||||
string expected = "Give back our homes.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
string actual = target.RemoveColon(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ namespace Test
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
string text = "GIOVANNI: <i>Number 9: I never look for a scapegoat.</i>";
|
||||
string expected = "<i>I never look for a scapegoat.</i>";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
string actual = target.RemoveColon(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ namespace Test
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||
string text = "GIOVANNI: <i>Number 9: I never look for a scapegoat.</i>";
|
||||
string expected = "<i>Number 9: I never look for a scapegoat.</i>";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
string actual = target.RemoveColon(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Aw, save it. Storm?\r\n- [Storm]\r\nWe're outta here.";
|
||||
string expected = "- Aw, save it. Storm?\r\n- We're outta here.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "[Chuckles,\r\nCoughing]\r\nBut we lived through it.";
|
||||
string expected = "But we lived through it.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||
string expected = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ namespace Test
|
||||
string text = "<i>NARRATOR:" + Environment.NewLine +
|
||||
"Previously on NCIS</i>";
|
||||
string expected = "<i>Previously on NCIS</i>";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ namespace Test
|
||||
string text = "<b>NARRATOR:" + Environment.NewLine +
|
||||
"Previously on NCIS</b>";
|
||||
string expected = "<b>Previously on NCIS</b>";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ namespace Test
|
||||
string text = "- JOHN: Hey." + Environment.NewLine +
|
||||
"- ...hey.";
|
||||
string expected = "- Hey."+ Environment.NewLine +"- ...hey.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "[MAN]Where?![MAN]";
|
||||
string expected = "Where?!";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "HECTOR: Hi." + Environment.NewLine + "-Oh, hey, Hector.";
|
||||
string expected = "- Hi." + Environment.NewLine + "- Oh, hey, Hector.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<b>HECTOR: Hi.</b>";
|
||||
string expected = "<b>Hi.</b>";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
string actual = target.RemoveTextFromHearImpaired(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -564,7 +564,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = true;
|
||||
string text = "HECTOR: Hi.";
|
||||
string expected = "HECTOR: Hi.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
string actual = target.RemoveColon(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
@ -652,7 +652,7 @@ namespace Test
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- even if it was one week." + Environment.NewLine + "CANNING: Objection.";
|
||||
string expected = "- even if it was one week." + Environment.NewLine + "- Objection.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
string actual = target.RemoveColon(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Test
|
||||
public void AutoBreakLine1()
|
||||
{
|
||||
const int maxLength = 43;
|
||||
var s = Utilities.AutoBreakLine("You have a private health insurance and life insurance." + Environment.NewLine + "A digital clone included.", 5, maxLength, 33, string.Empty);
|
||||
var s = Utilities.AutoBreakLine("You have a private health insurance and life insurance." + Environment.NewLine + "A digital clone included.", 5, 33, string.Empty);
|
||||
var arr = s.Replace(Environment.NewLine, "\n").Split('\n');
|
||||
Assert.AreEqual(2, arr.Length);
|
||||
Assert.IsFalse(arr[0].Length > maxLength);
|
||||
@ -21,8 +21,7 @@ namespace Test
|
||||
[TestMethod]
|
||||
public void AutoBreakLine2()
|
||||
{
|
||||
const int maxLength = 43;
|
||||
var s = Utilities.AutoBreakLine("We're gonna lose him." + Environment.NewLine + "He's left him four signals in the last week.", 5, maxLength, 33, string.Empty);
|
||||
var s = Utilities.AutoBreakLine("We're gonna lose him." + Environment.NewLine + "He's left him four signals in the last week.", 5, 33, string.Empty);
|
||||
Assert.IsFalse(s == "We're gonna lose him." + Environment.NewLine + "He's left him four signals in the last week.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user