Skip to content

Commit

Permalink
Small simplification to the MythPlayer::IsNearEnd method.
Browse files Browse the repository at this point in the history
This just defaults to the standard margin when determining how close we
are to the end of playback. The only case that used a custom margin was
in fact repeating the same default calculation.
  • Loading branch information
Mark Kendall committed Dec 13, 2010
1 parent 9e7456b commit 604cf0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 2 additions & 4 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -3312,10 +3312,8 @@ bool MythPlayer::IsReallyNearEnd(void) const
}

/** \brief Returns true iff near end of recording.
* \param margin minimum number of frames we want before being near end,
* defaults to 2 seconds of video.
*/
bool MythPlayer::IsNearEnd(int64_t margin)
bool MythPlayer::IsNearEnd(void)
{
uint64_t framesRead, framesLeft = 0;

Expand All @@ -3331,7 +3329,7 @@ bool MythPlayer::IsNearEnd(int64_t margin)
}
player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);

margin = (margin >= 0) ? margin: (long long) (video_frame_rate*2);
long long margin = (long long)(video_frame_rate * 2);
margin = (long long) (margin * audio.GetStretchFactor());
bool watchingTV = watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -194,7 +194,7 @@ class MPUBLIC MythPlayer
bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const;
bool AtNormalSpeed(void) const { return next_normal_speed; }
bool IsReallyNearEnd(void) const;
bool IsNearEnd(int64_t framesRemaining = -1);
bool IsNearEnd(void);
bool HasAudioOut(void) const { return audio.HasAudioOut(); }
bool IsPIPActive(void) const { return pip_active; }
bool IsPIPVisible(void) const { return pip_visible; }
Expand Down
7 changes: 1 addition & 6 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -7863,13 +7863,8 @@ void TV::DoEditSchedule(int editType)
pause_active = !actx->player || !actx->player->getVideoOutput();
if (actx->player && actx->player->getVideoOutput())
allowEmbedding = actx->player->getVideoOutput()->AllowPreviewEPG();

if (!pause_active)
{
long long margin = (long long)
(actx->last_framerate * actx->player->GetAudioStretchFactor());
isNearEnd = actx->player->IsNearEnd(margin);
}
isNearEnd = actx->player->IsNearEnd();
actx->UnlockDeletePlayer(__FILE__, __LINE__);
}

Expand Down

0 comments on commit 604cf0e

Please sign in to comment.