Skip to content

Commit

Permalink
DIRECTOR: Add initial code for QuickTime video
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent 5bbfea0 commit f675f9b
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 4 deletions.
8 changes: 4 additions & 4 deletions engines/director/director.cpp
Expand Up @@ -87,11 +87,11 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");

Score score(this);
debug(0, "Score name %s", score.getMacName().c_str());
_currentScore = new Score(this);
debug(0, "Score name %s", _currentScore->getMacName().c_str());

score.loadArchive();
score.startLoop();
_currentScore->loadArchive();
_currentScore->startLoop();

if (getPlatform() == Common::kPlatformWindows)
loadEXE();
Expand Down
2 changes: 2 additions & 0 deletions engines/director/director.h
Expand Up @@ -61,6 +61,7 @@ class DirectorEngine : public ::Engine {
DirectorSound *getSoundManager() const { return _soundManager; }
Archive *getMainArchive() const { return _mainArchive; }
Lingo *getLingo() const { return _lingo; }
Score *getCurrentScore() const { return _currentScore; }
void setPalette(byte *palette, uint16 count);
bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; }
Expand Down Expand Up @@ -89,6 +90,7 @@ class DirectorEngine : public ::Engine {
byte *_currentPalette;
uint16 _currentPaletteLength;
Lingo *_lingo;
Score *_currentScore;
};

} // End of namespace Director
Expand Down
1 change: 1 addition & 0 deletions engines/director/module.mk
Expand Up @@ -4,6 +4,7 @@ MODULE_OBJS = \
detection.o \
dib.o \
director.o \
movie.o \
resource.o \
score.o \
sound.o \
Expand Down
66 changes: 66 additions & 0 deletions engines/director/movie.cpp
@@ -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 changes: 51 additions & 0 deletions engines/director/movie.h
@@ -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

0 comments on commit f675f9b

Please sign in to comment.