ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

grim/movie/movie.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_MOVIE_PLAYER_H
00024 #define GRIM_MOVIE_PLAYER_H
00025 
00026 #include "common/mutex.h"
00027 #include "common/system.h"
00028 
00029 #include "video/video_decoder.h"
00030 
00031 namespace Grim {
00032 
00033 class SaveGame;
00034 
00035 class MoviePlayer {
00036 protected:
00037     Common::String _fname;
00038     Common::Mutex _frameMutex;
00039     Video::VideoDecoder *_videoDecoder;     //< Initialize this to your needed subclass of VideoDecoder in the constructor
00040     const Graphics::Surface *_internalSurface;
00041     Graphics::Surface *_externalSurface;
00042     int32 _frame;
00043     bool _updateNeeded;
00044     bool _showSubtitles;
00045     float _movieTime;
00046     int _channels;
00047     int _freq;
00048     bool _videoFinished;
00049     bool _videoPause;
00050     bool _videoLooping;
00051     bool _timerStarted;
00052     int _x, _y;
00053 
00054 public:
00055     MoviePlayer();
00056     virtual ~MoviePlayer();
00057 
00070     virtual bool play(const Common::String &filename, bool looping, int x, int y, bool start = true, bool showSubtitles = false);
00071     virtual void stop();
00072     virtual void pause(bool p);
00073     virtual bool isPlaying() { return !_videoFinished; }
00074     virtual bool isUpdateNeeded() { return _updateNeeded; }
00075     virtual Graphics::Surface *getDstSurface();
00076     virtual int getX() { return _x; }
00077     virtual int getY() { return _y; }
00078     virtual int getFrame() { return _frame; }
00079     virtual void clearUpdateNeeded() { _updateNeeded = false; }
00080     virtual int32 getMovieTime() { return (int32)_movieTime; }
00081 
00086     void saveState(SaveGame *state);
00087     void restoreState(SaveGame *state);
00088 
00089 protected:
00090     static void timerCallback(void *ptr);
00098     virtual bool prepareFrame();
00099 
00110     virtual void handleFrame() {};
00111 
00122     virtual void postHandleFrame() {};
00123 
00132     virtual void init();
00133 
00140     virtual void deinit();
00141 
00150     virtual bool loadFile(const Common::String &filename);
00151 
00159     virtual void save(SaveGame *state) {}
00160 
00168     virtual void restore(SaveGame *state) {}
00169 };
00170 
00171 
00172 // Factory-like functions:
00173 
00174 MoviePlayer *CreateMpegPlayer();
00175 MoviePlayer *CreateSmushPlayer(bool demo);
00176 MoviePlayer *CreateBinkPlayer(bool demo);
00177 MoviePlayer *CreateQuickTimePlayer();
00178 extern MoviePlayer *g_movie;
00179 
00180 } // end of namespace Grim
00181 
00182 #endif


Generated on Sat Feb 16 2019 05:00:58 for ResidualVM by doxygen 1.7.1
curved edge   curved edge