AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) { _videoSurface = nullptr; _streamCount = 0; _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; _framePixels = nullptr; _priorFrameTime = 0; // Reset current frame. We need to keep track of frames separately from the decoder, // since it needs to be able to go beyond the frame count or to negative to allow // correct detection of when range playbacks have finished _currentFrame = -1; _priorFrame = -1; _isReversed = false; // Create a decoder _decoder = new AVIDecoder(Audio::Mixer::kPlainSoundType); if (!_decoder->loadFile(_movieName)) error("Could not open video - %s", key.getString().c_str()); _streamCount = _decoder->videoTrackCount(); _soundManager = nullptr; _hasAudio = false; _frameRate = 0.0; }
AVISurface::AVISurface(const CResourceKey &key) { _videoSurface = nullptr; _streamCount = 0; _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; // Reset current frame. We need to keep track of frames separately from the decoders, // since it needs to be able to go beyond the frame count or to negative to allow // correct detection of when range playbacks have finished _currentFrame = -1; _isReversed = false; // Create a decoder for the audio (if any) and primary video track _decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); if (!_decoders[0]->loadFile(key.getString())) error("Could not open video - %s", key.getString().c_str()); _streamCount = 1; // Create a decoder for any secondary video track AVIDecoder *decoder2 = new AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect); if (decoder2->loadFile(key.getString())) { _decoders[1] = decoder2; ++_streamCount; } else { delete decoder2; _decoders[1] = nullptr; } }
void CMouseCursor::loadCursorImages() { const CResourceKey key("ycursors.avi"); g_vm->_filesManager->fn4(key.getString()); // Iterate through getting each cursor for (int idx = 0; idx < NUM_CURSORS; ++idx) { assert(CURSOR_DATA[idx][0] == (idx + 1)); _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], CURSOR_DATA[idx][3]); // Create the surface CVideoSurface *surface = _screenManager->createSurface(64, 64); _cursors[idx]._videoSurface = surface; // Open the cursors video and move to the given frame OSMovie movie(key, surface); movie.setFrame(idx); Graphics::ManagedSurface *frameSurface = movie.duplicateFrame(); _cursors[idx]._frameSurface = frameSurface; surface->setMovieFrameSurface(frameSurface); } }