_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

movie.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 2002-2005 by Lutz Sammer
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __MOVIE_H__
31 #define __MOVIE_H__
32 
34 
35 #include "SDL.h"
36 #include "guichan.h"
37 #ifdef USE_VORBIS
38 
39 /*----------------------------------------------------------------------------
40 -- Documentation
41 ----------------------------------------------------------------------------*/
42 
43 /*----------------------------------------------------------------------------
44 -- Includes
45 ----------------------------------------------------------------------------*/
46 
47 #include "ogg/ogg.h"
48 #include "vorbis/codec.h"
49 #ifdef USE_THEORA
50 #include "theora/theora.h"
51 #endif
52 
53 /*----------------------------------------------------------------------------
54 -- Declarations
55 ----------------------------------------------------------------------------*/
56 
57 class CFile;
58 
62 struct OggData {
64  ogg_sync_state sync;
65  ogg_page page;
66 
67  ogg_stream_state astream;
68  vorbis_info vinfo;
69  vorbis_comment vcomment;
70  vorbis_block vblock;
71  vorbis_dsp_state vdsp;
72 
73 #ifdef USE_THEORA
74  ogg_stream_state vstream;
75  theora_info tinfo;
76  theora_comment tcomment;
77  theora_state tstate;
78 #endif
79 
80  int audio : 1;
81 #ifdef USE_THEORA
82  int video : 1;
83 #endif
84 };
85 
86 #ifdef USE_THEORA
87 class Movie : public gcn::Image
88 {
89 public:
90  Movie() : rect(NULL), yuv_overlay(NULL), surface(NULL), need_data(true), start_time(0),
91  is_dirty(true), Width(0), Height(0), data(NULL), f(NULL) {};
92  ~Movie();
93  bool Load(const std::string &filename, int w, int h);
94  bool IsPlaying() const { return is_dirty; }
95 
96  //guichan
97  virtual void *_getData() const;
98  virtual int getWidth() const { return Width; }
99  virtual int getHeight() const { return Height; }
100  virtual bool isDirty() const { return is_dirty; }
101 
102  int Width;
103  int Height;
104  SDL_Surface *surface;
106  mutable bool is_dirty;
107  mutable bool need_data;
108  mutable Uint32 start_time;
109  mutable OggData *data;
110  mutable SDL_Rect *rect;
111  mutable SDL_Texture *yuv_overlay;
112 };
113 #endif
114 
115 /*----------------------------------------------------------------------------
116 -- Variables
117 ----------------------------------------------------------------------------*/
118 
119 /*----------------------------------------------------------------------------
120 -- Functions
121 ----------------------------------------------------------------------------*/
122 
123 extern int OggInit(CFile *f, OggData *data);
124 extern void OggFree(OggData *data);
125 extern int OggGetNextPage(ogg_page *page, ogg_sync_state *sync, CFile *f);
126 
127 extern int VorbisProcessData(OggData *data, char *buffer);
128 
129 #endif // USE_VORBIS
130 
131 #ifndef USE_THEORA
132 class Movie : public gcn::Image
134 {
135 public:
136  Movie() {};
137  ~Movie() {};
138  bool Load(const std::string &filename, int w, int h) { return false; };
139  bool IsPlaying() const { return false; };
140  //guichan
141  virtual void *_getData() const { return NULL; };
142  virtual int getWidth() const { return 0; };
143  virtual int getHeight() const { return 0; };
144  virtual bool isDirty() const { return false; };
145 };
146 #endif
147 
149 extern int PlayMovie(const std::string &name);
150 
152 
153 #endif // !__MOVIE_H__
Movie::need_data
bool need_data
Definition: movie.h:107
Movie::~Movie
~Movie()
Definition: movie.cpp:431
OggData::tcomment
theora_comment tcomment
Definition: movie.h:76
Movie::getWidth
virtual int getWidth() const
Definition: movie.h:98
OggData::vstream
ogg_stream_state vstream
Definition: movie.h:74
OggData::page
ogg_page page
Definition: movie.h:65
Movie::start_time
Uint32 start_time
Definition: movie.h:108
OggData
Definition: movie.h:62
Movie::Height
int Height
Definition: movie.h:103
OggData::vblock
vorbis_block vblock
Definition: movie.h:70
Movie::Width
int Width
Definition: movie.h:102
Movie::yuv_overlay
SDL_Texture * yuv_overlay
Definition: movie.h:111
OggData::File
CFile * File
Definition: movie.h:63
Movie::is_dirty
bool is_dirty
Definition: movie.h:106
OggData::video
int video
Definition: movie.h:82
Movie::IsPlaying
bool IsPlaying() const
Definition: movie.h:94
OggData::sync
ogg_sync_state sync
Ogg file handle.
Definition: movie.h:64
gcn::Image
Definition: image.h:76
OggFree
void OggFree(OggData *data)
Definition: movie.cpp:211
Movie::Movie
Movie()
Definition: movie.h:90
guichan.h
Movie::Load
bool Load(const std::string &filename, int w, int h)
Definition: movie.cpp:483
Movie::rect
SDL_Rect * rect
Definition: movie.h:110
Movie::_getData
virtual void * _getData() const
Definition: movie.cpp:516
OggData::audio
int audio
Definition: movie.h:80
PlayMovie
int PlayMovie(const std::string &name)
Play a movie file.
Definition: movie.cpp:310
Movie::data
OggData * data
Definition: movie.h:109
update-images.w
w
Definition: update-images.py:53
Movie::isDirty
virtual bool isDirty() const
Definition: movie.h:100
Movie::f
CFile * f
Definition: movie.h:105
OggGetNextPage
int OggGetNextPage(ogg_page *page, ogg_sync_state *sync, CFile *f)
Definition: movie.cpp:73
OggData::vcomment
vorbis_comment vcomment
Definition: movie.h:69
Movie
Definition: movie.h:87
VorbisProcessData
int VorbisProcessData(OggData *data, char *buffer)
OggData::vdsp
vorbis_dsp_state vdsp
Definition: movie.h:71
OggInit
int OggInit(CFile *f, OggData *data)
Definition: movie.cpp:90
OggData::tstate
theora_state tstate
Definition: movie.h:77
update-images.h
h
Definition: update-images.py:53
OggData::astream
ogg_stream_state astream
Definition: movie.h:67
Movie::getHeight
virtual int getHeight() const
Definition: movie.h:99
OggData::vinfo
vorbis_info vinfo
Definition: movie.h:68
OggData::tinfo
theora_info tinfo
Definition: movie.h:75
CFile
Definition: iolib.h:102
Movie::surface
SDL_Surface * surface
Definition: movie.h:104
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.