MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / refresh

Method refresh

Engine/source/gfx/video/theoraTexture.cpp:625–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623//-----------------------------------------------------------------------------
624
625void TheoraTexture::refresh()
626{
627 PROFILE_SCOPE( TheoraTexture_refresh );
628
629 if( !mAsyncState || !mPlaybackQueue )
630 return;
631
632 // Synchronize the async state to our current time.
633 // Unfortunately, we cannot set the Theora decoder to
634 // synchronize directly with us as our lifetime and the
635 // lifetime of our time sources isn't bound to the
636 // threaded state.
637
638 mAsyncState->syncTime( _getTimeSource()->getPosition() );
639
640 // Update the texture, if necessary.
641
642 bool haveFrame = false;
643 while( mPlaybackQueue->needPacket() )
644 {
645 // Lock the current frame.
646
647 if( mCurrentFrame && !mCurrentFrame->mLockedRect )
648 mCurrentFrame->mLockedRect = mCurrentFrame->mTexture.lock();
649
650 // Try to read a new frame.
651
652 TheoraTextureFrame* frame = mAsyncState->readNextFrame();
653 if( !frame )
654 break;
655
656 // Submit frame to queue.
657
658 mPlaybackQueue->submitPacket(
659 frame,
660 frame->mFrameDuration * 1000.f,
661 false,
662 frame->mFrameTime * 1000.f
663 );
664
665 // See if we have dropped frames.
666
667 if( frame->mFrameNumber != mLastFrameNumber + 1 )
668 mNumDroppedFrames += frame->mFrameNumber - mLastFrameNumber - 1;
669 mLastFrameNumber = frame->mFrameNumber;
670
671 haveFrame = true;
672 }
673
674 // Unlock current frame.
675
676 if( mCurrentFrame && mCurrentFrame->mLockedRect )
677 {
678 mCurrentFrame->mTexture.unlock();
679 mCurrentFrame->mLockedRect = NULL;
680 }
681
682 // Release async state if we have reached the

Callers 1

_texDelegateMethod · 0.45

Calls 8

syncTimeMethod · 0.80
needPacketMethod · 0.80
readNextFrameMethod · 0.80
submitPacketMethod · 0.80
getPositionMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
isAtEndMethod · 0.45

Tested by

no test coverage detected