Ticket #7994: clear_bookmark_at_end_2.patch

File clear_bookmark_at_end_2.patch, 6.3 KB (added by Jim Stichnoth <stichnot@…>, 14 years ago)

Use this instead of clear_bookmark_at_end.patch

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    46274652 *  \param margin minimum number of frames we want before being near end,
    46284653 *                defaults to 2 seconds of video.
    46294654 */
    4630 bool NuppelVideoPlayer::IsNearEnd(long long margin) const
     4655bool NuppelVideoPlayer::IsNearEnd(long long margin, bool allowVideo) const
    46314656{
    46324657    long long framesRead, framesLeft = 0;
    46334658
    46344659    player_ctx->LockPlayingInfo(__FILE__, __LINE__);
    4635     if (!player_ctx->playingInfo || player_ctx->playingInfo->isVideo ||
     4660    if (!player_ctx->playingInfo || (player_ctx->playingInfo->isVideo && !allowVideo) ||
    46364661        !GetDecoder())
    46374662    {
    46384663        player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);
     
    46484673    framesRead = GetDecoder()->GetFramesRead();
    46494674
    46504675    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))
    46524679    {
    46534680        framesLeft = margin;
    46544681        if (!editmode && hasdeletetable && IsInDelete(framesRead))
  • libs/libmythtv/tv_play.h

     
    342343    void ForceNextStateNone(PlayerContext*);
    343344    void ScheduleStateChange(PlayerContext*);
    344345    void SetErrored(PlayerContext*);
     346    enum BookmarkAction {
     347        kBookmarkAlways,
     348        kBookmarkNever,
     349        kBookmarkAuto // set iff db_playback_exit_prompt==2
     350    };
    345351    void PrepareToExitPlayer(PlayerContext*, int line,
    346                              bool bookmark = true) const;
     352                             BookmarkAction bookmark = kBookmarkAuto) const;
    347353    void SetExitPlayer(bool set_it, bool wants_to) const;
    348354    void SetUpdateOSDPosition(bool set_it);
    349355
  • 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(long long framesRemaining = -1) const;
     208    bool    IsNearEnd(long long 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

     
    30873087    errorRecoveryTimerId = StartTimer(1, __LINE__);
    30883088}
    30893089
    3090 void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const
     3090void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, BookmarkAction bookmark) const
    30913091{
    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);
    30933095    ctx->LockDeleteNVP(__FILE__, line);
    30943096    if (ctx->nvp)
    30953097    {
    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        }
    30983105        if (db_auto_set_watched)
    30993106            ctx->nvp->SetWatched();
    31003107    }
     
    31623169        if (mctx == ctx)
    31633170        {
    31643171            endOfRecording = true;
    3165             PrepareToExitPlayer(mctx, __LINE__, false);
     3172            PrepareToExitPlayer(mctx, __LINE__);
    31663173            SetExitPlayer(true, true);
    31673174        }
    31683175    }
     
    38673897    else if (has_action("ESCAPE", actions) && isnearend)
    38683898    {
    38693899        requestDelete = false;
    3870         PrepareToExitPlayer(actx, __LINE__, false);
     3900        PrepareToExitPlayer(actx, __LINE__);
    38713901        SetExitPlayer(true, true);
    38723902    }
    38733903    else if (has_action("SELECT", actions)  ||
     
    39323962                    DoTogglePause(actx, true);
    39333963                    break;
    39343964                case 1:
    3935                     PrepareToExitPlayer(actx, __LINE__);
     3965                    PrepareToExitPlayer(actx, __LINE__, kBookmarkAlways);
    39363966                    SetExitPlayer(true, true);
    39373967                    break;
    39383968                case 3:
     
    39413971                        actx, tr("Delete this recording?"));
    39423972                    return handled;
    39433973                default:
    3944                     PrepareToExitPlayer(actx, __LINE__, false);
     3974                    PrepareToExitPlayer(actx, __LINE__, kBookmarkNever);
    39453975                    SetExitPlayer(true, true);
    39463976                    break;
    39473977            }
     
    39663996                default:
    39673997                    if (isnearend)
    39683998                    {
    3969                         PrepareToExitPlayer(actx, __LINE__, false);
     3999                        PrepareToExitPlayer(actx, __LINE__);
    39704000                        SetExitPlayer(true, true);
    39714001                    }
    39724002                    else
     
    44454475                PromptStopWatchingRecording(ctx);
    44464476                return handled;
    44474477            }
    4448             PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 2);
     4478            PrepareToExitPlayer(ctx, __LINE__);
    44494479            requestDelete = false;
    44504480            do_exit = true;
    44514481        }
     
    87838817        for (uint i = 0; mctx && (i < player.size()); i++)
    87848818        {
    87858819            PlayerContext *ctx = GetPlayer(mctx, i);
    8786             PrepareToExitPlayer(ctx, __LINE__, db_playback_exit_prompt == 1 ||
    8787                                                db_playback_exit_prompt == 2);
     8820            PrepareToExitPlayer(ctx, __LINE__);
    87888821        }
    87898822
    87908823        SetExitPlayer(true, true);