pŗāFrame Rate
Sample code:
class CVideoPlayer
{
/* ... */
protected:
int m_FrameCount;
DWORD m_dwOldTime,m_dwTimeElapsed;
/* ... */
};
void CVideoPlayer::OnPlay()
{
/* ... */
// Use to calculate the frame rate
m_dwOldTime =
GetTickCount();
}
void CVideoPlayer::DisplayVideo(BYTE *data,int
size)
{
/* ... */
m_FrameCount++;
if ( (GetTickCount() - m_dwOldTime) >
1000 ) {
// Display frame rate :
m_FrameCount
m_dwOldTime = GetTickCount();
m_FrameCount = 0;
}
}
Written By James Liang @ 2007/02/13