mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
parent
0913c8d72a
commit
bee041bf27
@ -36,6 +36,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Groq/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Immersive/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Imsc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lappish/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Libre/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean>
|
||||
@ -43,6 +44,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nuendo/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ollama/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Persistable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Programme/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Purfview/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spectrograms/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stbl/@EntryIndexedValue">True</s:Boolean>
|
||||
@ -54,4 +56,5 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Undocked/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unescape/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vanc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vosk/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vosk/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wallon/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -168,7 +168,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
return 30.0; // should be DiskFormatcode STL30.01
|
||||
return 30.0; // should be DiskFormatCode STL30.01
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,34 +282,28 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
CommentFlag = 0;
|
||||
}
|
||||
|
||||
public byte[] GetBytes(EbuGeneralSubtitleInformation header)
|
||||
public byte[] GetBytesExtra(EbuGeneralSubtitleInformation header, MemoryStream extra)
|
||||
{
|
||||
var buffer = new byte[128]; // Text and Timing Information (TTI) block consists of 128 bytes
|
||||
var buffer = SaveHeader(header);
|
||||
var bytes = extra.ToArray();
|
||||
for (var i = 0; i < 112; i++)
|
||||
{
|
||||
if (i < bytes.Length)
|
||||
{
|
||||
buffer[16 + i] = bytes[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[16 + i] = 0x8f;
|
||||
}
|
||||
}
|
||||
|
||||
buffer[0] = SubtitleGroupNumber;
|
||||
var temp = BitConverter.GetBytes(SubtitleNumber);
|
||||
buffer[1] = temp[0];
|
||||
buffer[2] = temp[1];
|
||||
buffer[3] = ExtensionBlockNumber;
|
||||
buffer[4] = CumulativeStatus;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
var frames = GetFrameFromMilliseconds(TimeCodeInMilliseconds, header.FrameRate, out var extraSeconds);
|
||||
var tc = new TimeCode(TimeCodeInHours, TimeCodeInMinutes, TimeCodeInSeconds + extraSeconds, 0);
|
||||
buffer[5] = (byte)tc.Hours;
|
||||
buffer[6] = (byte)tc.Minutes;
|
||||
buffer[7] = (byte)tc.Seconds;
|
||||
buffer[8] = frames;
|
||||
|
||||
frames = GetFrameFromMilliseconds(TimeCodeOutMilliseconds, header.FrameRate, out extraSeconds);
|
||||
tc = new TimeCode(TimeCodeOutHours, TimeCodeOutMinutes, TimeCodeOutSeconds + extraSeconds, 0);
|
||||
buffer[9] = (byte)tc.Hours;
|
||||
buffer[10] = (byte)tc.Minutes;
|
||||
buffer[11] = (byte)tc.Seconds;
|
||||
buffer[12] = frames;
|
||||
|
||||
buffer[13] = VerticalPosition;
|
||||
buffer[14] = JustificationCode;
|
||||
buffer[15] = CommentFlag;
|
||||
public byte[] GetBytes(EbuGeneralSubtitleInformation header, MemoryStream extra)
|
||||
{
|
||||
var buffer = SaveHeader(header);
|
||||
|
||||
var encoding = GetEncoding(header.CodePageNumber);
|
||||
if (header.LanguageCode == LanguageCodeChinese)
|
||||
@ -340,6 +334,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
}
|
||||
|
||||
if (byteList.Count > 112)
|
||||
{
|
||||
extra.Write(byteList.ToArray(), 112, byteList.Count - 112);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -572,6 +571,43 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
buffer[16 + i] = 0x8f;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes.Length > 112)
|
||||
{
|
||||
extra.Write(bytes, 112, bytes.Length - 112);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private byte[] SaveHeader(EbuGeneralSubtitleInformation header)
|
||||
{
|
||||
var buffer = new byte[128]; // Text and Timing Information (TTI) block consists of 128 bytes
|
||||
|
||||
buffer[0] = SubtitleGroupNumber;
|
||||
var temp = BitConverter.GetBytes(SubtitleNumber);
|
||||
buffer[1] = temp[0];
|
||||
buffer[2] = temp[1];
|
||||
buffer[3] = ExtensionBlockNumber;
|
||||
buffer[4] = CumulativeStatus;
|
||||
|
||||
var frames = GetFrameFromMilliseconds(TimeCodeInMilliseconds, header.FrameRate, out var extraSeconds);
|
||||
var tc = new TimeCode(TimeCodeInHours, TimeCodeInMinutes, TimeCodeInSeconds + extraSeconds, 0);
|
||||
buffer[5] = (byte)tc.Hours;
|
||||
buffer[6] = (byte)tc.Minutes;
|
||||
buffer[7] = (byte)tc.Seconds;
|
||||
buffer[8] = frames;
|
||||
|
||||
frames = GetFrameFromMilliseconds(TimeCodeOutMilliseconds, header.FrameRate, out extraSeconds);
|
||||
tc = new TimeCode(TimeCodeOutHours, TimeCodeOutMinutes, TimeCodeOutSeconds + extraSeconds, 0);
|
||||
buffer[9] = (byte)tc.Hours;
|
||||
buffer[10] = (byte)tc.Minutes;
|
||||
buffer[11] = (byte)tc.Seconds;
|
||||
buffer[12] = frames;
|
||||
|
||||
buffer[13] = VerticalPosition;
|
||||
buffer[14] = JustificationCode;
|
||||
buffer[15] = CommentFlag;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -1532,8 +1568,20 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
tti.TimeCodeOutMilliseconds = p.EndTime.Milliseconds;
|
||||
}
|
||||
|
||||
buffer = tti.GetBytes(header);
|
||||
var extra = new MemoryStream();
|
||||
buffer = tti.GetBytes(header, extra);
|
||||
if (extra.Length > 0)
|
||||
{
|
||||
buffer[3] = 0; // ExtensionBlockNumber
|
||||
stream.Write(buffer, 0, buffer.Length);
|
||||
|
||||
buffer = tti.GetBytesExtra(header, extra);
|
||||
stream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
subtitleNumber++;
|
||||
}
|
||||
return true;
|
||||
@ -1606,8 +1654,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] buffer = FileUtil.ReadAllBytesShared(fileName);
|
||||
EbuGeneralSubtitleInformation header = ReadHeader(buffer);
|
||||
var buffer = FileUtil.ReadAllBytesShared(fileName);
|
||||
var header = ReadHeader(buffer);
|
||||
if (header.DiskFormatCode.StartsWith("STL23", StringComparison.Ordinal) ||
|
||||
header.DiskFormatCode.StartsWith("STL24", StringComparison.Ordinal) ||
|
||||
header.DiskFormatCode.StartsWith("STL25", StringComparison.Ordinal) ||
|
||||
|
@ -2891,14 +2891,14 @@ can edit in same subtitle file (collaboration)",
|
||||
ContinuationStyle = "Continuation style",
|
||||
CpsLineLengthStyle = "Cps/line-length",
|
||||
CpsLineLengthStyleCalcAll = "Count all characters",
|
||||
CpsLineLengthStyleCalcNoSpaceCpsOnly = "Count all except space, cps only",
|
||||
CpsLineLengthStyleCalcNoSpaceCpsOnly = "Count all except space, CPS only",
|
||||
CpsLineLengthStyleCalcNoSpace = "Count all except space",
|
||||
CpsLineLengthStyleCalcCjk = "CJK 1, Latin 0.5",
|
||||
CpsLineLengthStyleCalcCjkNoSpace = "CJK 1, Latin 0.5, space 0",
|
||||
CpsLineLengthStyleCalcIncludeCompositionCharacters = "Include composition characters",
|
||||
CpsLineLengthStyleCalcIncludeCompositionCharactersNotSpace = "Include composition characters, not space",
|
||||
CpsLineLengthStyleCalcNoSpaceOrPunctuation = "No space or punctuation ()[]-:;,.!?",
|
||||
CpsLineLengthStyleCalcNoSpaceOrPunctuationCpsOnly = "No space or punctuation, cps only",
|
||||
CpsLineLengthStyleCalcNoSpaceOrPunctuationCpsOnly = "No space or punctuation, CPS only",
|
||||
ContinuationStyleNone = "None",
|
||||
ContinuationStyleNoneTrailingDots = "None, dots for pauses (trailing only)",
|
||||
ContinuationStyleNoneLeadingTrailingDots = "None, dots for pauses",
|
||||
|
Loading…
Reference in New Issue
Block a user