Ticket #7994: clear_bookmark_at_end_4.patch
File clear_bookmark_at_end_4.patch, 6.4 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
4489 4489 * \param margin minimum number of frames we want before being near end, 4490 4490 * defaults to 2 seconds of video. 4491 4491 */ 4492 bool NuppelVideoPlayer::IsNearEnd(int64_t margin ) const4492 bool NuppelVideoPlayer::IsNearEnd(int64_t margin, bool allowVideo) const 4493 4493 { 4494 4494 uint64_t framesRead, framesLeft = 0; 4495 4495 … … 4497 4497 if (!player_ctx) 4498 4498 return false; 4499 4499 4500 4500 player_ctx->LockPlayingInfo(__FILE__, __LINE__); 4501 if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() ||4501 if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) || 4502 4502 !GetDecoder()) 4503 4503 { 4504 4504 player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); … … 4513 4513 framesRead = GetDecoder()->GetFramesRead(); 4514 4514 4515 4515 if (!player_ctx->IsPIP() && 4516 player_ctx->GetState() == kState_WatchingPreRecorded) 4516 (player_ctx->GetState() == kState_WatchingPreRecorded || 4517 player_ctx->GetState() == kState_WatchingVideo || 4518 player_ctx->GetState() == kState_WatchingDVD)) 4517 4519 { 4518 4520 framesLeft = margin; 4519 4521 if (!editmode && hasdeletetable && IsInDelete(framesRead)) -
libs/libmythtv/tv_play.h
340 340 void SetErrored(PlayerContext*); 341 341 void PrepToSwitchToRecordedProgram(PlayerContext*, 342 342 const ProgramInfo &); 343 enum BookmarkAction { 344 kBookmarkAlways, 345 kBookmarkNever, 346 kBookmarkAuto // set iff db_playback_exit_prompt==2 347 }; 343 348 void PrepareToExitPlayer(PlayerContext*, int line, 344 bool bookmark = true) const;349 BookmarkAction bookmark = kBookmarkAuto) const; 345 350 void SetExitPlayer(bool set_it, bool wants_to) const; 346 351 void SetUpdateOSDPosition(bool set_it); 347 352 -
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(int64_t framesRemaining = -1 ) const;208 bool IsNearEnd(int64_t 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
3101 3101 SetExitPlayer(true, true); 3102 3102 } 3103 3103 3104 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, boolbookmark) const3104 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const 3105 3105 { 3106 bool bookmark_it = bookmark && IsBookmarkAllowed(ctx); 3106 bool bm_basic = (bookmark == kBookmarkAlways || 3107 (bookmark == kBookmarkAuto && db_playback_exit_prompt == 2)); 3108 bool bookmark_it = bm_basic && IsBookmarkAllowed(ctx); 3107 3109 ctx->LockDeleteNVP(__FILE__, line); 3108 3110 if (ctx->nvp) 3109 3111 { 3110 if (bookmark_it && !(ctx->nvp->IsNearEnd())) 3111 ctx->nvp->SetBookmark(); 3112 if (bookmark_it) 3113 { 3114 if (ctx->nvp->IsNearEnd(-1, true)) 3115 ctx->nvp->ClearBookmark(); 3116 else 3117 ctx->nvp->SetBookmark(); 3118 } 3112 3119 if (db_auto_set_watched) 3113 3120 ctx->nvp->SetWatched(); 3114 3121 } … … 3176 3183 if (mctx == ctx) 3177 3184 { 3178 3185 endOfRecording = true; 3179 PrepareToExitPlayer(mctx, __LINE__ , false);3186 PrepareToExitPlayer(mctx, __LINE__); 3180 3187 SetExitPlayer(true, true); 3181 3188 } 3182 3189 } … … 3881 3888 else if (has_action("ESCAPE", actions) && isnearend) 3882 3889 { 3883 3890 requestDelete = false; 3884 PrepareToExitPlayer(actx, __LINE__ , false);3891 PrepareToExitPlayer(actx, __LINE__); 3885 3892 SetExitPlayer(true, true); 3886 3893 } 3887 3894 else if (has_action("SELECT", actions) || … … 3946 3953 DoTogglePause(actx, true); 3947 3954 break; 3948 3955 case 1: 3949 PrepareToExitPlayer(actx, __LINE__ );3956 PrepareToExitPlayer(actx, __LINE__, kBookmarkAlways); 3950 3957 SetExitPlayer(true, true); 3951 3958 break; 3952 3959 case 3: … … 3955 3962 actx, tr("Delete this recording?")); 3956 3963 return handled; 3957 3964 default: 3958 PrepareToExitPlayer(actx, __LINE__, false);3965 PrepareToExitPlayer(actx, __LINE__, kBookmarkNever); 3959 3966 SetExitPlayer(true, true); 3960 3967 break; 3961 3968 } … … 3980 3987 default: 3981 3988 if (isnearend) 3982 3989 { 3983 PrepareToExitPlayer(actx, __LINE__ , false);3990 PrepareToExitPlayer(actx, __LINE__); 3984 3991 SetExitPlayer(true, true); 3985 3992 } 3986 3993 else … … 4405 4412 PromptStopWatchingRecording(ctx); 4406 4413 return handled; 4407 4414 } 4408 PrepareToExitPlayer(ctx, __LINE__ , db_playback_exit_prompt == 2);4415 PrepareToExitPlayer(ctx, __LINE__); 4409 4416 requestDelete = false; 4410 4417 do_exit = true; 4411 4418 } … … 8802 8809 for (uint i = 0; mctx && (i < player.size()); i++) 8803 8810 { 8804 8811 PlayerContext *ctx = GetPlayer(mctx, i); 8805 PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 || 8806 db_playback_exit_prompt == 2); 8812 PrepareToExitPlayer(ctx, __LINE__); 8807 8813 } 8808 8814 8809 8815 SetExitPlayer(true, true);