Ticket #7994: clear_bookmark_at_end_5.patch
| File clear_bookmark_at_end_5.patch, 6.6 KB (added by , 16 years ago) |
|---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
4525 4525 * \param margin minimum number of frames we want before being near end, 4526 4526 * defaults to 2 seconds of video. 4527 4527 */ 4528 bool NuppelVideoPlayer::IsNearEnd(int64_t margin ) const4528 bool NuppelVideoPlayer::IsNearEnd(int64_t margin, bool allowVideo) const 4529 4529 { 4530 4530 uint64_t framesRead, framesLeft = 0; 4531 4531 … … 4533 4533 return false; 4534 4534 4535 4535 player_ctx->LockPlayingInfo(__FILE__, __LINE__); 4536 if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() ||4536 if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || 4537 4537 !GetDecoder()) 4538 4538 { 4539 4539 player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); … … 4549 4549 framesRead = GetDecoder()->GetFramesRead(); 4550 4550 4551 4551 if (!player_ctx->IsPIP() && 4552 player_ctx->GetState() == kState_WatchingPreRecorded) 4552 (player_ctx->GetState() == kState_WatchingPreRecorded || 4553 player_ctx->GetState() == kState_WatchingVideo || 4554 player_ctx->GetState() == kState_WatchingDVD)) 4553 4555 { 4554 4556 framesLeft = margin; 4555 4557 if (!editmode && hasdeletetable && IsInDelete(framesRead)) … … 4564 4566 } 4565 4567 } 4566 4568 else 4567 framesLeft = totalFrames - framesRead;4569 framesLeft = totalFrames < framesRead ? 0 : totalFrames - framesRead; 4568 4570 return (framesLeft < (uint64_t)margin); 4569 4571 } 4570 4572 -
libs/libmythtv/tv_play.h
346 346 void SetErrored(PlayerContext*); 347 347 void PrepToSwitchToRecordedProgram(PlayerContext*, 348 348 const ProgramInfo &); 349 enum BookmarkAction { 350 kBookmarkAlways, 351 kBookmarkNever, 352 kBookmarkAuto // set iff db_playback_exit_prompt==2 353 }; 349 354 void PrepareToExitPlayer(PlayerContext*, int line, 350 bool bookmark = true) const;355 BookmarkAction bookmark = kBookmarkAuto) const; 351 356 void SetExitPlayer(bool set_it, bool wants_to) const; 352 357 void SetUpdateOSDPosition(bool set_it); 353 358 -
libs/libmythtv/NuppelVideoPlayer.h
206 206 bool AtNormalSpeed(void) const { return next_normal_speed; } 207 207 bool IsDecoderThreadAlive(void) const { return decoder_thread_alive; } 208 208 bool IsReallyNearEnd(void) const; 209 bool IsNearEnd(int64_t framesRemaining = -1 ) const;209 bool IsNearEnd(int64_t framesRemaining = -1, bool allowVideo = false) const; 210 210 bool PlayingSlowForPrebuffer(void) const { return m_playing_slower; } 211 211 bool HasAudioIn(void) const { return !no_audio_in; } 212 212 bool HasAudioOut(void) const { return !no_audio_out; } -
libs/libmythtv/tv_play.cpp
3109 3109 SetExitPlayer(true, true); 3110 3110 } 3111 3111 3112 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, boolbookmark) const3112 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const 3113 3113 { 3114 bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); 3114 bool bm_basic = (bookmark == kBookmarkAlways || 3115 (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); 3116 bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); 3115 3117 ctx->LockDeleteNVP(__FILE__, line); 3116 3118 if (ctx->nvp) 3117 3119 { 3118 if (bookmark_it && !(ctx->nvp->IsNearEnd())) 3119 ctx->nvp->SetBookmark(); 3120 if (bookmark_it) 3121 { 3122 if (ctx->nvp->IsNearEnd(-1, true)) 3123 ctx->nvp->ClearBookmark(); 3124 else 3125 ctx->nvp->SetBookmark(); 3126 } 3120 3127 if (db_auto_set_watched) 3121 3128 ctx->nvp->SetWatched(); 3122 3129 } … … 3184 3191 if (mctx == ctx) 3185 3192 { 3186 3193 endOfRecording = true; 3187 PrepareToExitPlayer(mctx, __LINE__ , false);3194 PrepareToExitPlayer(mctx, __LINE__); 3188 3195 SetExitPlayer(true, true); 3189 3196 } 3190 3197 } … … 3891 3898 else if (has_action("ESCAPE", actions) && isnearend) 3892 3899 { 3893 3900 requestDelete = false; 3894 PrepareToExitPlayer(actx, __LINE__ , false);3901 PrepareToExitPlayer(actx, __LINE__); 3895 3902 SetExitPlayer(true, true); 3896 3903 } 3897 3904 else if (has_action("SELECT", actions) || … … 3956 3963 DoTogglePause(actx, true); 3957 3964 break; 3958 3965 case 1: 3959 PrepareToExitPlayer(actx, __LINE__ );3966 PrepareToExitPlayer(actx, __LINE__, kBookmarkAlways); 3960 3967 SetExitPlayer(true, true); 3961 3968 break; 3962 3969 case 3: … … 3965 3972 actx, tr("Delete this recording?")); 3966 3973 return handled; 3967 3974 default: 3968 PrepareToExitPlayer(actx, __LINE__, false);3975 PrepareToExitPlayer(actx, __LINE__, kBookmarkNever); 3969 3976 SetExitPlayer(true, true); 3970 3977 break; 3971 3978 } … … 3990 3997 default: 3991 3998 if (isnearend) 3992 3999 { 3993 PrepareToExitPlayer(actx, __LINE__ , false);4000 PrepareToExitPlayer(actx, __LINE__); 3994 4001 SetExitPlayer(true, true); 3995 4002 } 3996 4003 else … … 4412 4419 PromptStopWatchingRecording(ctx); 4413 4420 return handled; 4414 4421 } 4415 PrepareToExitPlayer(ctx, __LINE__ , db_playback_exit_prompt == 2);4422 PrepareToExitPlayer(ctx, __LINE__); 4416 4423 requestDelete = false; 4417 4424 do_exit = true; 4418 4425 } … … 8772 8779 for (uint i = 0; mctx && (i < player.size()); i++) 8773 8780 { 8774 8781 PlayerContext *ctx = GetPlayer(mctx, i); 8775 PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || 8776 db_playback_exit_prompt == 2); 8782 PrepareToExitPlayer(ctx, __LINE__); 8777 8783 } 8778 8784 8779 8785 SetExitPlayer(true, true);
