From 743f74da61856cfa2421f1fa557f86c9fbf52cce Mon Sep 17 00:00:00 2001 From: Subelf Date: Fri, 6 May 2016 15:20:40 +0800 Subject: [PATCH] # ver. 0.9.3.7 * bugfix: zero anchor is written even subtitles start from frame 0 --- Spp2Pgs/res/Spp2Pgs.rc | Bin 4738 -> 4738 bytes Spp2PgsNet/res/app.rc | Bin 4146 -> 4146 bytes libspp2pgs/inc/PgsWriter.h | 2 +- libspp2pgs/inc/S2PGlobal.h | 4 ++-- libspp2pgs/res/libspp2pgs.rc | Bin 3410 -> 3410 bytes libspp2pgs/src/PgsWriter.cpp | 16 ++++++++-------- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Spp2Pgs/res/Spp2Pgs.rc b/Spp2Pgs/res/Spp2Pgs.rc index 2d29cf2a20a2e221fbdf0dfc23a5c485d638ae7e..d37549f90dac4b15e7e551e58e731994d83f6952 100644 GIT binary patch delta 42 vcmZotZBpH^ii6R7@@fu4M)S>gITV?JoJ1bo%{n|$P}NP!Y8yjh3_0A0E&nZ AJ^%m! diff --git a/libspp2pgs/inc/PgsWriter.h b/libspp2pgs/inc/PgsWriter.h index ae1206b..113b673 100644 --- a/libspp2pgs/inc/PgsWriter.h +++ b/libspp2pgs/inc/PgsWriter.h @@ -52,7 +52,7 @@ namespace spp2pgs static int const MinPtsIntervalTable[]; int const minInterval; - double const clockPerFrame; + double const clocksPerFrame; Size videoSize; BdViFrameRate frameRate; diff --git a/libspp2pgs/inc/S2PGlobal.h b/libspp2pgs/inc/S2PGlobal.h index 1b1d2e8..dff3af0 100644 --- a/libspp2pgs/inc/S2PGlobal.h +++ b/libspp2pgs/inc/S2PGlobal.h @@ -101,7 +101,7 @@ namespace spp2pgs inline double GetFrameRate() const { return framesPerUnit /(double) secondsPerUnit; } }; - int const ClockPerSecond = 90000uL; + int const ClocksPerSecond = 90000uL; FrameRateInfo const FrameRateTable[] = { { 0, 1000 }, { 24000, 1001 }, { 24000, 1000 }, { 25000, 1000 }, { 30000, 1001 }, { 30000, 1000 }, @@ -132,7 +132,7 @@ namespace spp2pgs auto const& frameRateInfo = FrameRateTable[(int)rate]; __int64 const& frames = index; int const& kFramesPerUnit = frameRateInfo.framesPerUnit / 1000; - int const& kClocksPerSecond = ClockPerSecond / 1000; + int const& kClocksPerSecond = ClocksPerSecond / 1000; int const& secondsPerUnit = frameRateInfo.secondsPerUnit; return frames * kClocksPerSecond * secondsPerUnit / kFramesPerUnit; diff --git a/libspp2pgs/res/libspp2pgs.rc b/libspp2pgs/res/libspp2pgs.rc index 2318eabe23536fe934b266c9de8cccd6a8039836..d4956b24ef2d107bf21aa60856d6aef1298fd885 100644 GIT binary patch delta 20 ccmca4bxCT&Dh@{T$*VaG8O=A}Settings()->IsForcingEpochZeroStart()), ptsZeroAnchor(syncPTS), - clockPerFrame(spp2pgs::ClockPerSecond / spp2pgs::GetFramePerSecond(frameRate)), + clocksPerFrame(spp2pgs::ClocksPerSecond / spp2pgs::GetFramePerSecond(frameRate)), compositionCount(0), isEpochStart(true), minInterval(MinPtsIntervalTable[(int)frameRate]), lastDecEnd(LLONG_MIN), lastCmpn({ LLONG_MIN, LLONG_MIN, nullptr, nullptr, 0, nullptr }) { @@ -81,6 +81,8 @@ namespace spp2pgs { pts = ptsZeroAnchor; } + + isZeroAnchorNeeded = false; } __int64 dts = pts - decDur; @@ -101,7 +103,7 @@ namespace spp2pgs } } - if (!isEpochStart && pts > lastCmpn.ets + clockPerFrame) + if (!isEpochStart && pts > lastCmpn.ets + clocksPerFrame) { this->TryInsertEraserBefore(dts); } @@ -181,9 +183,9 @@ namespace spp2pgs if (!this->Settings()->IsForcingTmtCompat()) { - double const & minIntervalFramed = ceil(eraseDuration / clockPerFrame) * clockPerFrame; + double const & minIntervalFramed = ceil(eraseDuration / clocksPerFrame) * clocksPerFrame; double const & lastPosibleEts = max(ets, lastCmpn.pts + minIntervalFramed); //reserve time for erasing - int const &lastPosibleEtsFrame = (int)(round(lastPosibleEts / clockPerFrame)); + int const &lastPosibleEtsFrame = (int)(round(lastPosibleEts / clocksPerFrame)); pts = spp2pgs::GetFrameTimeStamp(lastPosibleEtsFrame, frameRate); //update ets to a reasonable value } @@ -204,7 +206,7 @@ namespace spp2pgs void PgsWriter::IgnoreComposition(__int64 pts, __int64 ets) { - if (!isEpochStart && pts > lastCmpn.ets + clockPerFrame) + if (!isEpochStart && pts > lastCmpn.ets + clocksPerFrame) { this->TryInsertEraserBefore(pts); } @@ -218,7 +220,7 @@ namespace spp2pgs { int eraseDuration = wndDesc->EstimateDecodeDuration(); - double const & minIntervalFramed = ceil(eraseDuration / clockPerFrame) * clockPerFrame; + double const & minIntervalFramed = ceil(eraseDuration / clocksPerFrame) * clocksPerFrame; double const & lastPosibleEts = max(lastCmpn.ets, lastCmpn.pts + minIntervalFramed); if (dts > lastPosibleEts + minIntervalFramed) @@ -451,8 +453,6 @@ namespace spp2pgs this->EndEpoch(); this->StartEpoch(tCurWnd); - - this->isZeroAnchorNeeded = false; } } \ No newline at end of file