diff --git a/src/Logic/SubtitleFormats/ScenaristClosedCaptions.cs b/src/Logic/SubtitleFormats/ScenaristClosedCaptions.cs index 70bdbad52..e6043f645 100644 --- a/src/Logic/SubtitleFormats/ScenaristClosedCaptions.cs +++ b/src/Logic/SubtitleFormats/ScenaristClosedCaptions.cs @@ -31,7 +31,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats } //00:01:00:29 9420 9420 94ae 94ae 94d0 94d0 4920 f761 7320 ... semi colon (instead of colon) before frame number is used to indicate drop frame - static readonly Regex RegexTimeCodes = new Regex(@"^\d+:\d\d:\d\d[:;,]\d\d\t", RegexOptions.Compiled); + private const string _timeCodeRegEx = @"^\d+:\d\d:\d\d[:,]\d\d\t"; + protected virtual Regex RegexTimeCodes { get { return new Regex(_timeCodeRegEx); } } + protected bool DropFrame = false; + private static readonly List _letters = new List { @@ -734,6 +737,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats private string ToTimeCode(double totalMilliseconds) { TimeSpan ts = TimeSpan.FromMilliseconds(totalMilliseconds); + if (DropFrame) + return string.Format("{0:00}:{1:00}:{2:00};{3:00}", ts.Hours, ts.Minutes, ts.Seconds, MillisecondsToFramesMaxFrameRate(ts.Milliseconds)); return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", ts.Hours, ts.Minutes, ts.Seconds, MillisecondsToFramesMaxFrameRate(ts.Milliseconds)); } diff --git a/src/Logic/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs b/src/Logic/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs new file mode 100644 index 000000000..a64a0fbb0 --- /dev/null +++ b/src/Logic/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Text; +using System.Text.RegularExpressions; + +namespace Nikse.SubtitleEdit.Logic.SubtitleFormats +{ + + public class ScenaristClosedCaptionsDropFrame : ScenaristClosedCaptions + { + //00:01:00:29 9420 9420 94ae 94ae 94d0 94d0 4920 f761 7320 ... semi colon (instead of colon) before frame number is used to indicate drop frame + private const string _timeCodeRegEx = @"^\d+:\d\d:\d\d[;,]\d\d\t"; + protected override Regex RegexTimeCodes { get { return new Regex(_timeCodeRegEx); } } + + public ScenaristClosedCaptionsDropFrame() + { + DropFrame = true; + } + + public override string Name + { + get { return "Scenarist Closed Captions Drop Frame"; } + } + } +} + + diff --git a/src/Logic/SubtitleFormats/SubtitleFormat.cs b/src/Logic/SubtitleFormats/SubtitleFormat.cs index 3a3882a41..69fdd161b 100644 --- a/src/Logic/SubtitleFormats/SubtitleFormat.cs +++ b/src/Logic/SubtitleFormats/SubtitleFormat.cs @@ -87,6 +87,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats new SamiModern(), new Scenarist(), new ScenaristClosedCaptions(), + new ScenaristClosedCaptionsDropFrame(), new SmilTimesheetData(), new SonyDVDArchitect(), new SonyDVDArchitectExplicitDuration(), diff --git a/src/SubtitleEdit.csproj b/src/SubtitleEdit.csproj index b0cb8a606..fd8bebf26 100644 --- a/src/SubtitleEdit.csproj +++ b/src/SubtitleEdit.csproj @@ -849,6 +849,7 @@ +