Ticket #7994: clear_bookmark_at_end_4.patch

File clear_bookmark_at_end_4.patch, 6.4 KB (added by Jim Stichnoth <stichnot@…>, 14 years ago)
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    44894489 *  \param margin minimum number of frames we want before being near end,
    44904490 *                defaults to 2 seconds of video.
    44914491 */
    4492 bool NuppelVideoPlayer::IsNearEnd(int64_t margin) const
     4492bool NuppelVideoPlayer::IsNearEnd(int64_t margin, bool allowVideo) const
    44934493{
    44944494    uint64_t framesRead, framesLeft = 0;
    44954495
     
    44974497    if (!player_ctx)
    44984498        return false;
    44994499
    45004500    player_ctx->LockPlayingInfo(__FILE__, __LINE__);
    4501     if (!player_ctx->playingInfo || player_ctx->playingInfo->IsVideo() ||
     4501    if (!player_ctx->playingInfo || (player_ctx->playingInfo->IsVideo() && !allowVideo) ||
    45024502        !GetDecoder())
    45034503    {
    45044504        player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);
     
    45134513    framesRead = GetDecoder()->GetFramesRead();
    45144514
    45154515    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))
    45174519    {
    45184520        framesLeft = margin;
    45194521        if (!editmode && hasdeletetable && IsInDelete(framesRead))
  • libs/libmythtv/tv_play.h

     
    340340    void SetErrored(PlayerContext*);
    341341    void PrepToSwitchToRecordedProgram(PlayerContext*,
    342342                                       const ProgramInfo &);
     343    enum BookmarkAction {
     344        kBookmarkAlways,
     345        kBookmarkNever,
     346        kBookmarkAuto // set iff db_playback_exit_prompt==2
     347    };
    343348    void PrepareToExitPlayer(PlayerContext*, int line,
    344                              bool bookmark = true) const;
     349                             BookmarkAction bookmark = kBookmarkAuto) const;
    345350    void SetExitPlayer(bool set_it, bool wants_to) const;
    346351    void SetUpdateOSDPosition(bool set_it);
    347352
  • libs/libmythtv/NuppelVideoPlayer.h

     
    205205    bool    AtNormalSpeed(void) const         { return next_normal_speed; }
    206206    bool    IsDecoderThreadAlive(void) const  { return decoder_thread_alive; }
    207207    bool    IsReallyNearEnd(void) const;
    208     bool    IsNearEnd(int64_t framesRemaining = -1) const;
     208    bool    IsNearEnd(int64_t framesRemaining = -1, bool allowVideo = false) const;
    209209    bool    PlayingSlowForPrebuffer(void) const { return m_playing_slower; }
    210210    bool    HasAudioIn(void) const            { return !no_audio_in; }
    211211    bool    HasAudioOut(void) const           { return !no_audio_out; }
  • libs/libmythtv/tv_play.cpp

     
    31013101    SetExitPlayer(true, true);
    31023102}
    31033103
    3104 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const
     3104void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const
    31053105{
    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);
    31073109    ctx->LockDeleteNVP(__FILE__, line);
    31083110    if (ctx->nvp)
    31093111    {
    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        }
    31123119        if (db_auto_set_watched)
    31133120            ctx->nvp->SetWatched();
    31143121    }
     
    31763183        if (mctx == ctx)
    31773184        {
    31783185            endOfRecording = true;
    3179             PrepareToExitPlayer(mctx, __LINE__, false);
     3186            PrepareToExitPlayer(mctx, __LINE__);
    31803187            SetExitPlayer(true, true);
    31813188        }
    31823189    }
     
    38813888    else if (has_action("ESCAPE", actions) && isnearend)
    38823889    {
    38833890        requestDelete = false;
    3884         PrepareToExitPlayer(actx, __LINE__, false);
     3891        PrepareToExitPlayer(actx, __LINE__);
    38853892        SetExitPlayer(true, true);
    38863893    }
    38873894    else if (has_action("SELECT", actions)  ||
     
    39463953                    DoTogglePause(actx, true);
    39473954                    break;
    39483955                case 1:
    3949                     PrepareToExitPlayer(actx, __LINE__);
     3956                    PrepareToExitPlayer(actx, __LINE__, kBookmarkAlways);
    39503957                    SetExitPlayer(true, true);
    39513958                    break;
    39523959                case 3:
     
    39553962                        actx, tr("Delete this recording?"));
    39563963                    return handled;
    39573964                default:
    3958                     PrepareToExitPlayer(actx, __LINE__, false);
     3965                    PrepareToExitPlayer(actx, __LINE__, kBookmarkNever);
    39593966                    SetExitPlayer(true, true);
    39603967                    break;
    39613968            }
     
    39803987                default:
    39813988                    if (isnearend)
    39823989                    {
    3983                         PrepareToExitPlayer(actx, __LINE__, false);
     3990                        PrepareToExitPlayer(actx, __LINE__);
    39843991                        SetExitPlayer(true, true);
    39853992                    }
    39863993                    else
     
    44054412                PromptStopWatchingRecording(ctx);
    44064413                return handled;
    44074414            }
    4408             PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2);
     4415            PrepareToExitPlayer(ctx, __LINE__);
    44094416            requestDelete = false;
    44104417            do_exit = true;
    44114418        }
     
    88028809        for (uint i = 0; mctx && (i < player.size()); i++)
    88038810        {
    88048811            PlayerContext *ctx = GetPlayer(mctx, i);
    8805             PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 ||
    8806                                                db_playback_exit_prompt == 2);
     8812            PrepareToExitPlayer(ctx, __LINE__);
    88078813        }
    88088814
    88098815        SetExitPlayer(true, true);