mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Fixed slow playing cyan intro by changing the timeformats in plMovieplayer all to milliseconds.
Fix assertion when end of movie is reached
This commit is contained in:
committed by
Florian Meißner
parent
cbcbdc0889
commit
a36d8b51e7
@ -131,7 +131,7 @@ class TrackMgr
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (cluster->EOS())
|
||||
if (cluster->EOS() && cluster != NULL)
|
||||
{
|
||||
cluster = segment->GetNext(cluster);
|
||||
blk_entry = nullptr;
|
||||
@ -142,10 +142,15 @@ class TrackMgr
|
||||
{
|
||||
SAFE_OP(cluster->GetNext(blk_entry, blk_entry), "get next block");
|
||||
}
|
||||
else
|
||||
else if (cluster->m_pSegment != NULL)
|
||||
{
|
||||
SAFE_OP(cluster->GetFirst(blk_entry), "get first block");
|
||||
}
|
||||
else
|
||||
{
|
||||
blk_entry = nullptr;
|
||||
return false; //reached end of movie. I hope.
|
||||
}
|
||||
|
||||
if (blk_entry)
|
||||
{
|
||||
@ -154,6 +159,13 @@ class TrackMgr
|
||||
if (blk_entry->GetBlock()->GetTrackNumber() == number)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cluster = segment->GetNext(cluster);
|
||||
blk_entry = nullptr;
|
||||
if (!cluster)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false; // if this happens, boom.
|
||||
}
|
||||
@ -169,7 +181,7 @@ public:
|
||||
return false;
|
||||
|
||||
const mkvparser::BlockEntry* prev = blk_entry;
|
||||
while ((valid = PeekNextBlockEntry(p->fSegment)))
|
||||
while (valid = PeekNextBlockEntry(p->fSegment))
|
||||
{
|
||||
const mkvparser::Block* blk = blk_entry->GetBlock();
|
||||
if (blk->GetTime(blk_entry->GetCluster()) <= movieTime)
|
||||
@ -254,7 +266,7 @@ plMoviePlayer::~plMoviePlayer()
|
||||
|
||||
int64_t plMoviePlayer::GetMovieTime() const
|
||||
{
|
||||
return ((int64_t) hsTimer::GetSeconds() * fTimeScale) - fStartTime;
|
||||
return (int64_t)hsTimer::GetMilliSeconds() - fStartTime;
|
||||
}
|
||||
|
||||
bool plMoviePlayer::IOpenMovie()
|
||||
@ -383,7 +395,7 @@ bool plMoviePlayer::NextFrame()
|
||||
// Get our current timecode
|
||||
int64_t movieTime = 0;
|
||||
if (fStartTime == 0)
|
||||
fStartTime = static_cast<int64_t>((hsTimer::GetSeconds() * fTimeScale));
|
||||
fStartTime = static_cast<int64_t>(hsTimer::GetMilliSeconds());
|
||||
else
|
||||
movieTime = GetMovieTime();
|
||||
|
||||
|
@ -3287,7 +3287,12 @@ unsigned long Segment::GetCount() const
|
||||
const Cluster* Segment::GetNext(const Cluster* pCurr)
|
||||
{
|
||||
assert(pCurr);
|
||||
assert(pCurr != &m_eos);
|
||||
|
||||
if (pCurr == &m_eos)
|
||||
{
|
||||
return &m_eos;
|
||||
}
|
||||
|
||||
assert(m_clusters);
|
||||
|
||||
long idx = pCurr->m_index;
|
||||
@ -6780,7 +6785,10 @@ long long Cluster::Unparsed() const
|
||||
|
||||
long Cluster::Load(long long& pos, long& len) const
|
||||
{
|
||||
assert(m_pSegment);
|
||||
if (m_pSegment == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
assert(m_pos >= m_element_start);
|
||||
|
||||
if (m_timecode >= 0) //at least partially loaded
|
||||
@ -9291,17 +9299,7 @@ long long Block::GetTime(const Cluster* pCluster) const
|
||||
assert(pCluster);
|
||||
|
||||
const long long tc = GetTimeCode(pCluster);
|
||||
|
||||
const Segment* const pSegment = pCluster->m_pSegment;
|
||||
const SegmentInfo* const pInfo = pSegment->GetInfo();
|
||||
assert(pInfo);
|
||||
|
||||
const long long scale = pInfo->GetTimeCodeScale();
|
||||
assert(scale >= 1);
|
||||
|
||||
const long long ns = tc * scale;
|
||||
|
||||
return ns;
|
||||
return tc; //tc is in milliseconds
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user