diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 198e1fa..ac1c141 100644
a
|
b
|
bool MythPlayer::IsReallyNearEnd(void) const |
3317 | 3317 | * \param margin minimum number of frames we want before being near end, |
3318 | 3318 | * defaults to 2 seconds of video. |
3319 | 3319 | */ |
3320 | | bool MythPlayer::IsNearEnd(int64_t margin) |
| 3320 | bool MythPlayer::IsNearEnd(int64_t margin, bool allowVideo) |
3321 | 3321 | { |
3322 | 3322 | uint64_t framesRead, framesLeft = 0; |
3323 | 3323 | |
… |
… |
bool MythPlayer::IsNearEnd(int64_t margin) |
3325 | 3325 | return false; |
3326 | 3326 | |
3327 | 3327 | player_ctx->LockPlayingInfo(__FILE__, __LINE__); |
3328 | | if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() || |
| 3328 | if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || |
3329 | 3329 | !decoder) |
3330 | 3330 | { |
3331 | 3331 | player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
… |
… |
bool MythPlayer::IsNearEnd(int64_t margin) |
3341 | 3341 | framesRead = decoder->GetFramesRead(); |
3342 | 3342 | |
3343 | 3343 | if (!player_ctx->IsPIP() && |
3344 | | player_ctx->GetState() == kState_WatchingPreRecorded) |
| 3344 | (player_ctx->GetState() == kState_WatchingPreRecorded || |
| 3345 | player_ctx->GetState() == kState_WatchingVideo || |
| 3346 | player_ctx->GetState() == kState_WatchingBD || |
| 3347 | player_ctx->GetState() == kState_WatchingDVD)) |
3345 | 3348 | { |
3346 | 3349 | if (framesRead >= deleteMap.GetLastFrame(totalFrames)) |
3347 | 3350 | return true; |
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index b776296..e67abf8 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(int64_t framesRemaining = -1); |
| 197 | bool IsNearEnd(int64_t framesRemaining = -1, 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 d7a381c..2d13bc6 100644
a
|
b
|
void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx, |
3085 | 3085 | SetExitPlayer(true, true); |
3086 | 3086 | } |
3087 | 3087 | |
3088 | | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const |
| 3088 | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const |
3089 | 3089 | { |
3090 | | bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); |
| 3090 | bool bm_basic = (bookmark == kBookmarkAlways || |
| 3091 | (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); |
| 3092 | bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); |
3091 | 3093 | ctx->LockDeletePlayer(__FILE__, line); |
3092 | 3094 | if (ctx->player) |
3093 | 3095 | { |
3094 | | if (bookmark_it && !(ctx->player->IsNearEnd())) |
3095 | | ctx->player->SetBookmark(); |
| 3096 | if (bookmark_it) |
| 3097 | { |
| 3098 | if (ctx->player->IsNearEnd(-1, true)) |
| 3099 | ctx->player->ClearBookmark(); |
| 3100 | else |
| 3101 | ctx->player->SetBookmark(); |
| 3102 | } |
3096 | 3103 | if (db_auto_set_watched) |
3097 | 3104 | ctx->player->SetWatched(); |
3098 | 3105 | } |
… |
… |
void TV::HandleEndOfPlaybackTimerEvent(void) |
3160 | 3167 | if (mctx == ctx) |
3161 | 3168 | { |
3162 | 3169 | endOfRecording = true; |
3163 | | PrepareToExitPlayer(mctx, __LINE__, false); |
| 3170 | PrepareToExitPlayer(mctx, __LINE__); |
3164 | 3171 | SetExitPlayer(true, true); |
3165 | 3172 | } |
3166 | 3173 | } |
… |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx, |
4283 | 4290 | ShowOSDStopWatchingRecording(ctx); |
4284 | 4291 | return handled; |
4285 | 4292 | } |
4286 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2); |
| 4293 | PrepareToExitPlayer(ctx, __LINE__); |
4287 | 4294 | requestDelete = false; |
4288 | 4295 | do_exit = true; |
4289 | 4296 | } |
… |
… |
void TV::customEvent(QEvent *e) |
8560 | 8567 | for (uint i = 0; mctx && (i < player.size()); i++) |
8561 | 8568 | { |
8562 | 8569 | PlayerContext *ctx = GetPlayer(mctx, i); |
8563 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || |
8564 | | db_playback_exit_prompt == 2); |
| 8570 | PrepareToExitPlayer(ctx, __LINE__); |
8565 | 8571 | } |
8566 | 8572 | |
8567 | 8573 | SetExitPlayer(true, true); |
… |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action) |
11747 | 11753 | } |
11748 | 11754 | else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok) |
11749 | 11755 | { |
11750 | | PrepareToExitPlayer(ctx, __LINE__); |
| 11756 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways); |
11751 | 11757 | SetExitPlayer(true, true); |
11752 | 11758 | } |
11753 | 11759 | else if (action == "KEEPWATCHING" && !near_end) |
… |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action) |
11756 | 11762 | } |
11757 | 11763 | else/* (action == "JUSTEXIT")*/ |
11758 | 11764 | { |
11759 | | PrepareToExitPlayer(ctx, __LINE__, false); |
| 11765 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkNever); |
11760 | 11766 | SetExitPlayer(true, true); |
11761 | 11767 | } |
11762 | 11768 | |
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 | |