Ticket #7994: clear_bookmark_at_end_2.patch
File clear_bookmark_at_end_2.patch, 6.3 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
4627 4652 * \param margin minimum number of frames we want before being near end, 4628 4653 * defaults to 2 seconds of video. 4629 4654 */ 4630 bool NuppelVideoPlayer::IsNearEnd(long long margin ) const4655 bool NuppelVideoPlayer::IsNearEnd(long long margin, bool allowVideo) const 4631 4656 { 4632 4657 long long framesRead, framesLeft = 0; 4633 4658 4634 4659 player_ctx->LockPlayingInfo(__FILE__, __LINE__); 4635 if (!player_ctx->playingInfo || player_ctx->playingInfo->isVideo||4660 if (!player_ctx->playingInfo || (player_ctx->playingInfo->isVideo && !allowVideo) || 4636 4661 !GetDecoder()) 4637 4662 { 4638 4663 player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); … … 4648 4673 framesRead = GetDecoder()->GetFramesRead(); 4649 4674 4650 4675 if (player_ctx && !player_ctx->IsPIP() && 4651 player_ctx->GetState() == kState_WatchingPreRecorded) 4676 (player_ctx->GetState() == kState_WatchingPreRecorded || 4677 player_ctx->GetState() == kState_WatchingVideo || 4678 player_ctx->GetState() == kState_WatchingDVD)) 4652 4679 { 4653 4680 framesLeft = margin; 4654 4681 if (!editmode && hasdeletetable && IsInDelete(framesRead)) -
libs/libmythtv/tv_play.h
342 343 void ForceNextStateNone(PlayerContext*); 343 344 void ScheduleStateChange(PlayerContext*); 344 345 void SetErrored(PlayerContext*); 346 enum BookmarkAction { 347 kBookmarkAlways, 348 kBookmarkNever, 349 kBookmarkAuto // set iff db_playback_exit_prompt==2 350 }; 345 351 void PrepareToExitPlayer(PlayerContext*, int line, 346 bool bookmark = true) const;352 BookmarkAction bookmark = kBookmarkAuto) const; 347 353 void SetExitPlayer(bool set_it, bool wants_to) const; 348 354 void SetUpdateOSDPosition(bool set_it); 349 355 -
libs/libmythtv/NuppelVideoPlayer.h
205 205 bool AtNormalSpeed(void) const { return next_normal_speed; } 206 206 bool IsDecoderThreadAlive(void) const { return decoder_thread_alive; } 207 207 bool IsReallyNearEnd(void) const; 208 bool IsNearEnd(long long framesRemaining = -1 ) const;208 bool IsNearEnd(long long framesRemaining = -1, bool allowVideo = false) const; 209 209 bool PlayingSlowForPrebuffer(void) const { return m_playing_slower; } 210 210 bool HasAudioIn(void) const { return !no_audio_in; } 211 211 bool HasAudioOut(void) const { return !no_audio_out; } -
libs/libmythtv/tv_play.cpp
3087 3087 errorRecoveryTimerId = StartTimer(1, __LINE__); 3088 3088 } 3089 3089 3090 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, boolbookmark) const3090 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const 3091 3091 { 3092 bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); 3092 bool bm_basic = (bookmark == kBookmarkAlways || 3093 (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); 3094 bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); 3093 3095 ctx->LockDeleteNVP(__FILE__, line); 3094 3096 if (ctx->nvp) 3095 3097 { 3096 if (bookmark_it && !(ctx->nvp->IsNearEnd())) 3097 ctx->nvp->SetBookmark(); 3098 if (bookmark_it) 3099 { 3100 if (ctx->nvp->IsNearEnd(-1, true)) 3101 ctx->nvp->ClearBookmark(); 3102 else 3103 ctx->nvp->SetBookmark(); 3104 } 3098 3105 if (db_auto_set_watched) 3099 3106 ctx->nvp->SetWatched(); 3100 3107 } … … 3162 3169 if (mctx == ctx) 3163 3170 { 3164 3171 endOfRecording = true; 3165 PrepareToExitPlayer(mctx, __LINE__ , false);3172 PrepareToExitPlayer(mctx, __LINE__); 3166 3173 SetExitPlayer(true, true); 3167 3174 } 3168 3175 } … … 3867 3897 else if (has_action("ESCAPE", actions) && isnearend) 3868 3898 { 3869 3899 requestDelete = false; 3870 PrepareToExitPlayer(actx, __LINE__ , false);3900 PrepareToExitPlayer(actx, __LINE__); 3871 3901 SetExitPlayer(true, true); 3872 3902 } 3873 3903 else if (has_action("SELECT", actions) || … … 3932 3962 DoTogglePause(actx, true); 3933 3963 break; 3934 3964 case 1: 3935 PrepareToExitPlayer(actx, __LINE__ );3965 PrepareToExitPlayer(actx, __LINE__, kBookmarkAlways); 3936 3966 SetExitPlayer(true, true); 3937 3967 break; 3938 3968 case 3: … … 3941 3971 actx, tr("Delete this recording?")); 3942 3972 return handled; 3943 3973 default: 3944 PrepareToExitPlayer(actx, __LINE__, false);3974 PrepareToExitPlayer(actx, __LINE__, kBookmarkNever); 3945 3975 SetExitPlayer(true, true); 3946 3976 break; 3947 3977 } … … 3966 3996 default: 3967 3997 if (isnearend) 3968 3998 { 3969 PrepareToExitPlayer(actx, __LINE__ , false);3999 PrepareToExitPlayer(actx, __LINE__); 3970 4000 SetExitPlayer(true, true); 3971 4001 } 3972 4002 else … … 4445 4475 PromptStopWatchingRecording(ctx); 4446 4476 return handled; 4447 4477 } 4448 PrepareToExitPlayer(ctx, __LINE__ , db_playback_exit_prompt == 2);4478 PrepareToExitPlayer(ctx, __LINE__); 4449 4479 requestDelete = false; 4450 4480 do_exit = true; 4451 4481 } … … 8783 8817 for (uint i = 0; mctx && (i < player.size()); i++) 8784 8818 { 8785 8819 PlayerContext *ctx = GetPlayer(mctx, i); 8786 PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || 8787 db_playback_exit_prompt == 2); 8820 PrepareToExitPlayer(ctx, __LINE__); 8788 8821 } 8789 8822 8790 8823 SetExitPlayer(true, true);