diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 5e93d4f..f4f0d27 100644
|
a
|
b
|
bool MythPlayer::IsReallyNearEnd(void) const
|
| 3514 | 3514 | |
| 3515 | 3515 | /** \brief Returns true iff near end of recording. |
| 3516 | 3516 | */ |
| 3517 | | bool MythPlayer::IsNearEnd(void) |
| | 3517 | bool MythPlayer::IsNearEnd(bool allowVideo) |
| 3518 | 3518 | { |
| 3519 | 3519 | uint64_t framesRead, framesLeft = 0; |
| 3520 | 3520 | |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3522 | 3522 | return false; |
| 3523 | 3523 | |
| 3524 | 3524 | player_ctx->LockPlayingInfo(__FILE__, __LINE__); |
| 3525 | | if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() || |
| | 3525 | if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || |
| 3526 | 3526 | !decoder) |
| 3527 | 3527 | { |
| 3528 | 3528 | player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3538 | 3538 | framesRead = decoder->GetFramesRead(); |
| 3539 | 3539 | |
| 3540 | 3540 | if (!player_ctx->IsPIP() && |
| 3541 | | player_ctx->GetState() == kState_WatchingPreRecorded) |
| 3542 | | { |
| 3543 | | if (framesRead >= deleteMap.GetLastFrame(totalFrames)) |
| 3544 | | return true; |
| 3545 | | framesLeft = (totalFrames > framesRead) ? totalFrames - framesRead : 0; |
| | 3541 | (player_ctx->GetState() == kState_WatchingPreRecorded || |
| | 3542 | player_ctx->GetState() == kState_WatchingVideo || |
| | 3543 | player_ctx->GetState() == kState_WatchingBD || |
| | 3544 | player_ctx->GetState() == kState_WatchingDVD)) |
| | 3545 | { |
| | 3546 | uint64_t realTotalFrames = deleteMap.GetLastFrame(totalFrames); |
| | 3547 | framesLeft = (realTotalFrames > framesRead) ? |
| | 3548 | realTotalFrames - framesRead : 0; |
| 3546 | 3549 | return (framesLeft < (uint64_t)margin); |
| 3547 | 3550 | } |
| 3548 | 3551 | |
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index 28290d9..8358b47 100644
|
a
|
b
|
class MTV_PUBLIC MythPlayer
|
| 205 | 205 | bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const; |
| 206 | 206 | bool AtNormalSpeed(void) const { return next_normal_speed; } |
| 207 | 207 | bool IsReallyNearEnd(void) const; |
| 208 | | bool IsNearEnd(void); |
| | 208 | bool IsNearEnd(bool allowVideo = false); |
| 209 | 209 | bool HasAudioOut(void) const { return audio.HasAudioOut(); } |
| 210 | 210 | bool IsPIPActive(void) const { return pip_active; } |
| 211 | 211 | bool IsPIPVisible(void) const { return pip_visible; } |
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 036c276..bd330bd 100644
|
a
|
b
|
void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx,
|
| 3185 | 3185 | SetExitPlayer(true, true); |
| 3186 | 3186 | } |
| 3187 | 3187 | |
| 3188 | | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) |
| | 3188 | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) |
| 3189 | 3189 | { |
| 3190 | | bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); |
| | 3190 | bool bm_basic = (bookmark == kBookmarkAlways || |
| | 3191 | (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); |
| | 3192 | bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); |
| 3191 | 3193 | ctx->LockDeletePlayer(__FILE__, line); |
| 3192 | 3194 | if (ctx->player) |
| 3193 | 3195 | { |
| 3194 | | if (bookmark_it && (!(ctx->player->IsNearEnd()) || |
| 3195 | | StateIsRecording(GetState(ctx)))) |
| 3196 | | SetBookmark(ctx); |
| | 3196 | if (bookmark_it) |
| | 3197 | SetBookmark(ctx, |
| | 3198 | (ctx->player->IsNearEnd(true) || getEndOfRecording()) |
| | 3199 | && !StateIsRecording(GetState(ctx))); |
| 3197 | 3200 | if (db_auto_set_watched) |
| 3198 | 3201 | ctx->player->SetWatched(); |
| 3199 | 3202 | } |
| … |
… |
void TV::HandleEndOfPlaybackTimerEvent(void)
|
| 3261 | 3264 | if (mctx == ctx) |
| 3262 | 3265 | { |
| 3263 | 3266 | endOfRecording = true; |
| 3264 | | PrepareToExitPlayer(mctx, __LINE__, false); |
| | 3267 | PrepareToExitPlayer(mctx, __LINE__); |
| 3265 | 3268 | SetExitPlayer(true, true); |
| 3266 | 3269 | } |
| 3267 | 3270 | } |
| … |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx,
|
| 4213 | 4216 | } |
| 4214 | 4217 | else if (has_action(ACTION_STOP, actions)) |
| 4215 | 4218 | { |
| 4216 | | PrepareToExitPlayer(ctx, __LINE__, false); |
| | 4219 | PrepareToExitPlayer(ctx, __LINE__); |
| 4217 | 4220 | SetExitPlayer(true, true); |
| 4218 | 4221 | } |
| 4219 | 4222 | else if (has_action(ACTION_EXITSHOWNOPROMPTS, actions)) |
| … |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx,
|
| 4269 | 4272 | ShowOSDStopWatchingRecording(ctx); |
| 4270 | 4273 | return handled; |
| 4271 | 4274 | } |
| 4272 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2); |
| | 4275 | PrepareToExitPlayer(ctx, __LINE__); |
| 4273 | 4276 | requestDelete = false; |
| 4274 | 4277 | do_exit = true; |
| 4275 | 4278 | } |
| … |
… |
void TV::customEvent(QEvent *e)
|
| 8803 | 8806 | for (uint i = 0; mctx && (i < player.size()); i++) |
| 8804 | 8807 | { |
| 8805 | 8808 | PlayerContext *ctx = GetPlayer(mctx, i); |
| 8806 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || |
| 8807 | | db_playback_exit_prompt == 2); |
| | 8809 | PrepareToExitPlayer(ctx, __LINE__); |
| 8808 | 8810 | } |
| 8809 | 8811 | |
| 8810 | 8812 | SetExitPlayer(true, true); |
| … |
… |
void TV::OSDDialogEvent(int result, QString text, QString action)
|
| 9954 | 9956 | DoTogglePause(actx, true); |
| 9955 | 9957 | else if (action == ACTION_STOP) |
| 9956 | 9958 | { |
| 9957 | | PrepareToExitPlayer(actx, __LINE__, false); |
| | 9959 | PrepareToExitPlayer(actx, __LINE__); |
| 9958 | 9960 | SetExitPlayer(true, true); |
| 9959 | 9961 | } |
| 9960 | 9962 | else if (action == ACTION_JUMPFFWD) |
| … |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
|
| 12203 | 12205 | } |
| 12204 | 12206 | else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok) |
| 12205 | 12207 | { |
| 12206 | | PrepareToExitPlayer(ctx, __LINE__); |
| | 12208 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways); |
| 12207 | 12209 | SetExitPlayer(true, true); |
| 12208 | 12210 | } |
| 12209 | 12211 | else if (action == "KEEPWATCHING" && !near_end) |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index adce496..de46302 100644
|
a
|
b
|
class MTV_PUBLIC TV : public QObject
|
| 309 | 309 | void setUnderNetworkControl(bool setting) { underNetworkControl = setting; } |
| 310 | 310 | void PrepToSwitchToRecordedProgram(PlayerContext*, |
| 311 | 311 | const ProgramInfo &); |
| | 312 | enum BookmarkAction { |
| | 313 | kBookmarkAlways, |
| | 314 | kBookmarkNever, |
| | 315 | kBookmarkAuto // set iff db_playback_exit_prompt==2 |
| | 316 | }; |
| 312 | 317 | void PrepareToExitPlayer(PlayerContext*, int line, |
| 313 | | bool bookmark = true); |
| | 318 | BookmarkAction bookmark = kBookmarkAuto); |
| 314 | 319 | void SetExitPlayer(bool set_it, bool wants_to); |
| 315 | 320 | |
| 316 | 321 | bool RequestNextRecorder(PlayerContext *, bool); |