本文整理汇总了C++中CDVDMsgGeneralResync类的典型用法代码示例。如果您正苦于以下问题:C++ CDVDMsgGeneralResync类的具体用法?C++ CDVDMsgGeneralResync怎么用?C++ CDVDMsgGeneralResync使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDVDMsgGeneralResync类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void OMXPlayerVideo::Process()
{
double pts = 0;
double frametime = (double)DVD_TIME_BASE / m_fFrameRate;
bool bRequestDrop = false;
m_videoStats.Start();
while(!m_bStop)
{
CDVDMsg* pMsg;
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut, iPriority);
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
CLog::Log(LOGERROR, "Got MSGQ_ABORT or MSGO_IS_ERROR return true");
break;
}
else if (ret == MSGQ_TIMEOUT)
{
// if we only wanted priority messages, this isn't a stall
if( iPriority )
continue;
//Okey, start rendering at stream fps now instead, we are likely in a stillframe
if( !m_stalled )
{
if(m_started)
CLog::Log(LOGINFO, "COMXPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate);
m_stalled = true;
pts += frametime*4;
}
pts += frametime;
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
pMsg->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
if(pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
pts = pMsgGeneralResync->m_timestamp;
double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock();
if( delay > frametime ) delay = frametime;
else if( delay < 0 ) delay = 0;
if(pMsgGeneralResync->m_clock)
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 1)", pts);
m_av_clock->Discontinuity(pts - delay);
//m_av_clock->OMXUpdateClock(pts - delay);
}
else
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 0)", pts);
pMsgGeneralResync->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_DELAY))
{
if (m_speed != DVD_PLAYSPEED_PAUSE)
{
double timeout = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_DELAY(%f)", timeout);
timeout *= (double)DVD_PLAYSPEED_NORMAL / abs(m_speed);
timeout += m_av_clock->GetAbsoluteClock();
while(!m_bStop && m_av_clock->GetAbsoluteClock() < timeout)
Sleep(1);
}
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESET");
//.........这里部分代码省略.........
示例2: while
void OMXPlayerVideo::Process()
{
double pts = 0;
double frametime = (double)DVD_TIME_BASE / m_fFrameRate;
bool bRequestDrop = false;
m_videoStats.Start();
while(!m_bStop)
{
CDVDMsg* pMsg;
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut, iPriority);
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
CLog::Log(LOGERROR, "OMXPlayerVideo: Got MSGQ_IS_ERROR(%d) Aborting", (int)ret);
break;
}
else if (ret == MSGQ_TIMEOUT)
{
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
pMsg->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
if(pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
pts = pMsgGeneralResync->m_timestamp;
double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock();
if( delay > frametime ) delay = frametime;
else if( delay < 0 ) delay = 0;
if(pMsgGeneralResync->m_clock)
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 1)", pts);
m_av_clock->Discontinuity(pts - delay);
//m_av_clock->OMXUpdateClock(pts - delay);
}
else
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 0)", pts);
pMsgGeneralResync->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_DELAY))
{
if (m_speed != DVD_PLAYSPEED_PAUSE)
{
double timeout = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_DELAY(%f)", timeout);
timeout *= (double)DVD_PLAYSPEED_NORMAL / abs(m_speed);
timeout += m_av_clock->GetAbsoluteClock();
while(!m_bStop && m_av_clock->GetAbsoluteClock() < timeout)
Sleep(1);
}
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT %.2f", m_fForcedAspectRatio);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESET");
m_av_clock->Lock();
m_av_clock->OMXStop(false);
m_omxVideo.Reset();
m_av_clock->OMXReset(false);
m_av_clock->UnLock();
m_started = false;
m_iSleepEndTime = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (COMXPlayerVideo::Flush())
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_FLUSH");
m_stalled = true;
m_started = false;
m_iSleepEndTime = DVD_NOPTS_VALUE;
m_av_clock->Lock();
//.........这里部分代码省略.........
示例3: mDeinterlace
void CDVDPlayerVideo::Process()
{
CLog::Log(LOGNOTICE, "running thread: video_thread");
DVDVideoPicture picture;
CDVDVideoPPFFmpeg mDeinterlace(CDVDVideoPPFFmpeg::ED_DEINT_FFMPEG);
memset(&picture, 0, sizeof(DVDVideoPicture));
double pts = 0;
double frametime = (double)DVD_TIME_BASE / m_fFrameRate;
int iDropped = 0; //frames dropped in a row
bool bRequestDrop = false;
m_videoStats.Start();
while (!m_bStop)
{
while (!m_bStop && m_speed == DVD_PLAYSPEED_PAUSE && !m_messageQueue.RecievedAbortRequest() && m_iNrOfPicturesNotToSkip==0) Sleep(5);
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
CDVDMsg* pMsg;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut);
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
CLog::Log(LOGERROR, "Got MSGQ_ABORT or MSGO_IS_ERROR return true");
break;
}
else if (ret == MSGQ_TIMEOUT)
{
//Okey, start rendering at stream fps now instead, we are likely in a stillframe
if( !m_stalled && m_started )
{
CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate);
m_stalled = true;
pts+= frametime*4;
}
//Waiting timed out, output last picture
if( picture.iFlags & DVP_FLAG_ALLOCATED )
{
//Remove interlaced flag before outputting
//no need to output this as if it was interlaced
picture.iFlags &= ~DVP_FLAG_INTERLACED;
picture.iFlags |= DVP_FLAG_NOSKIP;
OutputPicture(&picture, pts);
pts+= frametime;
}
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
((CDVDMsgGeneralSynchronize*)pMsg)->Wait( &m_bStop, SYNCSOURCE_AUDIO );
CLog::Log(LOGDEBUG, "CDVDPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
pMsg->Release();
/* we may be very much off correct pts here, but next picture may be a still*/
/* make sure it isn't dropped */
m_iNrOfPicturesNotToSkip = 5;
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
if(pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
pts = pMsgGeneralResync->m_timestamp;
if(pMsgGeneralResync->m_clock)
{
double delay = m_FlipTimeStamp - m_pClock->GetAbsoluteClock();
if( delay > frametime ) delay = frametime;
else if( delay < 0 ) delay = 0;
m_pClock->Discontinuity(CLOCK_DISC_NORMAL, pts, delay);
CLog::Log(LOGDEBUG, "CDVDPlayerVideo:: Resync - clock:%f, delay:%f", pts, delay);
}
pMsgGeneralResync->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
CLog::Log(LOGDEBUG, "CDVDPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CDVDPlayerVideo::Flush())
{
EnterCriticalSection(&m_critCodecSection);
if(m_pVideoCodec)
m_pVideoCodec->Reset();
LeaveCriticalSection(&m_critCodecSection);
}
else if (pMsg->IsType(CDVDMsg::VIDEO_NOSKIP))
//.........这里部分代码省略.........
示例4: while
void OMXPlayerVideo::Process()
{
double frametime = (double)DVD_TIME_BASE / m_fFrameRate;
bool bRequestDrop = false;
m_videoStats.Start();
while(!m_bStop)
{
CDVDMsg* pMsg;
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut, iPriority);
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
CLog::Log(LOGERROR, "OMXPlayerVideo: Got MSGQ_IS_ERROR(%d) Aborting", (int)ret);
break;
}
else if (ret == MSGQ_TIMEOUT)
{
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
pMsg->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
double delay = 0;
if(pMsgGeneralResync->m_clock && pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
{
CLog::Log(LOGDEBUG, "CDVDPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, %f, 1)", m_iCurrentPts, pMsgGeneralResync->m_timestamp);
m_av_clock->Discontinuity(pMsgGeneralResync->m_timestamp - delay);
}
else
CLog::Log(LOGDEBUG, "CDVDPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_iCurrentPts);
m_nextOverlay = DVD_NOPTS_VALUE;
m_iCurrentPts = DVD_NOPTS_VALUE;
pMsgGeneralResync->Release();
continue;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_DELAY))
{
double timeout = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_DELAY(%f)", timeout);
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT %.2f", m_fForcedAspectRatio);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESET");
m_omxVideo.Reset();
m_started = false;
m_nextOverlay = DVD_NOPTS_VALUE;
m_iCurrentPts = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (COMXPlayerVideo::Flush())
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_FLUSH");
m_stalled = true;
m_started = false;
m_nextOverlay = DVD_NOPTS_VALUE;
m_iCurrentPts = DVD_NOPTS_VALUE;
m_omxVideo.Reset();
m_flush = false;
}
else if (pMsg->IsType(CDVDMsg::PLAYER_SETSPEED))
{
if (m_speed != static_cast<CDVDMsgInt*>(pMsg)->m_value)
{
m_speed = static_cast<CDVDMsgInt*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::PLAYER_SETSPEED %d", m_speed);
}
}
else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::PLAYER_STARTED %d", m_started);
if(m_started)
m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_VIDEO));
}
else if (pMsg->IsType(CDVDMsg::PLAYER_DISPLAYTIME))
//.........这里部分代码省略.........