From 39e15a02db13a028a4f2f4c7231b9c8fd9168b18 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 17 Jan 2012 20:22:11 +0000 Subject: [PATCH] Fixed timestamps in export of blu-ray sup files git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@934 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Logic/BluRaySup/BluRaySupPicture.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Logic/BluRaySup/BluRaySupPicture.cs b/src/Logic/BluRaySup/BluRaySupPicture.cs index 354e72cd5..1ed781d4e 100644 --- a/src/Logic/BluRaySup/BluRaySupPicture.cs +++ b/src/Logic/BluRaySup/BluRaySupPicture.cs @@ -40,11 +40,21 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup /// public long StartTime { get; set; } + public int StartTimeForWrite + { + get { return (int)((StartTime - 45) * 90.0); } + } + /// /// end time in milliseconds /// public long EndTime { get; set; } + public int EndTimeForWrite + { + get { return (int)((EndTime - 45) * 90.0); } + } + /// /// if true, this is a forced subtitle /// @@ -595,6 +605,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup byte[] buf = new byte[size]; int index = 0; + int fpsId = getFpsId(Core.fpsTrg); /* time (in 90kHz resolution) needed to initialize (clear) the screen buffer @@ -609,8 +620,8 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup int imageDecodeTime = (bm.Width * bm.Height * 9 + 1599) / 1600; // write PCS start packetHeader[10] = 0x16; // ID - int dts = (int)pic.StartTime - (frameInitTime + windowInitTime); - ToolBox.SetDWord(packetHeader, 2, (int)pic.StartTime); // PTS + int dts = pic.StartTimeForWrite - (frameInitTime + windowInitTime); + ToolBox.SetDWord(packetHeader, 2, pic.StartTimeForWrite); // PTS ToolBox.SetDWord(packetHeader, 6, dts); // DTS ToolBox.SetWord(packetHeader, 11, headerPCSStart.Length); // size for (int i = 0; i < packetHeader.Length; i++) @@ -627,7 +638,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup // write WDS packetHeader[10] = 0x17; // ID - int timeStamp = (int)pic.StartTime - windowInitTime; + int timeStamp = pic.StartTimeForWrite - windowInitTime; ToolBox.SetDWord(packetHeader, 2, timeStamp); // PTS (keep DTS) ToolBox.SetWord(packetHeader, 11, headerWDS.Length); // size for (int i = 0; i < packetHeader.Length; i++) @@ -705,8 +716,8 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup // write PCS end packetHeader[10] = 0x16; // ID - ToolBox.SetDWord(packetHeader, 2, (int)pic.EndTime); // PTS - dts = (int)pic.StartTime - 1; + ToolBox.SetDWord(packetHeader, 2, pic.EndTimeForWrite); // PTS + dts = (int)pic.StartTimeForWrite - 1; ToolBox.SetDWord(packetHeader, 6, dts); // DTS ToolBox.SetWord(packetHeader, 11, headerPCSEnd.Length); // size for (int i = 0; i < packetHeader.Length; i++) @@ -720,7 +731,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup // write WDS packetHeader[10] = 0x17; // ID - timeStamp = (int)pic.EndTime - windowInitTime; + timeStamp = pic.EndTimeForWrite - windowInitTime; ToolBox.SetDWord(packetHeader, 2, timeStamp); // PTS (keep DTS of PCS) ToolBox.SetWord(packetHeader, 11, headerWDS.Length); // size for (int i = 0; i < packetHeader.Length; i++)