aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/video
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-15 00:43:09 +0200
committerEinar Johan Trøan Sømåen2012-06-15 00:43:09 +0200
commitcac5db7dfe58cf8f353d13d02fdd4be1452490d9 (patch)
treec13a4ed1081063b36326e3321d248710c93e3338 /engines/wintermute/video
parenta488db8f93f37f79123226fdd561ba78578822f5 (diff)
downloadscummvm-rg350-cac5db7dfe58cf8f353d13d02fdd4be1452490d9.tar.gz
scummvm-rg350-cac5db7dfe58cf8f353d13d02fdd4be1452490d9.tar.bz2
scummvm-rg350-cac5db7dfe58cf8f353d13d02fdd4be1452490d9.zip
WINTERMUTE: Clean up and refactor VidTheoraPlayer a bit.
Diffstat (limited to 'engines/wintermute/video')
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.cpp121
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.h78
2 files changed, 96 insertions, 103 deletions
diff --git a/engines/wintermute/video/VidTheoraPlayer.cpp b/engines/wintermute/video/VidTheoraPlayer.cpp
index 991286c56c..ca9287afb8 100644
--- a/engines/wintermute/video/VidTheoraPlayer.cpp
+++ b/engines/wintermute/video/VidTheoraPlayer.cpp
@@ -1,20 +1,30 @@
-// Copyright 2009, 2010 Jan Nedoma
-//
-// This file is part of Wintermute Engine.
-//
-// Wintermute Engine is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Wintermute Engine 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 Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with Wintermute Engine. If not, see <http://www.gnu.org/licenses/>.
-//////////////////////////////////////////////////////////////////////////
+/* 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
#include "engines/wintermute/dcgf.h"
@@ -318,6 +328,7 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
//////////////////////////////////////////////////////////////////////////
HRESULT CVidTheoraPlayer::resetStream() {
+ warning("VidTheoraPlayer::resetStream - stubbed");
#if 0
if (_sound) _sound->Stop();
@@ -329,59 +340,59 @@ HRESULT CVidTheoraPlayer::resetStream() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeGame, bool FreezeMusic, bool Looping, uint32 StartTime, float ForceZoom, int Volume) {
- if (ForceZoom < 0.0f)
- ForceZoom = 100.0f;
- if (Volume < 0)
+HRESULT CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) {
+ if (forceZoom < 0.0f)
+ forceZoom = 100.0f;
+ if (volume < 0)
_volume = Game->_soundMgr->getVolumePercent(SOUND_SFX);
- else _volume = Volume;
+ else _volume = volume;
- _freezeGame = FreezeGame;
+ _freezeGame = freezeGame;
if (!_playbackStarted && _freezeGame)
- Game->Freeze(FreezeMusic);
+ Game->Freeze(freezeMusic);
_playbackStarted = false;
- float Width, Height;
+ float width, height;
if (_theoraDecoder) {
_surface.copyFrom(*_theoraDecoder->decodeNextFrame());
_state = THEORA_STATE_PLAYING;
- _looping = Looping;
- _playbackType = Type;
-
- _startTime = StartTime;
- _volume = Volume;
- _posX = X;
- _posY = Y;
- _playZoom = ForceZoom;
+ _looping = looping;
+ _playbackType = type;
+
+ _startTime = startTime;
+ _volume = volume;
+ _posX = x;
+ _posY = y;
+ _playZoom = forceZoom;
- Width = (float)_theoraDecoder->getWidth();
- Height = (float)_theoraDecoder->getHeight();
+ width = (float)_theoraDecoder->getWidth();
+ height = (float)_theoraDecoder->getHeight();
} else {
- Width = (float)Game->_renderer->_width;
- Height = (float)Game->_renderer->_height;
+ width = (float)Game->_renderer->_width;
+ height = (float)Game->_renderer->_height;
}
- switch (Type) {
+ switch (type) {
case VID_PLAY_POS:
- _playZoom = ForceZoom;
- _posX = X;
- _posY = Y;
+ _playZoom = forceZoom;
+ _posX = x;
+ _posY = y;
break;
case VID_PLAY_STRETCH: {
- float ZoomX = (float)((float)Game->_renderer->_width / Width * 100);
- float ZoomY = (float)((float)Game->_renderer->_height / Height * 100);
+ float ZoomX = (float)((float)Game->_renderer->_width / width * 100);
+ float ZoomY = (float)((float)Game->_renderer->_height / height * 100);
_playZoom = MIN(ZoomX, ZoomY);
- _posX = (Game->_renderer->_width - Width * (_playZoom / 100)) / 2;
- _posY = (Game->_renderer->_height - Height * (_playZoom / 100)) / 2;
+ _posX = (Game->_renderer->_width - width * (_playZoom / 100)) / 2;
+ _posY = (Game->_renderer->_height - height * (_playZoom / 100)) / 2;
}
break;
case VID_PLAY_CENTER:
_playZoom = 100.0f;
- _posX = (Game->_renderer->_width - Width) / 2;
- _posY = (Game->_renderer->_height - Height) / 2;
+ _posX = (Game->_renderer->_width - width) / 2;
+ _posY = (Game->_renderer->_height - height) / 2;
break;
}
return S_OK;
@@ -633,19 +644,19 @@ void CVidTheoraPlayer::writeAlpha() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::display(uint32 Alpha) {
+HRESULT CVidTheoraPlayer::display(uint32 alpha) {
RECT rc;
- HRESULT Res;
+ HRESULT res;
if (_texture && _videoFrameReady) {
CBPlatform::SetRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight());
- if (_playZoom == 100.0f) Res = _texture->displayTrans(_posX, _posY, rc, Alpha);
- else Res = _texture->displayTransZoom(_posX, _posY, rc, _playZoom, _playZoom, Alpha);
- } else Res = E_FAIL;
+ if (_playZoom == 100.0f) res = _texture->displayTrans(_posX, _posY, rc, alpha);
+ else res = _texture->displayTransZoom(_posX, _posY, rc, _playZoom, _playZoom, alpha);
+ } else res = E_FAIL;
#if 0
if (m_Subtitler && Game->m_VideoSubtitles) m_Subtitler->Display();
#endif
- return Res;
+ return res;
}
//////////////////////////////////////////////////////////////////////////
@@ -680,8 +691,8 @@ HRESULT CVidTheoraPlayer::setAlphaImage(const Common::String &filename) {
}
//////////////////////////////////////////////////////////////////////////
-byte CVidTheoraPlayer::getAlphaAt(int X, int Y) {
- if (_alphaImage) return _alphaImage->getAlphaAt(X, Y);
+byte CVidTheoraPlayer::getAlphaAt(int x, int y) {
+ if (_alphaImage) return _alphaImage->getAlphaAt(x, y);
else return 0xFF;
}
diff --git a/engines/wintermute/video/VidTheoraPlayer.h b/engines/wintermute/video/VidTheoraPlayer.h
index fc89b07c53..b679cbe428 100644
--- a/engines/wintermute/video/VidTheoraPlayer.h
+++ b/engines/wintermute/video/VidTheoraPlayer.h
@@ -1,21 +1,30 @@
-// Copyright 2009, 2010 Jan Nedoma
-//
-// This file is part of Wintermute Engine.
-//
-// Wintermute Engine is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Wintermute Engine 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 Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with Wintermute Engine. If not, see <http://www.gnu.org/licenses/>.
-//////////////////////////////////////////////////////////////////////////
-
+/* 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
#ifndef WINTERMUTE_VIDTHEORAPLAYER_H
#define WINTERMUTE_VIDTHEORAPLAYER_H
@@ -26,7 +35,6 @@
#include "engines/wintermute/Base/BImage.h"
#include "video/video_decoder.h"
#include "common/stream.h"
-//#include <theora/theora.h>
namespace WinterMute {
@@ -46,36 +54,10 @@ public:
CVidTheoraPlayer(CBGame *inGame);
virtual ~CVidTheoraPlayer(void);
- // Vorbis/Theora structs
- /*ogg_sync_state m_OggSyncState;
- ogg_page m_OggPage;
- ogg_stream_state m_VorbisStreamState;
- ogg_stream_state m_TheoraStreamState;
-
- theora_info m_TheoraInfo;
- theora_comment m_TheoraComment;
- theora_state m_TheoraState;
-
- vorbis_info m_VorbisInfo;
- vorbis_dsp_state m_VorbisDSPState;
- vorbis_block m_VorbisBlock;
- vorbis_comment m_VorbisComment;
-
- int _theoraStreams;
- int _vorbisStreams;*/
-
- //ogg_int64_t m_AudiobufGranulepos; //time position of last sample
-
-
// external objects
Common::SeekableReadStream *_file;
Common::String _filename;
- //CBSoundTheora *_sound;
- //ogg_int16_t *_audioBuf;
- /*int _audioBufSize;
- int _audioBufFill;*/
-
CBSurface *_texture;
//CVidSubtitler *_subtitler;
@@ -83,9 +65,9 @@ public:
HRESULT initialize(const Common::String &filename, const Common::String &subtitleFile = NULL);
HRESULT initializeSimple();
HRESULT update();
- HRESULT play(TVideoPlayback Type = VID_PLAY_CENTER, int X = 0, int Y = 0, bool FreezeGame = false, bool FreezeMusic = true, bool Looping = false, uint32 StartTime = 0, float ForceZoom = -1.0f, int Volume = -1);
+ HRESULT play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool Looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1);
HRESULT stop();
- HRESULT display(uint32 Alpha = 0xFFFFFFFF);
+ HRESULT display(uint32 alpha = 0xFFFFFFFF);
//HRESULT RenderFrame(CBSurface *Texture, yuv_buffer *yuv);
HRESULT pause();
@@ -117,7 +99,7 @@ public:
CBImage *_alphaImage;
Common::String _alphaFilename;
HRESULT setAlphaImage(const Common::String &filename);
- __inline byte getAlphaAt(int X, int Y);
+ __inline byte getAlphaAt(int x, int y);
void writeAlpha();
HRESULT SeekToTime(uint32 Time);