mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Dcinema smpte sometimes generated illegal frame numbers - thx knut :)
This commit is contained in:
parent
a5b60e8b2a
commit
26f335bb2b
@ -776,8 +776,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
private string ConvertToTimeString(TimeCode time)
|
||||
{
|
||||
int frames = (int)System.Math.Round(time.Milliseconds / (1000.0 / frameRate));
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, DCinemaSmpte2010.MsToFramesMaxFrameRate(time.Milliseconds, frameRate));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -774,10 +774,17 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
return new TimeCode(ts);
|
||||
}
|
||||
|
||||
public static int MsToFramesMaxFrameRate(double milliseconds, double frameRate)
|
||||
{
|
||||
int frames = (int)System.Math.Round(milliseconds / (1000.0 / frameRate));
|
||||
if (frames >= Configuration.Settings.General.CurrentFrameRate)
|
||||
frames = (int)(frameRate - 0.01);
|
||||
return frames;
|
||||
}
|
||||
|
||||
private string ConvertToTimeString(TimeCode time)
|
||||
{
|
||||
int frames = (int)System.Math.Round(time.Milliseconds / (1000.0 / frameRate));
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
|
||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, MsToFramesMaxFrameRate(time.Milliseconds, frameRate));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
||||
public long TotalNumberOfPrivateStream1Continuation0 { get; private set; }
|
||||
public List<int> SubtitlePacketIds { get; private set; }
|
||||
public List<Packet> SubtitlePackets { get; private set; }
|
||||
public List<Packet> ProgramAssociationTables { get; private set; }
|
||||
// public List<Packet> ProgramAssociationTables { get; private set; }
|
||||
private Dictionary<int, List<DvbSubPes>> SubtitlesLookup { get; set; }
|
||||
private Dictionary<int, List<TransportStreamSubtitle>> DvbSubtitlesLookup { get; set; }
|
||||
public bool IsM2TransportStream { get; private set; }
|
||||
@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
||||
TotalNumberOfPrivateStream1Continuation0 = 0;
|
||||
SubtitlePacketIds = new List<int>();
|
||||
SubtitlePackets = new List<Packet>();
|
||||
ProgramAssociationTables = new List<Packet>();
|
||||
// ProgramAssociationTables = new List<Packet>();
|
||||
ms.Position = 0;
|
||||
int packetLength = 188;
|
||||
DetectFormat(ms);
|
||||
@ -147,20 +147,20 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
||||
{
|
||||
TotalNumberOfPrivateStream1Continuation0++;
|
||||
|
||||
int pesExtensionlength = 0;
|
||||
if (12 + packet.AdaptionFieldLength < packetBuffer.Length)
|
||||
pesExtensionlength = 0xFF & packetBuffer[12 + packet.AdaptionFieldLength];
|
||||
int pesOffset = 13 + packet.AdaptionFieldLength + pesExtensionlength;
|
||||
bool isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) >> 4 == 1);
|
||||
//int pesExtensionlength = 0;
|
||||
//if (12 + packet.AdaptionFieldLength < packetBuffer.Length)
|
||||
// pesExtensionlength = 0xFF & packetBuffer[12 + packet.AdaptionFieldLength];
|
||||
//int pesOffset = 13 + packet.AdaptionFieldLength + pesExtensionlength;
|
||||
//bool isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) >> 4 == 1);
|
||||
|
||||
// workaround uk freesat teletext
|
||||
if (!isTeletext)
|
||||
isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) == 0x99);
|
||||
//// workaround uk freesat teletext
|
||||
//if (!isTeletext)
|
||||
// isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) == 0x99);
|
||||
|
||||
if (!isTeletext)
|
||||
{
|
||||
//if (!isTeletext)
|
||||
//{
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
TotalNumberOfPackets++;
|
||||
|
Loading…
Reference in New Issue
Block a user