本文整理汇总了C++中CDVDMsg::IsType方法的典型用法代码示例。如果您正苦于以下问题:C++ CDVDMsg::IsType方法的具体用法?C++ CDVDMsg::IsType怎么用?C++ CDVDMsg::IsType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDVDMsg
的用法示例。
在下文中一共展示了CDVDMsg::IsType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecodeFrame
//.........这里部分代码省略.........
continue;
//If we are asked to drop this packet, return a size of zero. then it won't be played
//we currently still decode the audio.. this is needed since we still need to know it's
//duration to make sure clock is updated correctly.
if( bDropPacket )
result |= DECODE_FLAG_DROP;
return result;
}
// free the current packet
m_decode.Release();
if (m_messageQueue.ReceivedAbortRequest()) return DECODE_FLAG_ABORT;
CDVDMsg* pMsg;
int priority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
int timeout;
if(m_duration > 0)
timeout = (int)(1000 * (m_duration / DVD_TIME_BASE + m_dvdAudio.GetCacheTime()));
else
timeout = 1000;
// read next packet and return -1 on error
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
if (ret == MSGQ_TIMEOUT)
return DECODE_FLAG_TIMEOUT;
if (MSGQ_IS_ERROR(ret))
return DECODE_FLAG_ABORT;
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
m_decode.Attach((CDVDMsgDemuxerPacket*)pMsg);
m_ptsInput.Add( m_decode.size, m_decode.dts );
}
else if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait( 100, SYNCSOURCE_AUDIO ))
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
if (pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
m_audioClock = pMsgGeneralResync->m_timestamp;
m_ptsInput.Flush();
m_dvdAudio.SetPlayingPts(m_audioClock);
if (pMsgGeneralResync->m_clock)
{
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 1)", m_audioClock);
m_pClock->Discontinuity(m_dvdAudio.GetPlayingPts());
}
else
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_audioClock);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if (m_pAudioCodec)
m_pAudioCodec->Reset();
示例2: Process
void OMXPlayerAudio::Process()
{
m_audioStats.Start();
while(!m_bStop)
{
CDVDMsg* pMsg;
int timeout = 1000;
// read next packet and return -1 on error
int priority = 1;
//Do we want a new audio frame?
if (m_syncState == IDVDStreamPlayer::SYNC_STARTING || /* when not started */
m_speed == DVD_PLAYSPEED_NORMAL || /* when playing normally */
m_speed < DVD_PLAYSPEED_PAUSE || /* when rewinding */
(m_speed > DVD_PLAYSPEED_NORMAL && m_audioClock < m_av_clock->GetClock())) /* when behind clock in ff */
priority = 0;
if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
priority = 1;
// consider stream stalled if queue is empty
// we can't sync audio to clock with an empty queue
if (m_speed == DVD_PLAYSPEED_NORMAL)
{
timeout = 0;
}
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
if (ret == MSGQ_TIMEOUT)
{
Sleep(10);
continue;
}
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
Sleep(10);
continue;
}
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket();
bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop();
#ifdef _DEBUG
CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts,
(int)pPacket->iSize, m_syncState, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate);
#endif
if(Decode(pPacket, bPacketDrop, m_speed > DVD_PLAYSPEED_NORMAL || m_speed < 0))
{
// we are not running until something is cached in output device
if(m_stalled && m_omxAudio.GetCacheTime() > 0.0)
{
CLog::Log(LOGINFO, "COMXPlayerAudio - Switching to normal playback");
m_stalled = false;
}
}
}
else if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait( 100, SYNCSOURCE_AUDIO ))
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
double pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f)", pts);
m_audioClock = pts;
m_syncState = IDVDStreamPlayer::SYNC_INSYNC;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESET");
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
m_audioClock = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH))
{
bool sync = static_cast<CDVDMsgBool*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_FLUSH(%d)", sync);
m_omxAudio.Flush();
m_stalled = true;
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_audioClock = DVD_NOPTS_VALUE;
m_flush = false;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_EOF))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_EOF");
//.........这里部分代码省略.........
示例3: Process
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");
//.........这里部分代码省略.........
示例4: Process
void CVideoPlayerAudio::Process()
{
CLog::Log(LOGNOTICE, "running thread: CVideoPlayerAudio::Process()");
DVDAudioFrame audioframe;
m_audioStats.Start();
while (!m_bStop)
{
CDVDMsg* pMsg;
int timeout = (int)(1000 * m_dvdAudio.GetCacheTime()) + 100;
// read next packet and return -1 on error
int priority = 1;
//Do we want a new audio frame?
if (m_syncState == IDVDStreamPlayer::SYNC_STARTING || /* when not started */
ALLOW_AUDIO(m_speed) || /* when playing normally */
m_speed < DVD_PLAYSPEED_PAUSE || /* when rewinding */
(m_speed > DVD_PLAYSPEED_NORMAL && m_audioClock < m_pClock->GetClock())) /* when behind clock in ff */
priority = 0;
if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
priority = 1;
// consider stream stalled if queue is empty
// we can't sync audio to clock with an empty queue
if (ALLOW_AUDIO(m_speed) && !m_stalled)
{
timeout = 0;
}
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
if (MSGQ_IS_ERROR(ret))
{
CLog::Log(LOGERROR, "Got MSGQ_ABORT or MSGO_IS_ERROR return true");
break;
}
else if (ret == MSGQ_TIMEOUT)
{
// Flush as the audio output may keep looping if we don't
if (ALLOW_AUDIO(m_speed) && !m_stalled && m_syncState == IDVDStreamPlayer::SYNC_INSYNC)
{
// while AE sync is active, we still have time to fill buffers
if (m_syncTimer.IsTimePast())
{
CLog::Log(LOGNOTICE, "CVideoPlayerAudio::Process - stream stalled");
m_stalled = true;
}
}
if (timeout == 0)
Sleep(10);
continue;
}
// handle messages
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait( 100, SYNCSOURCE_AUDIO ))
CLog::Log(LOGDEBUG, "CVideoPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
else
m_messageQueue.Put(pMsg->Acquire(), 1); // push back as prio message, to process other prio messages
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
double pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "CVideoPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f)", pts);
m_audioClock = pts + m_dvdAudio.GetDelay();
if (m_speed != DVD_PLAYSPEED_PAUSE)
m_dvdAudio.Resume();
m_syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_syncTimer.Set(3000);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH))
{
bool sync = static_cast<CDVDMsgBool*>(pMsg)->m_value;
m_dvdAudio.Flush();
m_stalled = true;
m_audioClock = 0;
if (sync)
{
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
m_dvdAudio.Pause();
}
if (m_pAudioCodec)
m_pAudioCodec->Reset();
}
else if (pMsg->IsType(CDVDMsg::GENERAL_EOF))
{
CLog::Log(LOGDEBUG, "CVideoPlayerAudio - CDVDMsg::GENERAL_EOF");
}
//.........这里部分代码省略.........
示例5: Process
void OMXPlayerVideo::Process()
{
double frametime = (double)DVD_TIME_BASE / m_fFrameRate;
bool bRequestDrop = false;
bool settings_changed = false;
m_videoStats.Start();
while(!m_bStop)
{
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
if (m_started && !m_sync)
iPriority = 1;
CDVDMsg* pMsg;
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))
{
double pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
m_nextOverlay = DVD_NOPTS_VALUE;
m_iCurrentPts = DVD_NOPTS_VALUE;
m_sync = true;
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f)", pts);
}
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_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_DISPLAYTIME))
{
SPlayerState& state = ((CDVDMsgType<SPlayerState>*)pMsg)->m_value;
state.player = VideoPlayer_VIDEO;
if (m_speed != DVD_PLAYSPEED_NORMAL && m_speed != DVD_PLAYSPEED_PAUSE)
{
if(state.time_src == ETIMESOURCE_CLOCK)
state.time = DVD_TIME_TO_MSEC(m_av_clock->GetClock(state.timestamp) + state.time_offset);
else
state.timestamp = CDVDClock::GetAbsoluteClock();
}
else
{
double pts = m_iCurrentPts;
double stamp = m_av_clock->OMXMediaTime();
if(state.time_src == ETIMESOURCE_CLOCK)
//.........这里部分代码省略.........
示例6: DecodeFrame
//.........这里部分代码省略.........
}
// free the current packet
m_decode.Release();
if (m_messageQueue.ReceivedAbortRequest()) return DECODE_FLAG_ABORT;
CDVDMsg* pMsg;
int timeout = (int)(1000 * m_dvdAudio.GetCacheTime()) + 100;
// read next packet and return -1 on error
int priority = 1;
//Do we want a new audio frame?
if (m_started == false /* when not started */
|| m_speed == DVD_PLAYSPEED_NORMAL /* when playing normally */
|| m_speed < DVD_PLAYSPEED_PAUSE /* when rewinding */
|| (m_speed > DVD_PLAYSPEED_NORMAL && m_audioClock < m_pClock->GetClock())) /* when behind clock in ff */
priority = 0;
// consider stream stalled if queue is empty
// we can't sync audio to clock with an empty queue
if (m_speed == DVD_PLAYSPEED_NORMAL)
{
timeout = 0;
}
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
if (ret == MSGQ_TIMEOUT)
return DECODE_FLAG_TIMEOUT;
if (MSGQ_IS_ERROR(ret))
return DECODE_FLAG_ABORT;
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
m_decode.Attach((CDVDMsgDemuxerPacket*)pMsg);
m_ptsInput.Add( m_decode.size, m_decode.dts );
}
else if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait( 100, SYNCSOURCE_AUDIO ))
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, %d)"
, pMsgGeneralResync->m_timestamp
, pMsgGeneralResync->m_clock);
if (pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
m_audioClock = pMsgGeneralResync->m_timestamp;
m_ptsInput.Flush();
m_dvdAudio.SetPlayingPts(m_audioClock);
if (pMsgGeneralResync->m_clock)
m_pClock->Discontinuity(m_dvdAudio.GetPlayingPts());
m_syncclock = true;
m_errors.Flush();
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if (m_pAudioCodec)
m_pAudioCodec->Reset();
示例7: Process
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();
//.........这里部分代码省略.........
示例8: Process
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))
//.........这里部分代码省略.........
示例9: Process
void OMXPlayerAudio::Process()
{
m_audioStats.Start();
while(!m_bStop)
{
CDVDMsg* pMsg;
int priority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
int timeout = 1000;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
if (ret == MSGQ_TIMEOUT)
{
Sleep(10);
continue;
}
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
{
Sleep(10);
continue;
}
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket();
bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop();
#ifdef _DEBUG
CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts,
(int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate);
#endif
if(Decode(pPacket, m_speed > DVD_PLAYSPEED_NORMAL || m_speed < 0 || bPacketDrop))
{
// we are not running until something is cached in output device
if(m_stalled && m_omxAudio.GetCacheTime() > 0.0)
{
CLog::Log(LOGINFO, "COMXPlayerAudio - Switching to normal playback");
m_stalled = false;
}
}
}
else if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait( 100, SYNCSOURCE_AUDIO ))
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, %d)", m_audioClock, pMsgGeneralResync->m_clock);
m_flush = false;
m_audioClock = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESET");
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_omxAudio.Flush();
m_started = false;
m_audioClock = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_FLUSH");
m_omxAudio.Flush();
m_stalled = true;
m_started = false;
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_audioClock = DVD_NOPTS_VALUE;
}
else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::PLAYER_STARTED %d", m_started);
if(m_started)
m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_AUDIO));
}
else if (pMsg->IsType(CDVDMsg::PLAYER_DISPLAYTIME))
{
COMXPlayer::SPlayerState& state = ((CDVDMsgType<COMXPlayer::SPlayerState>*)pMsg)->m_value;
if(state.time_src == COMXPlayer::ETIMESOURCE_CLOCK)
state.time = DVD_TIME_TO_MSEC(m_av_clock->OMXMediaTime());
//state.time = DVD_TIME_TO_MSEC(m_av_clock->GetClock(state.timestamp) + state.time_offset);
else
state.timestamp = m_av_clock->GetAbsoluteClock();
state.player = DVDPLAYER_AUDIO;
m_messageParent.Put(pMsg->Acquire());
}
else if (pMsg->IsType(CDVDMsg::GENERAL_EOF))
{
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_EOF");
SubmitEOS();
}
//.........这里部分代码省略.........
示例10: DecodeFrame
//.........这里部分代码省略.........
// compute duration.
int n = (audioframe.channels * audioframe.bits_per_sample * audioframe.sample_rate)>>3;
if (n > 0)
{
// safety check, if channels == 0, n will result in 0, and that will result in a nice devide exception
audioframe.duration = ((double)audioframe.size * DVD_TIME_BASE) / n;
// increase audioclock to after the packet
m_audioClock += audioframe.duration;
datatimeout = (unsigned int)(audioframe.duration*2.0);
}
// if demux source want's us to not display this, continue
if(m_decode.msg->GetPacketDrop())
continue;
//If we are asked to drop this packet, return a size of zero. then it won't be played
//we currently still decode the audio.. this is needed since we still need to know it's
//duration to make sure clock is updated correctly.
if( bDropPacket )
result |= DECODE_FLAG_DROP;
return result;
}
// free the current packet
m_decode.Release();
if (m_messageQueue.RecievedAbortRequest()) return DECODE_FLAG_ABORT;
// read next packet and return -1 on error
LeaveCriticalSection(&m_critCodecSection); //Leave here as this might stall a while
CDVDMsg* pMsg;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, datatimeout);
EnterCriticalSection(&m_critCodecSection);
if (ret == MSGQ_TIMEOUT)
{
if(m_started)
m_stalled = true;
continue;
}
if (MSGQ_IS_ERROR(ret) || ret == MSGQ_ABORT)
return DECODE_FLAG_ABORT;
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
m_stalled = false;
m_started = true;
m_decode.Attach((CDVDMsgDemuxerPacket*)pMsg);
m_ptsInput.Add( m_decode.size, m_decode.dts );
}
else if (pMsg->IsType(CDVDMsg::GENERAL_STREAMCHANGE))
{
CDVDMsgGeneralStreamChange* pMsgStreamChange = (CDVDMsgGeneralStreamChange*)pMsg;
CDVDStreamInfo* hints = pMsgStreamChange->GetStreamInfo();
/* recieved a stream change, reopen codec. */
/* we should really not do this untill first packet arrives, to have a probe buffer */
/* try to open decoder, if none is found keep consuming packets */
OpenDecoder( *hints );
}
else if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
((CDVDMsgGeneralSynchronize*)pMsg)->Wait( &m_bStop, SYNCSOURCE_AUDIO );
CLog::Log(LOGDEBUG, "CDVDPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
if (pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
m_audioClock = pMsgGeneralResync->m_timestamp;
if (pMsgGeneralResync->m_clock)
{
m_ptsOutput.Add(m_audioClock, m_dvdAudio.GetDelay(), 0);
m_pClock->Discontinuity(CLOCK_DISC_NORMAL, m_ptsOutput.Current(), 0);
}
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH))
{
m_dvdAudio.Flush();
m_ptsOutput.Flush();
m_ptsInput.Flush();
if (m_pAudioCodec)
m_pAudioCodec->Reset();
m_decode.Release();
}
pMsg->Release();
}
return 0;
}
示例11: Process
//.........这里部分代码省略.........
}
// 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)
{
// squeeze pictures out
while (!m_bStop && m_pVideoCodec)
{
m_pVideoCodec->SetCodecControl(DVD_CODEC_CTRL_DRAIN);
if (!ProcessDecoderOutput(frametime, pts))
break;
}
CLog::Log(LOGINFO, "CVideoPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate);
m_stalled = true;
pts += frametime * 4;
}
// Waiting timed out, output last picture
if (m_picture.videoBuffer)
{
m_picture.pts = pts;
m_outputSate = OutputPicture(&m_picture);
pts += frametime;
}
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if (static_cast<CDVDMsgGeneralSynchronize*>(pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else
SendMessage(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
m_droppingStats.Reset();
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
m_syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_droppingStats.Reset();
m_rewindStalled = false;
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f)", pts);
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
m_fForcedAspectRatio = static_cast<float>(*static_cast<CDVDMsgDouble*>(pMsg));
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if(m_pVideoCodec)
m_pVideoCodec->Reset();
if (m_picture.videoBuffer)
{
m_picture.videoBuffer->Release();
m_picture.videoBuffer = nullptr;
示例12: Process
void CVideoPlayerVideo::Process()
{
CLog::Log(LOGNOTICE, "running thread: video_thread");
memset(&m_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;
int iDropDirective;
m_videoStats.Start();
m_droppingStats.Reset();
m_iDroppedFrames = 0;
while (!m_bStop)
{
int iQueueTimeOut = (int)(m_stalled ? frametime : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_syncState == IDVDStreamPlayer::SYNC_INSYNC) ? 1 : 0;
if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
iPriority = 1;
CDVDMsg* pMsg;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut, iPriority);
if (MSGQ_IS_ERROR(ret))
{
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;
// check if decoder has produced some output
m_pVideoCodec->SetCodecControl(DVD_CODEC_CTRL_DRAIN);
int decoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE);
ProcessDecoderOutput(decoderState, frametime, pts);
//Okey, start rendering at stream fps now instead, we are likely in a stillframe
if (!m_stalled)
{
if(m_syncState == IDVDStreamPlayer::SYNC_INSYNC)
CLog::Log(LOGINFO, "CVideoPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate);
m_stalled = true;
pts += frametime * 4;
}
//Waiting timed out, output last picture
if (m_picture.iFlags & DVP_FLAG_ALLOCATED)
{
OutputPicture(&m_picture, pts);
pts += frametime;
}
continue;
}
if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
}
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
m_droppingStats.Reset();
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
m_syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_droppingStats.Reset();
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f)", pts);
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if(m_pVideoCodec)
m_pVideoCodec->Reset();
m_picture.iFlags &= ~DVP_FLAG_ALLOCATED;
m_packets.clear();
m_droppingStats.Reset();
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CVideoPlayerVideo::Flush())
{
bool sync = static_cast<CDVDMsgBool*>(pMsg)->m_value;
if(m_pVideoCodec)
//.........这里部分代码省略.........
示例13: Process
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))
//.........这里部分代码省略.........
示例14: Process
void CVideoPlayerVideo::Process()
{
CLog::Log(LOGNOTICE, "running thread: video_thread");
DVDVideoPicture picture;
CPulldownCorrection pulldown;
CDVDVideoPPFFmpeg mPostProcess("");
std::string sPostProcessType;
bool bPostProcessDeint = false;
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;
int iDropDirective;
m_videoStats.Start();
m_droppingStats.Reset();
while (!m_bStop)
{
int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000;
int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_syncState == IDVDStreamPlayer::SYNC_INSYNC) ? 1 : 0;
if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
iPriority = 1;
CDVDMsg* pMsg;
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, iQueueTimeOut, iPriority);
if (MSGQ_IS_ERROR(ret))
{
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_syncState == IDVDStreamPlayer::SYNC_INSYNC)
CLog::Log(LOGINFO, "CVideoPlayerVideo - 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))
{
if(((CDVDMsgGeneralSynchronize*)pMsg)->Wait(100, SYNCSOURCE_VIDEO))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE");
/* 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;
}
else
m_messageQueue.Put(pMsg->Acquire(), 1); /* push back as prio message, to process other prio messages */
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
pts = static_cast<CDVDMsgDouble*>(pMsg)->m_value;
m_FlipTimePts = pts -frametime;
m_syncState = IDVDStreamPlayer::SYNC_INSYNC;
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f)", pts);
}
else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
{
CLog::Log(LOGDEBUG, "CVideoPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
if(m_pVideoCodec)
m_pVideoCodec->Reset();
picture.iFlags &= ~DVP_FLAG_ALLOCATED;
m_packets.clear();
//.........这里部分代码省略.........