Ticket #7994: clear_bookmark_at_end_8.patch
File clear_bookmark_at_end_8.patch, 5.5 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/mythplayer.cpp
3160 3160 * \param margin minimum number of frames we want before being near end, 3161 3161 * defaults to 2 seconds of video. 3162 3162 */ 3163 bool MythPlayer::IsNearEnd(int64_t margin )3163 bool MythPlayer::IsNearEnd(int64_t margin, bool allowVideo) 3164 3164 { 3165 3165 uint64_t framesRead, framesLeft = 0; 3166 3166 … … 3168 3168 return false; 3169 3169 3170 3170 player_ctx->LockPlayingInfo(__FILE__, __LINE__); 3171 if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() ||3171 if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || 3172 3172 !GetDecoder()) 3173 3173 { 3174 3174 player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); … … 3184 3184 framesRead = GetDecoder()->GetFramesRead(); 3185 3185 3186 3186 if (!player_ctx->IsPIP() && 3187 player_ctx->GetState() == kState_WatchingPreRecorded) 3187 (player_ctx->GetState() == kState_WatchingPreRecorded || 3188 player_ctx->GetState() == kState_WatchingVideo || 3189 player_ctx->GetState() == kState_WatchingBD || 3190 player_ctx->GetState() == kState_WatchingDVD)) 3188 3191 { 3189 3192 framesLeft = margin; 3190 3193 if (framesRead >= deleteMap.GetLastFrame(totalFrames)) -
libs/libmythtv/tv_play.h
337 337 void SetErrored(PlayerContext*); 338 338 void PrepToSwitchToRecordedProgram(PlayerContext*, 339 339 const ProgramInfo &); 340 enum BookmarkAction { 341 kBookmarkAlways, 342 kBookmarkNever, 343 kBookmarkAuto // set iff db_playback_exit_prompt==2 344 }; 340 345 void PrepareToExitPlayer(PlayerContext*, int line, 341 bool bookmark = true) const;346 BookmarkAction bookmark = kBookmarkAuto) const; 342 347 void SetExitPlayer(bool set_it, bool wants_to) const; 343 348 void SetUpdateOSDPosition(bool set_it); 344 349 -
libs/libmythtv/mythplayer.h
219 219 bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const; 220 220 bool AtNormalSpeed(void) const { return next_normal_speed; } 221 221 bool IsReallyNearEnd(void) const; 222 bool IsNearEnd(int64_t framesRemaining = -1 );222 bool IsNearEnd(int64_t framesRemaining = -1, bool allowVideo = false); 223 223 bool HasAudioOut(void) const { return audio.HasAudioOut(); } 224 224 bool IsPIPActive(void) const { return pip_active; } 225 225 bool IsPIPVisible(void) const { return pip_visible; } -
libs/libmythtv/tv_play.cpp
3037 3037 SetExitPlayer(true, true); 3038 3038 } 3039 3039 3040 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, boolbookmark) const3040 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const 3041 3041 { 3042 bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); 3042 bool bm_basic = (bookmark == kBookmarkAlways || 3043 (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); 3044 bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); 3043 3045 ctx->LockDeletePlayer(__FILE__, line); 3044 3046 if (ctx->player) 3045 3047 { 3046 if (bookmark_it && !(ctx->player->IsNearEnd())) 3047 ctx->player->SetBookmark(); 3048 if (bookmark_it) 3049 { 3050 if (ctx->player->IsNearEnd(-1, true)) 3051 ctx->player->ClearBookmark(); 3052 else 3053 ctx->player->SetBookmark(); 3054 } 3048 3055 if (db_auto_set_watched) 3049 3056 ctx->player->SetWatched(); 3050 3057 } … … 3112 3119 if (mctx == ctx) 3113 3120 { 3114 3121 endOfRecording = true; 3115 PrepareToExitPlayer(mctx, __LINE__ , false);3122 PrepareToExitPlayer(mctx, __LINE__); 3116 3123 SetExitPlayer(true, true); 3117 3124 } 3118 3125 } … … 4107 4114 ShowOSDStopWatchingRecording(ctx); 4108 4115 return handled; 4109 4116 } 4110 PrepareToExitPlayer(ctx, __LINE__ , db_playback_exit_prompt == 2);4117 PrepareToExitPlayer(ctx, __LINE__); 4111 4118 requestDelete = false; 4112 4119 do_exit = true; 4113 4120 } … … 8390 8397 for (uint i = 0; mctx && (i < player.size()); i++) 8391 8398 { 8392 8399 PlayerContext *ctx = GetPlayer(mctx, i); 8393 PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || 8394 db_playback_exit_prompt == 2); 8400 PrepareToExitPlayer(ctx, __LINE__); 8395 8401 } 8396 8402 8397 8403 SetExitPlayer(true, true); … … 11582 11588 } 11583 11589 else if (action == "SAVEPOSITIONANDEXIT" && bookmark_ok) 11584 11590 { 11585 PrepareToExitPlayer(ctx, __LINE__ );11591 PrepareToExitPlayer(ctx, __LINE__, kBookmarkAlways); 11586 11592 SetExitPlayer(true, true); 11587 11593 } 11588 11594 else if (action == "KEEPWATCHING" && !near_end) … … 11591 11597 } 11592 11598 else/* (action == "JUSTEXIT")*/ 11593 11599 { 11594 PrepareToExitPlayer(ctx, __LINE__, false);11600 PrepareToExitPlayer(ctx, __LINE__, kBookmarkNever); 11595 11601 SetExitPlayer(true, true); 11596 11602 } 11597 11603