DIRECTOR: Add initial code for QuickTime video

This commit is contained in:
Dmitry Iskrich 2016-06-18 18:31:20 +03:00 committed by Eugene Sandulenko
parent 5bbfea01fe
commit f675f9be93
5 changed files with 124 additions and 4 deletions

View File

@ -87,11 +87,11 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive(); _mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm"); _mainArchive->openFile("bookshelf_example.mmm");
Score score(this); _currentScore = new Score(this);
debug(0, "Score name %s", score.getMacName().c_str()); debug(0, "Score name %s", _currentScore->getMacName().c_str());
score.loadArchive(); _currentScore->loadArchive();
score.startLoop(); _currentScore->startLoop();
if (getPlatform() == Common::kPlatformWindows) if (getPlatform() == Common::kPlatformWindows)
loadEXE(); loadEXE();

View File

@ -61,6 +61,7 @@ public:
DirectorSound *getSoundManager() const { return _soundManager; } DirectorSound *getSoundManager() const { return _soundManager; }
Archive *getMainArchive() const { return _mainArchive; } Archive *getMainArchive() const { return _mainArchive; }
Lingo *getLingo() const { return _lingo; } Lingo *getLingo() const { return _lingo; }
Score *getCurrentScore() const { return _currentScore; }
void setPalette(byte *palette, uint16 count); void setPalette(byte *palette, uint16 count);
bool hasFeature(EngineFeature f) const; bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; } const byte *getPalette() const { return _currentPalette; }
@ -89,6 +90,7 @@ private:
byte *_currentPalette; byte *_currentPalette;
uint16 _currentPaletteLength; uint16 _currentPaletteLength;
Lingo *_lingo; Lingo *_lingo;
Score *_currentScore;
}; };
} // End of namespace Director } // End of namespace Director

View File

@ -4,6 +4,7 @@ MODULE_OBJS = \
detection.o \ detection.o \
dib.o \ dib.o \
director.o \ director.o \
movie.o \
resource.o \ resource.o \
score.o \ score.o \
sound.o \ sound.o \

View File

@ -0,0 +1,66 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1995-1997 Presto Studios, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "video/qt_decoder.h"
#include "director/movie.h"
#include "director/score.h"
#include "common/debug.h"
#include "common/system.h"
namespace Director {
Movie::Movie(Common::String fileName, DirectorEngine *vm) {
_vm = vm;
_currentVideo = new Video::QuickTimeDecoder();
if (!_currentVideo->loadFile(fileName)) {
warning("Can not open file %s", fileName.c_str());
return;
}
}
void Movie::play(Common::Point dest) {
_currentVideo->start();
uint16 width = _currentVideo->getWidth();
uint16 height = _currentVideo->getHeight();
while (!_currentVideo->endOfVideo()) {
if (_currentVideo->needsUpdate()) {
const Graphics::Surface *frame = _currentVideo->decodeNextFrame();
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, dest.x, dest.y, width, height);
g_system->updateScreen();
}
g_system->delayMillis(10);
_vm->getCurrentScore()->processEvents();
}
}
void Movie::stop() {
_currentVideo->stop();
}
Movie::~Movie() {
delete _currentVideo;
}
} //End of namespace Director

51
engines/director/movie.h Normal file
View File

@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1995-1997 Presto Studios, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef DIRECTOR_MOVIE_H
#define DIRECTOR_MOVIE_H
#include "common/str.h"
#include "common/rect.h"
#include "graphics/managed_surface.h"
#include "director/director.h"
namespace Video {
class VideoDecoder;
}
namespace Director {
class Movie {
public:
Movie(Common::String fileName, DirectorEngine *vm);
~Movie();
void play(Common::Point dest);
void stop();
private:
Video::VideoDecoder *_currentVideo;
DirectorEngine *_vm;
};
} //End of namespace Director
#endif