Added setting for Cheetah caption not to write end time if duration < 5 seconds

This commit is contained in:
niksedk 2014-09-19 16:01:44 +02:00
parent 9f0ced91c3
commit f56998dba2
2 changed files with 21 additions and 4 deletions

View File

@ -264,6 +264,8 @@ namespace Nikse.SubtitleEdit.Logic
public int CurrentCavena890LanguageIdLine1 { get; set; }
public int CurrentCavena890LanguageIdLine2 { get; set; }
public bool CheetahCaptionLessThan5SecondsNoEndTime { get; set; }
public bool SamiDisplayTwoClassesAsTwoSubtitles { get; set; }
public int SamiHtmlEncodeMode { get; set; }
@ -1785,6 +1787,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("FcpFontName");
if (subNode != null)
settings.SubtitleSettings.FcpFontName = subNode.InnerText;
subNode = node.SelectSingleNode("CheetahCaptionLessThan5SecondsNoEndTime");
if (subNode != null)
settings.SubtitleSettings.CheetahCaptionLessThan5SecondsNoEndTime = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("NuendoCharacterListFile");
if (subNode != null)
settings.SubtitleSettings.NuendoCharacterListFile = subNode.InnerText;
@ -2814,6 +2819,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("TimedText10TimeCodeFormat", settings.SubtitleSettings.TimedText10TimeCodeFormat);
textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName);
textWriter.WriteElementString("CheetahCaptionLessThan5SecondsNoEndTime", settings.SubtitleSettings.CheetahCaptionLessThan5SecondsNoEndTime.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("NuendoCharacterListFile", settings.SubtitleSettings.NuendoCharacterListFile);
textWriter.WriteEndElement();

View File

@ -172,10 +172,21 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
long end = fs.Position + length;
fs.WriteByte((byte)(length));
fs.WriteByte(0x62); // ?
WriteTime(fs, p.StartTime);
WriteTime(fs, p.EndTime);
if (Configuration.Settings.SubtitleSettings.CheetahCaptionLessThan5SecondsNoEndTime && p.Duration.TotalMilliseconds < 5000)
{
fs.WriteByte(0x42); // ?
WriteTime(fs, p.StartTime);
fs.WriteByte(2);
fs.WriteByte(1);
fs.WriteByte(0);
fs.WriteByte(0);
}
else
{
fs.WriteByte(0x62); // ?
WriteTime(fs, p.StartTime);
WriteTime(fs, p.EndTime);
}
fs.Write(buffer, 0, buffer.Length); // styles