Ticket #3794: 3794-v1.patch

File 3794-v1.patch, 3.5 KB (added by danielk, 18 years ago)
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    424424            .arg(speed,5,'f',1).arg(normal).arg(unpauseaudio));
    425425
    426426    internalPauseLock.lock();
     427    if (editmode)
     428    {
     429        internalPauseLock.unlock();
     430        VERBOSE(VB_IMPORTANT, LOC + "Ignoring Play(), in edit mode.");
     431        return false;
     432    }
    427433    UnpauseVideo();
    428434    internalPauseLock.unlock();
    429435
     
    439445    return true;
    440446}
    441447
    442 bool NuppelVideoPlayer::GetPause(void) const
     448bool NuppelVideoPlayer::IsPaused(bool *is_pause_still_possible) const
    443449{
    444     return (actuallypaused &&
    445             (ringBuffer == NULL || ringBuffer->isPaused()) &&
    446             (audioOutput == NULL || audioOutput->GetPause()) &&
     450    bool rbf_playing = (ringBuffer != NULL) && !ringBuffer->isPaused();
     451    bool aud_playing = (audioOutput != NULL) && !audioOutput->GetPause();
     452    if (is_pause_still_possible)
     453    {
     454        bool decoder_pausing = (0.0f == next_play_speed) && !next_normal_speed;
     455        bool video_pausing = pausevideo;
     456        bool rbuf_paused = !rbf_playing;
     457        *is_pause_still_possible =
     458            decoder_pausing && video_pausing && rbuf_paused;
     459    }
     460
     461    return (actuallypaused && !rbf_playing && !aud_playing &&
    447462            IsVideoActuallyPaused());
    448463}
    449464
     
    44434458    if (alreadyediting)
    44444459        return false;
    44454460
    4446     if (GetPause())
    4447         osd->EndStatus();
     4461    // lock internal pause lock so that is_pause is definately still
     4462    // valid when we enter pause wait loop.
     4463    internalPauseLock.lock();
     4464    bool is_paused = IsPaused();
     4465    if (is_paused)
     4466        osd->EndStatus(); // hide pause OSD
    44484467
    44494468    editmode = true;
    4450     Pause();
    4451     while (!GetPause())
    4452         usleep(1000);
     4469    bool pause_possible = false;
     4470    while (!is_paused)
     4471    {
     4472        if (!pause_possible)
     4473        {
     4474            internalPauseLock.unlock();
     4475            Pause(true);
     4476            internalPauseLock.lock();
     4477        }
     4478        is_paused = IsPaused(&pause_possible);
     4479        usleep(5000);
     4480    }
     4481    // safe to unlock now, play won't start with editmode enabled
     4482    internalPauseLock.unlock();
    44534483
    44544484    seekamount = keyframedist;
    44554485    seekamountpos = 3;
  • libs/libmythtv/NuppelVideoPlayer.h

     
    236236    void Pause(bool waitvideo = true);
    237237    bool Play(float speed = 1.0, bool normal = true,
    238238              bool unpauseaudio = true);
    239     bool GetPause(void) const;
     239    bool IsPaused(bool *is_pause_still_possible = NULL) const;
    240240
    241241    // Seek stuff
    242242    bool FastForward(float seconds);
  • libs/libmythtv/ivtvdecoder.cpp

     
    9999            videoout->Play();
    100100        else
    101101        {
    102             if (GetNVP()->GetPause())
     102            if (GetNVP()->IsPaused())
    103103            {
    104104                videoout->Pause();
    105105                do
     
    669669{
    670670    long long number = desiredFrame - videoPlayed;
    671671
    672     if (GetNVP()->GetPause() && number < keyframedist)
     672    if (GetNVP()->IsPaused() && number < keyframedist)
    673673    {
    674674        StepFrames(videoPlayed, number+1);
    675675        framesPlayed = desiredFrame + 1;