![]() Return timecodeA.TotalSeconds() > timecodeB.TotalSeconds() Public static bool operator (Timecode timecodeA, Timecode timecodeB) Return new Timecode(timecodeA.totalFrames - frames, ameRate) Public static Timecode operator -(Timecode timecodeA, int frames) Int totalFramesB = timecodeB.totalFrames Int totalFramesA = timecodeA.totalFrames Throw new InvalidOperationException("Cannot subtract two timecodes with different framerates.") Public static Timecode operator -(Timecode timecodeA, Timecode timecodeB) / If the second timecode has fewer frames than the first, it is presumed to have rolled over the 24 hour mark and therefore be conceptually greater than the first. ![]() Return new Timecode(timecodeA.totalFrames + frames, ameRate) Public static Timecode operator +(Timecode timecodeA, int frames) / Adds a given number of frames to the timecode. Return new Timecode(timecodeA.totalFrames + timecodeB.totalFrames, ameRate) Throw new InvalidOperationException("Cannot add two timecodes with different framerates.") Public static Timecode operator +(Timecode timecodeA, Timecode timecodeB) Return new Timecode(hours, minutes, seconds, frames) Int frames = int.Parse(captureGroups.Value) Int seconds = int.Parse(captureGroups.Value) Int minutes = int.Parse(captureGroups.Value) Int hours = int.Parse(captureGroups.Value) GroupCollection captureGroups = TimecodeRegex.Match(timecodeStr).Groups Public static Timecode Parse(string timecodeStr, short framerate = 25) / Parses a timecode string of the format "hh:mm:ss:ff". / The total number of frames in one day, for this timecode's framerate. Private static string PadTimecodeUnit(int unit, int places = 2) / Pads a number for display in a timecode string. Return (float)this.totalFrames / (float)ameRate / The total number of seconds in this timecode. / The total number of frames for this timecode. Return (int)this.totalFrames / ameRate % 60 Return (int)this.totalFrames / ameRate / 60 % 60 Return (int)this.totalFrames / ameRate / 60 / 60 Public Timecode(int totalFrames, short frameRate = 25) Private static readonly Regex TimecodeRegex = new RegexOptions.Compiled | RegexOptions.ExplicitCapture) / Represents a timecode in hh:mm:ss:ff format. The "timecode" that I'm trying to represent is a timecode that is used in video editing quite often, and is seen displayed in the format "hh:mm:ss:ff", or 10:00:05:24, for example ("ff" = frames").
0 Comments
Leave a Reply. |