mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12: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)
|
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, DCinemaSmpte2010.MsToFramesMaxFrameRate(time.Milliseconds, frameRate));
|
||||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -774,10 +774,17 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
return new TimeCode(ts);
|
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)
|
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, MsToFramesMaxFrameRate(time.Milliseconds, frameRate));
|
||||||
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
|||||||
public long TotalNumberOfPrivateStream1Continuation0 { get; private set; }
|
public long TotalNumberOfPrivateStream1Continuation0 { get; private set; }
|
||||||
public List<int> SubtitlePacketIds { get; private set; }
|
public List<int> SubtitlePacketIds { get; private set; }
|
||||||
public List<Packet> SubtitlePackets { 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<DvbSubPes>> SubtitlesLookup { get; set; }
|
||||||
private Dictionary<int, List<TransportStreamSubtitle>> DvbSubtitlesLookup { get; set; }
|
private Dictionary<int, List<TransportStreamSubtitle>> DvbSubtitlesLookup { get; set; }
|
||||||
public bool IsM2TransportStream { get; private set; }
|
public bool IsM2TransportStream { get; private set; }
|
||||||
@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
|||||||
TotalNumberOfPrivateStream1Continuation0 = 0;
|
TotalNumberOfPrivateStream1Continuation0 = 0;
|
||||||
SubtitlePacketIds = new List<int>();
|
SubtitlePacketIds = new List<int>();
|
||||||
SubtitlePackets = new List<Packet>();
|
SubtitlePackets = new List<Packet>();
|
||||||
ProgramAssociationTables = new List<Packet>();
|
// ProgramAssociationTables = new List<Packet>();
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
int packetLength = 188;
|
int packetLength = 188;
|
||||||
DetectFormat(ms);
|
DetectFormat(ms);
|
||||||
@ -147,20 +147,20 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
|
|||||||
{
|
{
|
||||||
TotalNumberOfPrivateStream1Continuation0++;
|
TotalNumberOfPrivateStream1Continuation0++;
|
||||||
|
|
||||||
int pesExtensionlength = 0;
|
//int pesExtensionlength = 0;
|
||||||
if (12 + packet.AdaptionFieldLength < packetBuffer.Length)
|
//if (12 + packet.AdaptionFieldLength < packetBuffer.Length)
|
||||||
pesExtensionlength = 0xFF & packetBuffer[12 + packet.AdaptionFieldLength];
|
// pesExtensionlength = 0xFF & packetBuffer[12 + packet.AdaptionFieldLength];
|
||||||
int pesOffset = 13 + packet.AdaptionFieldLength + pesExtensionlength;
|
//int pesOffset = 13 + packet.AdaptionFieldLength + pesExtensionlength;
|
||||||
bool isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) >> 4 == 1);
|
//bool isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) >> 4 == 1);
|
||||||
|
|
||||||
// workaround uk freesat teletext
|
//// workaround uk freesat teletext
|
||||||
if (!isTeletext)
|
//if (!isTeletext)
|
||||||
isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) == 0x99);
|
// isTeletext = (pesExtensionlength == 0x24 && (0xFF & packetBuffer[pesOffset]) == 0x99);
|
||||||
|
|
||||||
if (!isTeletext)
|
//if (!isTeletext)
|
||||||
{
|
//{
|
||||||
|
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TotalNumberOfPackets++;
|
TotalNumberOfPackets++;
|
||||||
|
Loading…
Reference in New Issue
Block a user