diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 1525a29..7a8b9f9 100644
|
a
|
b
|
bool MythPlayer::IsReallyNearEnd(void) const
|
| 3355 | 3355 | |
| 3356 | 3356 | /** \brief Returns true iff near end of recording. |
| 3357 | 3357 | */ |
| 3358 | | bool MythPlayer::IsNearEnd(void) |
| | 3358 | bool MythPlayer::IsNearEnd(bool allowVideo) |
| 3359 | 3359 | { |
| 3360 | 3360 | uint64_t framesRead, framesLeft = 0; |
| 3361 | 3361 | |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3363 | 3363 | return false; |
| 3364 | 3364 | |
| 3365 | 3365 | player_ctx->LockPlayingInfo(__FILE__, __LINE__); |
| 3366 | | if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() || |
| | 3366 | if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || |
| 3367 | 3367 | !decoder) |
| 3368 | 3368 | { |
| 3369 | 3369 | player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
| … |
… |
bool MythPlayer::IsNearEnd(void)
|
| 3379 | 3379 | framesRead = decoder->GetFramesRead(); |
| 3380 | 3380 | |
| 3381 | 3381 | if (!player_ctx->IsPIP() && |
| 3382 | | player_ctx->GetState() == kState_WatchingPreRecorded) |
| 3383 | | { |
| 3384 | | if (framesRead >= deleteMap.GetLastFrame(totalFrames)) |
| 3385 | | return true; |
| 3386 | | framesLeft = (totalFrames > framesRead) ? totalFrames - framesRead : 0; |
| | 3382 | (player_ctx->GetState() == kState_WatchingPreRecorded || |
| | 3383 | player_ctx->GetState() == kState_WatchingVideo || |
| | 3384 | player_ctx->GetState() == kState_WatchingBD || |
| | 3385 | player_ctx->GetState() == kState_WatchingDVD)) |
| | 3386 | { |
| | 3387 | uint64_t realTotalFrames = deleteMap.GetLastFrame(totalFrames); |
| | 3388 | framesLeft = (realTotalFrames > framesRead) ? |
| | 3389 | realTotalFrames - framesRead : 0; |
| 3387 | 3390 | return (framesLeft < (uint64_t)margin); |
| 3388 | 3391 | } |
| 3389 | 3392 | |
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index ca57534..3dc4d3e 100644
|
a
|
b
|
class MTV_PUBLIC MythPlayer
|
| 180 | 180 | bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const; |
| 181 | 181 | bool AtNormalSpeed(void) const { return next_normal_speed; } |
| 182 | 182 | bool IsReallyNearEnd(void) const; |
| 183 | | bool IsNearEnd(void); |
| | 183 | bool IsNearEnd(bool allowVideo = false); |
| 184 | 184 | bool HasAudioOut(void) const { return audio.HasAudioOut(); } |
| 185 | 185 | bool IsPIPActive(void) const { return pip_active; } |
| 186 | 186 | bool IsPIPVisible(void) const { return pip_visible; } |
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 25ff274..c0a0bdf 100644
|
a
|
b
|
void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx,
|
| 2844 | 2844 | SetExitPlayer(true, true); |
| 2845 | 2845 | } |
| 2846 | 2846 | |
| 2847 | | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const |
| | 2847 | void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const |
| 2848 | 2848 | { |
| 2849 | | bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); |
| | 2849 | bool bm_basic = (bookmark == kBookmarkAlways || |
| | 2850 | (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); |
| | 2851 | bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); |
| 2850 | 2852 | ctx->LockDeletePlayer(__FILE__, line); |
| 2851 | 2853 | if (ctx->player) |
| 2852 | 2854 | { |
| 2853 | | if (bookmark_it && (!(ctx->player->IsNearEnd()) || |
| 2854 | | StateIsRecording(GetState(ctx)))) |
| 2855 | | ctx->player->SetBookmark(); |
| | 2855 | if (bookmark_it) |
| | 2856 | { |
| | 2857 | if (ctx->player->IsNearEnd(true) && !StateIsRecording(GetState(ctx))) |
| | 2858 | ctx->player->ClearBookmark(); |
| | 2859 | else |
| | 2860 | ctx->player->SetBookmark(); |
| | 2861 | } |
| 2856 | 2862 | if (db_auto_set_watched) |
| 2857 | 2863 | ctx->player->SetWatched(); |
| 2858 | 2864 | } |
| … |
… |
void TV::HandleEndOfPlaybackTimerEvent(void)
|
| 2920 | 2926 | if (mctx == ctx) |
| 2921 | 2927 | { |
| 2922 | 2928 | endOfRecording = true; |
| 2923 | | PrepareToExitPlayer(mctx, __LINE__, false); |
| | 2929 | PrepareToExitPlayer(mctx, __LINE__); |
| 2924 | 2930 | SetExitPlayer(true, true); |
| 2925 | 2931 | } |
| 2926 | 2932 | } |
| … |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx,
|
| 3847 | 3853 | } |
| 3848 | 3854 | else if (has_action(ACTION_STOP, actions)) |
| 3849 | 3855 | { |
| 3850 | | PrepareToExitPlayer(ctx, __LINE__, false); |
| | 3856 | PrepareToExitPlayer(ctx, __LINE__); |
| 3851 | 3857 | SetExitPlayer(true, true); |
| 3852 | 3858 | } |
| 3853 | 3859 | else if (has_action(ACTION_EXITSHOWNOPROMPTS, actions)) |
| … |
… |
bool TV::ActiveHandleAction(PlayerContext *ctx,
|
| 3903 | 3909 | ShowOSDStopWatchingRecording(ctx); |
| 3904 | 3910 | return handled; |
| 3905 | 3911 | } |
| 3906 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2); |
| | 3912 | PrepareToExitPlayer(ctx, __LINE__); |
| 3907 | 3913 | requestDelete = false; |
| 3908 | 3914 | do_exit = true; |
| 3909 | 3915 | } |
| … |
… |
void TV::customEvent(QEvent *e)
|
| 8267 | 8273 | for (uint i = 0; mctx && (i < player.size()); i++) |
| 8268 | 8274 | { |
| 8269 | 8275 | PlayerContext *ctx = GetPlayer(mctx, i); |
| 8270 | | PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || |
| 8271 | | db_playback_exit_prompt == 2); |
| | 8276 | PrepareToExitPlayer(ctx, __LINE__); |
| 8272 | 8277 | } |
| 8273 | 8278 | |
| 8274 | 8279 | SetExitPlayer(true, true); |
| … |
… |
void TV::OSDDialogEvent(int result, QString text, QString action)
|
| 9423 | 9428 | DoTogglePause(actx, true); |
| 9424 | 9429 | else if (action == ACTION_STOP) |
| 9425 | 9430 | { |
| 9426 | | PrepareToExitPlayer(actx, __LINE__, false); |
| | 9431 | PrepareToExitPlayer(actx, __LINE__); |
| 9427 | 9432 | SetExitPlayer(true, true); |
| 9428 | 9433 | } |
| 9429 | 9434 | else if (action == ACTION_JUMPFFWD) |
| … |
… |
bool TV::HandleOSDVideoExit(PlayerContext *ctx, QString action)
|
| 11550 | 11555 | } |
| 11551 | 11556 | else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok) |
| 11552 | 11557 | { |
| 11553 | | PrepareToExitPlayer(ctx, __LINE__); |
| | 11558 | PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways); |
| 11554 | 11559 | SetExitPlayer(true, true); |
| 11555 | 11560 | } |
| 11556 | 11561 | else if (action == "KEEPWATCHING" && !near_end) |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index 32f9d50..4908bdf 100644
|
a
|
b
|
class MTV_PUBLIC TV : public QObject
|
| 328 | 328 | void SetErrored(PlayerContext*); |
| 329 | 329 | void PrepToSwitchToRecordedProgram(PlayerContext*, |
| 330 | 330 | const ProgramInfo &); |
| | 331 | enum BookmarkAction { |
| | 332 | kBookmarkAlways, |
| | 333 | kBookmarkNever, |
| | 334 | kBookmarkAuto // set iff db_playback_exit_prompt==2 |
| | 335 | }; |
| 331 | 336 | void PrepareToExitPlayer(PlayerContext*, int line, |
| 332 | | bool bookmark = true) const; |
| | 337 | BookmarkAction bookmark = kBookmarkAuto) const; |
| 333 | 338 | void SetExitPlayer(bool set_it, bool wants_to) const; |
| 334 | 339 | void SetUpdateOSDPosition(bool set_it); |
| 335 | 340 | |