Added SCC drop frame as seperate format

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2170 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-11-07 16:27:51 +00:00
parent fbb4ad523c
commit a50691a69e
4 changed files with 36 additions and 1 deletions

View File

@ -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<string> _letters = new List<string>
{
@ -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));
}

View File

@ -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"; }
}
}
}

View File

@ -87,6 +87,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
new SamiModern(),
new Scenarist(),
new ScenaristClosedCaptions(),
new ScenaristClosedCaptionsDropFrame(),
new SmilTimesheetData(),
new SonyDVDArchitect(),
new SonyDVDArchitectExplicitDuration(),

View File

@ -849,6 +849,7 @@
<Compile Include="Logic\SubtitleFormats\CaraokeXml.cs" />
<Compile Include="Logic\SubtitleFormats\Cavena890.cs" />
<Compile Include="Logic\SubtitleFormats\CheetahCaption.cs" />
<Compile Include="Logic\SubtitleFormats\ScenaristClosedCaptionsDropFrame.cs" />
<Compile Include="Logic\SubtitleFormats\FinalCutProXCM.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle67.cs" />
<Compile Include="Logic\SubtitleFormats\SwiftTextLineNumber .cs" />