void YouTubeWebPageView::CheckSeekToStart() { if (IsPlayerError()) return; // ignore state changes when already in error state T_enPlayerState enState = GetPlayerState(); if (playerStateUnknown == enState) return; ATLASSERT(enState == playerStateVideoCued || enState == playerStatePlaying || enState == playerStateBuffering); // pause video when at correct time index if (GetCurrentTime() >= m_dSeconds && enState == playerStatePlaying) PauseVideo(); }
bool MythBDPlayer::VideoLoop(void) { if (!player_ctx->buffer->IsBD()) { SetErrored("RingBuffer is not a Blu-Ray disc."); return !IsErrored(); } int nbframes = videoOutput ? videoOutput->ValidVideoFrames() : 0; // completely drain the video buffers for certain situations bool drain = player_ctx->buffer->BD()->BDWaitingForPlayer() && (nbframes > 0); if (drain) { if (nbframes < 2 && videoOutput) videoOutput->UpdatePauseFrame(); // if we go below the pre-buffering limit, the player will pause // so do this 'manually' DisplayNormalFrame(false); return !IsErrored(); } // clear the mythtv imposed wait state if (player_ctx->buffer->BD()->BDWaitingForPlayer()) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Clearing Mythtv BD wait state"); player_ctx->buffer->BD()->SkipBDWaitingForPlayer(); return !IsErrored(); } if (player_ctx->buffer->BD()->IsInStillFrame()) { if (nbframes > 1 && !m_stillFrameShowing) { videoOutput->UpdatePauseFrame(); DisplayNormalFrame(false); return !IsErrored(); } if (!m_stillFrameShowing) needNewPauseFrame = true; // we are in a still frame so pause video output if (!videoPaused) { PauseVideo(); return !IsErrored(); } // flag if we have no frame if (nbframes == 0) { LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Warning: In BD Still but no video frames in queue"); usleep(10000); return !IsErrored(); } if (!m_stillFrameShowing) LOG(VB_PLAYBACK, LOG_INFO, LOC + "Entering still frame."); m_stillFrameShowing = true; } else { if (videoPaused && m_stillFrameShowing) { UnpauseVideo(); LOG(VB_PLAYBACK, LOG_INFO, LOC + "Exiting still frame."); } m_stillFrameShowing = false; } return MythPlayer::VideoLoop(); }
bool MythDVDPlayer::VideoLoop(void) { if (!player_ctx->buffer->IsDVD()) { SetErrored("RingBuffer is not a DVD."); return !IsErrored(); } int nbframes = 0; if (videoOutput) nbframes = videoOutput->ValidVideoFrames(); #if 0 LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Validframes %1, FreeFrames %2, VideoPaused %3") .arg(nbframes).arg(videoOutput->FreeVideoFrames()).arg(videoPaused)); #endif // completely drain the video buffers for certain situations bool release_all = player_ctx->buffer->DVD()->DVDWaitingForPlayer() && (nbframes > 0); bool release_one = (nbframes > 1) && videoPaused && !allpaused && (!videoOutput->EnoughFreeFrames() || player_ctx->buffer->DVD()->IsWaiting() || player_ctx->buffer->DVD()->IsInStillFrame()); if (release_all || release_one) { if (nbframes < 5 && videoOutput) videoOutput->UpdatePauseFrame(disp_timecode); // if we go below the pre-buffering limit, the player will pause // so do this 'manually' DisplayNormalFrame(false); dvd_stillframe_showing = false; return !IsErrored(); } // clear the mythtv imposed wait state if (player_ctx->buffer->DVD()->DVDWaitingForPlayer()) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Clearing MythTV DVD wait state"); bool inStillFrame = player_ctx->buffer->DVD()->IsInStillFrame(); player_ctx->buffer->DVD()->SkipDVDWaitingForPlayer(); ClearAfterSeek(true); if (!inStillFrame && videoPaused && !allpaused) UnpauseVideo(); return !IsErrored(); } // wait for the video buffers to drain if (nbframes < 2) { // clear the DVD wait state if (player_ctx->buffer->DVD()->IsWaiting()) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Clearing DVD wait state"); bool inStillFrame = player_ctx->buffer->DVD()->IsInStillFrame(); player_ctx->buffer->DVD()->WaitSkip(); if (!inStillFrame && videoPaused && !allpaused) UnpauseVideo(); return !IsErrored(); } // we need a custom presentation method for still frame menus with audio if (player_ctx->buffer->DVD()->IsInMenu() && !player_ctx->buffer->DVD()->IsInStillFrame()) { // ensure we refresh the pause frame if (!dvd_stillframe_showing) needNewPauseFrame = true; RefreshPauseFrame(); dvd_stillframe_showing = true; DisplayLastFrame(); return !IsErrored(); } // the still frame is treated as a pause frame if (player_ctx->buffer->DVD()->IsInStillFrame()) { // ensure we refresh the pause frame if (!dvd_stillframe_showing) needNewPauseFrame = true; // we are in a still frame so pause video output if (!videoPaused) { PauseVideo(); return !IsErrored(); } // see if the pause frame has timed out StillFrameCheck(); // flag if we have no frame if (nbframes == 0) { LOG(VB_PLAYBACK, LOG_WARNING, LOC + "In DVD Menu: No video frames in queue"); usleep(10000); return !IsErrored(); } dvd_stillframe_showing = true; } else { dvd_stillframe_showing = false; } } // unpause the still frame if more frames become available if (dvd_stillframe_showing && nbframes > 1) { UnpauseVideo(); dvd_stillframe_showing = false; return !IsErrored(); } return MythPlayer::VideoLoop(); }