diff --git a/Spp2Pgs/res/Spp2Pgs.rc b/Spp2Pgs/res/Spp2Pgs.rc index 2d29cf2..d37549f 100644 Binary files a/Spp2Pgs/res/Spp2Pgs.rc and b/Spp2Pgs/res/Spp2Pgs.rc differ diff --git a/Spp2PgsNet/res/app.rc b/Spp2PgsNet/res/app.rc index 02c9830..88b4c97 100644 Binary files a/Spp2PgsNet/res/app.rc and b/Spp2PgsNet/res/app.rc differ 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 2318eab..d4956b2 100644 Binary files a/libspp2pgs/res/libspp2pgs.rc and b/libspp2pgs/res/libspp2pgs.rc differ diff --git a/libspp2pgs/src/PgsWriter.cpp b/libspp2pgs/src/PgsWriter.cpp index 4cd0315..8289378 100644 --- a/libspp2pgs/src/PgsWriter.cpp +++ b/libspp2pgs/src/PgsWriter.cpp @@ -29,7 +29,7 @@ namespace spp2pgs PgsWriter::PgsWriter(S2PContext const *context, Size videoSize, BdViFrameRate frameRate, StreamEx* output, __int64 syncPTS) : S2PControllerBase(context), videoSize(videoSize), frameRate(frameRate), output(output), isZeroAnchorNeeded(context->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