Fix #82
This commit is contained in:
parent
3855834d63
commit
04de21e594
|
@ -152,14 +152,19 @@ namespace N_m3u8DL_RE.Common.Entity
|
|||
}
|
||||
|
||||
//确实存在时间轴错误的情况,才修复
|
||||
if ((this.Cues.Count > 0 && sub.Cues.Count > 0 && sub.Cues.First().StartTime < this.Cues.Last().EndTime) || this.Cues.Count == 0)
|
||||
if ((this.Cues.Count > 0 && sub.Cues.Count > 0 && sub.Cues.First().StartTime < this.Cues.Last().EndTime && sub.Cues.First().EndTime != this.Cues.Last().EndTime) || this.Cues.Count == 0)
|
||||
{
|
||||
//The MPEG2 transport stream clocks (PCR, PTS, DTS) all have units of 1/90000 second
|
||||
var seconds = (sub.MpegtsTimestamp - baseTimestamp) / 90000;
|
||||
var offset = TimeSpan.FromSeconds(seconds);
|
||||
//当前预添加的字幕的起始时间小于实际上已经走过的时间(如offset已经是100秒,而字幕起始却是2秒),才修复
|
||||
if (sub.Cues.Count > 0 && sub.Cues.First().StartTime < offset)
|
||||
{
|
||||
for (int i = 0; i < sub.Cues.Count; i++)
|
||||
{
|
||||
sub.Cues[i].StartTime += TimeSpan.FromSeconds(seconds);
|
||||
sub.Cues[i].EndTime += TimeSpan.FromSeconds(seconds);
|
||||
sub.Cues[i].StartTime += offset;
|
||||
sub.Cues[i].EndTime += offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace N_m3u8DL_RE.CommandLine
|
|||
{
|
||||
internal partial class CommandInvoker
|
||||
{
|
||||
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20221210";
|
||||
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20221211";
|
||||
|
||||
[GeneratedRegex("((best|worst)\\d*|all)")]
|
||||
private static partial Regex ForStrRegex();
|
||||
|
|
Loading…
Reference in New Issue