From e673bd5b95a9e51af2ad94ca0dc607651f53fa9d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 22 Aug 2009 13:11:55 +0000 Subject: Fixing some problems when calling the player with muted output svn-id: r43643 --- graphics/video/coktelvideo/coktelvideo.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'graphics/video') diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 39aeca07bd..b69315cbae 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -362,6 +362,10 @@ void Imd::setDoubleMode(bool doubleMode) { } void Imd::enableSound(Audio::Mixer &mixer) { + // Sanity check + if (mixer.getOutputRate() == 0) + return; + // Only possible on the first frame if (_curFrame > 0) return; @@ -387,7 +391,7 @@ void Imd::disableSound() { } bool Imd::isSoundPlaying() const { - if (_audioStream && _mixer->isSoundHandleActive(_audioHandle)) + if (_audioStream && _mixer && _mixer->isSoundHandleActive(_audioHandle)) return true; return false; @@ -1706,9 +1710,12 @@ CoktelVideo::State Vmd::processFrame(uint16 frame) { } if (startSound && _soundEnabled) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream); - _skipFrames = 0; - _soundStage = 2; + if (_hasSound && _audioStream) { + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream); + _skipFrames = 0; + _soundStage = 2; + } else + _soundStage = 0; } if ((_curFrame == (_framesCount - 1)) && (_soundStage == 2)) { -- cgit v1.2.3