Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.cpp	(revision 24977)
+++ libs/libmythtv/NuppelVideoPlayer.cpp	(working copy)
@@ -3160,7 +3160,7 @@
  *  \param margin minimum number of frames we want before being near end,
  *                defaults to 2 seconds of video.
  */
-bool NuppelVideoPlayer::IsNearEnd(int64_t margin)
+bool NuppelVideoPlayer::IsNearEnd(int64_t margin, bool allowVideo)
 {
     uint64_t framesRead, framesLeft = 0;
 
@@ -3168,7 +3168,7 @@
         return false;
 
     player_ctx->LockPlayingInfo(__FILE__, __LINE__);
-    if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() ||
+    if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) ||
         !GetDecoder())
     {
         player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);
@@ -3184,7 +3184,9 @@
     framesRead = GetDecoder()->GetFramesRead();
 
     if (!player_ctx->IsPIP() &&
-        player_ctx->GetState() == kState_WatchingPreRecorded)
+        (player_ctx->GetState() == kState_WatchingPreRecorded ||
+         player_ctx->GetState() == kState_WatchingVideo ||
+         player_ctx->GetState() == kState_WatchingDVD))
     {
         framesLeft = margin;
         if (framesRead >= deleteMap.GetLastFrame(totalFrames))
Index: libs/libmythtv/tv_play.h
===================================================================
--- libs/libmythtv/tv_play.h	(revision 24977)
+++ libs/libmythtv/tv_play.h	(working copy)
@@ -337,8 +337,13 @@
     void SetErrored(PlayerContext*);
     void PrepToSwitchToRecordedProgram(PlayerContext*,
                                        const ProgramInfo &);
+    enum BookmarkAction {
+        kBookmarkAlways,
+        kBookmarkNever,
+        kBookmarkAuto // set iff db_playback_exit_prompt==2
+    };
     void PrepareToExitPlayer(PlayerContext*, int line,
-                             bool bookmark = true) const;
+                             BookmarkAction bookmark = kBookmarkAuto) const;
     void SetExitPlayer(bool set_it, bool wants_to) const;
     void SetUpdateOSDPosition(bool set_it);
 
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.h	(revision 24977)
+++ libs/libmythtv/NuppelVideoPlayer.h	(working copy)
@@ -219,7 +219,7 @@
     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(int64_t framesRemaining = -1, bool allowVideo = false);
     bool    HasAudioOut(void) const           { return audio.HasAudioOut(); }
     bool    IsPIPActive(void) const           { return pip_active; }
     bool    IsPIPVisible(void) const          { return pip_visible; }
Index: libs/libmythtv/tv_play.cpp
===================================================================
--- libs/libmythtv/tv_play.cpp	(revision 24977)
+++ libs/libmythtv/tv_play.cpp	(working copy)
@@ -3037,14 +3037,21 @@
     SetExitPlayer(true, true);
 }
 
-void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const
+void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const
 {
-    bool bookmark_it = bookmark && IsBookmarkAllowed(ctx);
+    bool bm_basic = (bookmark == kBookmarkAlways ||
+                     (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2));
+    bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx);
     ctx->LockDeleteNVP(__FILE__, line);
     if (ctx->nvp)
     {
-        if (bookmark_it && !(ctx->nvp->IsNearEnd()))
-            ctx->nvp->SetBookmark();
+        if (bookmark_it)
+        {
+            if (ctx->nvp->IsNearEnd(-1, true))
+                ctx->nvp->ClearBookmark();
+            else
+                ctx->nvp->SetBookmark();
+        }
         if (db_auto_set_watched)
             ctx->nvp->SetWatched();
     }
@@ -3112,7 +3119,7 @@
         if (mctx == ctx)
         {
             endOfRecording = true;
-            PrepareToExitPlayer(mctx, __LINE__, false);
+            PrepareToExitPlayer(mctx, __LINE__);
             SetExitPlayer(true, true);
         }
     }
@@ -4107,7 +4114,7 @@
                 ShowOSDStopWatchingRecording(ctx);
                 return handled;
             }
-            PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2);
+            PrepareToExitPlayer(ctx, __LINE__);
             requestDelete = false;
             do_exit = true;
         }
@@ -8390,8 +8397,7 @@
         for (uint i = 0; mctx && (i < player.size()); i++)
         {
             PlayerContext *ctx = GetPlayer(mctx, i);
-            PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 ||
-                                               db_playback_exit_prompt == 2);
+            PrepareToExitPlayer(ctx, __LINE__);
         }
 
         SetExitPlayer(true, true);
@@ -11582,7 +11588,7 @@
     }
     else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok)
     {
-        PrepareToExitPlayer(ctx, __LINE__);
+        PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways);
         SetExitPlayer(true, true);
     }
     else if (action == "KEEPWATCHING" && !near_end)
@@ -11591,7 +11597,7 @@
     }
     else/* (action == "JUSTEXIT")*/
     {
-        PrepareToExitPlayer(ctx, __LINE__, false);
+        PrepareToExitPlayer(ctx, __LINE__, kBookmarkNever);
         SetExitPlayer(true, true);
     }
 
