Work on format NetflixImsc11Japanese - thx FlippFuzz :)

Work on #7524
This commit is contained in:
niksedk 2023-10-20 06:57:29 +02:00
parent fe99ee952f
commit 8ef07e56c2
3 changed files with 28 additions and 6 deletions

View File

@ -488,7 +488,7 @@ namespace Nikse.SubtitleEdit.Controls
var uiFormatType = uiFormat.GetType();
if (uiFormatType == typeof(NetflixImsc11Japanese))
{
text = NetflixImsc11JapaneseToAss.Convert(subtitle, 1280, 720);
text = NetflixImsc11JapaneseToAss.Convert(subtitle, VideoWidth, VideoHeight);
}
else if (uiFormatType == typeof(WebVTT) || uiFormatType == typeof(WebVTTFileWithLineNumber))
{

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Forms
public long MillisecondsEncoding { get; private set; }
private PreviewVideo _previewVideo;
public GenerateVideoWithHardSubs(Subtitle assaSubtitle, string inputVideoFileName, VideoInfo videoInfo, int? fontSize, bool setStartEndCut)
public GenerateVideoWithHardSubs(Subtitle assaSubtitle, SubtitleFormat format, string inputVideoFileName, VideoInfo videoInfo, int? fontSize, bool setStartEndCut)
{
UiUtil.PreInitialize(this);
InitializeComponent();
@ -49,6 +49,14 @@ namespace Nikse.SubtitleEdit.Forms
_assaSubtitle = new Subtitle(assaSubtitle);
_inputVideoFileName = inputVideoFileName;
if (format.GetType() == typeof(NetflixImsc11Japanese))
{
_assaSubtitle = new Subtitle();
var raw = NetflixImsc11JapaneseToAss.Convert(assaSubtitle, _videoInfo.Width, _videoInfo.Height);
new AdvancedSubStationAlpha().LoadSubtitle(_assaSubtitle, raw.SplitToLines(), null);
fontSize = null;
}
Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Title;
buttonGenerate.Text = LanguageSettings.Current.Watermark.Generate;
labelPleaseWait.Text = LanguageSettings.Current.General.PleaseWait;

View File

@ -2153,12 +2153,26 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (_oldSubtitleFormat?.GetType() != format.GetType())
if (formatType == typeof(AdvancedSubStationAlpha) && _oldSubtitleFormat.GetType() == typeof(NetflixImsc11Japanese))
{
var raw = NetflixImsc11JapaneseToAss.Convert(_subtitle, _videoInfo?.Width ?? 1280, _videoInfo?.Height ?? 720);
var s = new Subtitle();
new AdvancedSubStationAlpha().LoadSubtitle(s, raw.SplitToLines(), null);
_subtitle.Paragraphs.Clear();
_subtitle.Paragraphs.AddRange(s.Paragraphs);
_subtitle.Header = s.Header;
_subtitle.Footer = s.Footer;
SaveSubtitleListviewIndices();
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
RestoreSubtitleListviewIndices();
}
else if (_oldSubtitleFormat?.GetType() != format.GetType())
{
_oldSubtitleFormat.RemoveNativeFormatting(_subtitle, format);
}
if (formatType == typeof(AdvancedSubStationAlpha))
if (formatType == typeof(AdvancedSubStationAlpha) && _oldSubtitleFormat.GetType() != typeof(NetflixImsc11Japanese))
{
if (_oldSubtitleFormat?.GetType() == typeof(WebVTT) ||
_oldSubtitleFormat?.GetType() == typeof(WebVTTFileWithLineNumber))
@ -8929,7 +8943,7 @@ namespace Nikse.SubtitleEdit.Forms
}
var fontSize = PrepareBurn(sub);
using (var form = new GenerateVideoWithHardSubs(sub, _videoFileName, _videoInfo, fontSize, true))
using (var form = new GenerateVideoWithHardSubs(sub, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo, fontSize, true))
{
var result = form.ShowDialog(this);
if (result != DialogResult.OK)
@ -35008,7 +35022,7 @@ namespace Nikse.SubtitleEdit.Forms
var sub = new Subtitle(_subtitle, false);
var fontSize = PrepareBurn(sub);
using (var form = new GenerateVideoWithHardSubs(sub, _videoFileName, _videoInfo, fontSize, false))
using (var form = new GenerateVideoWithHardSubs(sub, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo, fontSize, false))
{
var result = form.ShowDialog(this);
if (result != DialogResult.OK)