diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 1705794..5e62ff0 100644
|
a
|
b
|
bool MythPlayer::IsReallyNearEnd(void) const
|
| 3313 | 3313 | |
| 3314 | 3314 | /** \brief Returns true iff near end of recording. |
| 3315 | 3315 | */ |
| 3316 | | bool MythPlayer::IsNearEnd(void) |
| | 3316 | bool MythPlayer::IsNearEnd(bool allowVideo) |
| 3317 | 3317 | { |
| 3318 | 3318 | uint64_t framesRead, framesLeft = 0; |
| 3319 | 3319 | |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3321 | 3321 | return false; |
| 3322 | 3322 | |
| 3323 | 3323 | player_ctx->LockPlayingInfo(__FILE__, __LINE__); |
| 3324 | | if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() || |
| | 3324 | if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || |
| 3325 | 3325 | !decoder) |
| 3326 | 3326 | { |
| 3327 | 3327 | player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3337 | 3337 | framesRead = decoder->GetFramesRead(); |
| 3338 | 3338 | |
| 3339 | 3339 | if (!player_ctx->IsPIP() && |
| 3340 | | player_ctx->GetState() == kState_WatchingPreRecorded) |
| | 3340 | (player_ctx->GetState() == kState_WatchingPreRecorded || |
| | 3341 | player_ctx->GetState() == kState_WatchingVideo || |
| | 3342 | player_ctx->GetState() == kState_WatchingBD || |
| | 3343 | player_ctx->GetState() == kState_WatchingDVD)) |
| 3341 | 3344 | { |
| 3342 | 3345 | if (framesRead >= deleteMap.GetLastFrame(totalFrames)) |
| 3343 | 3346 | return true; |
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index 3229f4a..ee22f6f 100644
|
a
|
b
|
class MPUBLIC MythPlayer
|
| 194 | 194 | bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const; |
| 195 | 195 | bool AtNormalSpeed(void) const { return next_normal_speed; } |
| 196 | 196 | bool IsReallyNearEnd(void) const; |
| 197 | | bool IsNearEnd(void); |
| | 197 | bool IsNearEnd(bool allowVideo = false); |
| 198 | 198 | bool HasAudioOut(void) const { return audio.HasAudioOut(); } |
| 199 | 199 | bool IsPIPActive(void) const { return pip_active; } |
| 200 | 200 | bool IsPIPVisible(void) const { return pip_visible; } |
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 1fb0b38..e9ee8a6 100644
|
a
|
b
|
void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx,
|
| 3083 | 3083 | SetExitPlayer(true, true); |
| 3084 | 3084 | } |
| 3085 | 3085 | |
| 3086 | | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const |
| | 3086 | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const |
| 3087 | 3087 | { |
| 3088 | | bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); |
| | 3088 | bool bm_basic = (bookmark == kBookmarkAlways || |
| | 3089 | (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); |
| | 3090 | bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); |
| 3089 | 3091 | ctx->LockDeletePlayer(__FILE__, line); |
| 3090 | 3092 | if (ctx->player) |
| 3091 | 3093 | { |
| 3092 | | if (bookmark_it && !(ctx->player->IsNearEnd())) |
| 3093 | | ctx->player->SetBookmark(); |
| | 3094 | if (bookmark_it) |
| | 3095 | { |
| | 3096 | if (ctx->player->IsNearEnd(true)) |
| | 3097 | ctx->player->ClearBookmark(); |
| | 3098 | else |
| | 3099 | ctx->player->SetBookmark(); |
| | 3100 | } |
| 3094 | 3101 | if (db_auto_set_watched) |
| 3095 | 3102 | ctx->player->SetWatched(); |
| 3096 | 3103 | } |
| … |
… |
void TV::HandleEndOfPlaybackTimerEvent(void)
|
| 3158 | 3165 | if (mctx == ctx) |
| 3159 | 3166 | { |
| 3160 | 3167 | endOfRecording = true; |
| 3161 | | PrepareToExitPlayer(mctx, __LINE__, false); |
| | 3168 | PrepareToExitPlayer(mctx, __LINE__); |
| 3162 | 3169 | SetExitPlayer(true, true); |
| 3163 | 3170 | } |
| 3164 | 3171 | } |
| … |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx,
|
| 4274 | 4281 | ShowOSDStopWatchingRecording(ctx); |
| 4275 | 4282 | return handled; |
| 4276 | 4283 | } |
| 4277 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2); |
| | 4284 | PrepareToExitPlayer(ctx, __LINE__); |
| 4278 | 4285 | requestDelete = false; |
| 4279 | 4286 | do_exit = true; |
| 4280 | 4287 | } |
| … |
… |
void TV::customEvent(QEvent *e)
|
| 8548 | 8555 | for (uint i = 0; mctx && (i < player.size()); i++) |
| 8549 | 8556 | { |
| 8550 | 8557 | PlayerContext *ctx = GetPlayer(mctx, i); |
| 8551 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || |
| 8552 | | db_playback_exit_prompt == 2); |
| | 8558 | PrepareToExitPlayer(ctx, __LINE__); |
| 8553 | 8559 | } |
| 8554 | 8560 | |
| 8555 | 8561 | SetExitPlayer(true, true); |
| … |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
|
| 11735 | 11741 | } |
| 11736 | 11742 | else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok) |
| 11737 | 11743 | { |
| 11738 | | PrepareToExitPlayer(ctx, __LINE__); |
| | 11744 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways); |
| 11739 | 11745 | SetExitPlayer(true, true); |
| 11740 | 11746 | } |
| 11741 | 11747 | else if (action == "KEEPWATCHING" && !near_end) |
| … |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
|
| 11744 | 11750 | } |
| 11745 | 11751 | else/* (action == "JUSTEXIT")*/ |
| 11746 | 11752 | { |
| 11747 | | PrepareToExitPlayer(ctx, __LINE__, false); |
| | 11753 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkNever); |
| 11748 | 11754 | SetExitPlayer(true, true); |
| 11749 | 11755 | } |
| 11750 | 11756 | |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index 9207280..8830d06 100644
|
a
|
b
|
class MPUBLIC TV : public QObject
|
| 331 | 331 | void SetErrored(PlayerContext*); |
| 332 | 332 | void PrepToSwitchToRecordedProgram(PlayerContext*, |
| 333 | 333 | const ProgramInfo &); |
| | 334 | enum BookmarkAction { |
| | 335 | kBookmarkAlways, |
| | 336 | kBookmarkNever, |
| | 337 | kBookmarkAuto // set iff db_playback_exit_prompt==2 |
| | 338 | }; |
| 334 | 339 | void PrepareToExitPlayer(PlayerContext*, int line, |
| 335 | | bool bookmark = true) const; |
| | 340 | BookmarkAction bookmark = kBookmarkAuto) const; |
| 336 | 341 | void SetExitPlayer(bool set_it, bool wants_to) const; |
| 337 | 342 | void SetUpdateOSDPosition(bool set_it); |
| 338 | 343 | |