diff options
Diffstat (limited to 'engines/sword25/fmv/oggtheora/moviefile.cpp')
-rw-r--r-- | engines/sword25/fmv/oggtheora/moviefile.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/engines/sword25/fmv/oggtheora/moviefile.cpp b/engines/sword25/fmv/oggtheora/moviefile.cpp index 33c214a1c2..b764ab2d22 100644 --- a/engines/sword25/fmv/oggtheora/moviefile.cpp +++ b/engines/sword25/fmv/oggtheora/moviefile.cpp @@ -47,37 +47,42 @@ #include "sword25/fmv/oggtheora/oggstate.h" #include "sword25/fmv/oggtheora/moviefile.h" -namespace Sword25 { - // ----------------------------------------------------------------------------- -MovieFile::MovieFile(const Common::String &Filename, unsigned int ReadBlockSize, bool &Success) : - m_Data(0), m_Size(0), m_ReadPos(0), m_ReadBlockSize(ReadBlockSize) { - m_Data = reinterpret_cast<char *>(Kernel::GetInstance()->GetPackage()->GetFile(Filename, &m_Size)); - if (!m_Data) { +BS_MovieFile::BS_MovieFile(const std::string & Filename, unsigned int ReadBlockSize, bool & Success) : + m_Data(0), m_Size(0), m_ReadPos(0), m_ReadBlockSize(ReadBlockSize) +{ + m_Data = reinterpret_cast<char *>(BS_Kernel::GetInstance()->GetPackage()->GetFile(Filename, &m_Size)); + if (!m_Data) + { BS_LOG_ERRORLN("Could not load movie file \"%s\".", Filename.c_str()); Success = false; - } else + } + else Success = true; } // ----------------------------------------------------------------------------- -MovieFile::~MovieFile() { +BS_MovieFile::~BS_MovieFile() +{ if (m_Data) delete [] m_Data; } // ----------------------------------------------------------------------------- -int MovieFile::BufferData(OggState &OggState) { - if (!m_Data || !m_Size || m_ReadPos >= m_Size) { +int BS_MovieFile::BufferData(BS_OggState & OggState) +{ + if (!m_Data || !m_Size || m_ReadPos >= m_Size) + { BS_LOG_ERRORLN("Tried to read past the movie buffer's end."); return 0; } // just grab some more compressed bitstream and sync it for page extraction - char *Buffer = OggState.SyncBuffer(m_ReadBlockSize); - if (!Buffer) { + char * Buffer = OggState.SyncBuffer(m_ReadBlockSize); + if (!Buffer) + { BS_LOG_ERRORLN("ogg_sync_buffer() failed."); return 0; } @@ -94,8 +99,7 @@ int MovieFile::BufferData(OggState &OggState) { // ----------------------------------------------------------------------------- -bool MovieFile::IsEOF() const { +bool BS_MovieFile::IsEOF() const +{ return m_ReadPos >= m_Size; } - -} // End of namespace Sword25 |