MovieDecoders shouldn't need TEXTUREMAN.

This commit is contained in:
Glenn Maynard
2005-10-21 01:32:39 +00:00
parent 99eb66b31b
commit 073d9e5290
5 changed files with 10 additions and 14 deletions
@@ -3,7 +3,6 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageTextureManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageFile.h" #include "RageFile.h"
#include "RageSurface.h" #include "RageSurface.h"
@@ -128,13 +127,11 @@ static int FindCompatibleAVFormat( bool bHighColor )
return -1; return -1;
} }
RageSurface *MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, int &iAVTexfmt ) RageSurface *MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt )
{ {
FixLilEndian(); FixLilEndian();
bool bPreferHighColor = (TEXTUREMAN->GetPrefs().m_iMovieColorDepth == 32);
int iAVTexfmtIndex = FindCompatibleAVFormat( bPreferHighColor ); int iAVTexfmtIndex = FindCompatibleAVFormat( bPreferHighColor );
if( iAVTexfmtIndex == -1 ) if( iAVTexfmtIndex == -1 )
iAVTexfmtIndex = FindCompatibleAVFormat( !bPreferHighColor ); iAVTexfmtIndex = FindCompatibleAVFormat( !bPreferHighColor );
@@ -174,7 +171,7 @@ public:
int GetWidth() const { return m_pStream->codec.width; } int GetWidth() const { return m_pStream->codec.width; }
int GetHeight() const { return m_pStream->codec.height; } int GetHeight() const { return m_pStream->codec.height; }
RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight ); RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor );
float GetTimestamp() const; float GetTimestamp() const;
float GetFrameDuration() const; float GetFrameDuration() const;
@@ -579,9 +576,9 @@ void MovieDecoder_FFMpeg::Close()
} }
RageSurface *MovieDecoder_FFMpeg::CreateCompatibleSurface( int iTextureWidth, int iTextureHeight ) RageSurface *MovieDecoder_FFMpeg::CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor )
{ {
return MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( iTextureWidth, iTextureHeight, (int&) m_AVTexfmt ); return MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( iTextureWidth, iTextureHeight, bPreferHighColor, (int&) m_AVTexfmt );
} }
MovieTexture_FFMpeg::MovieTexture_FFMpeg( RageTextureID ID ): MovieTexture_FFMpeg::MovieTexture_FFMpeg( RageTextureID ID ):
@@ -13,7 +13,7 @@ class MovieTexture_FFMpeg: public MovieTexture_Generic
public: public:
MovieTexture_FFMpeg( RageTextureID ID ); MovieTexture_FFMpeg( RageTextureID ID );
static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, int &iAVTexfmt ); static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt );
}; };
#define USE_MOVIE_TEXTURE_FFMPEG #define USE_MOVIE_TEXTURE_FFMPEG
@@ -119,7 +119,7 @@ void MovieTexture_Generic::CreateTexture()
m_iTextureHeight = power_of_two( m_iImageHeight ); m_iTextureHeight = power_of_two( m_iImageHeight );
if( m_pSurface == NULL ) if( m_pSurface == NULL )
m_pSurface = m_pDecoder->CreateCompatibleSurface( m_iTextureWidth, m_iTextureHeight ); m_pSurface = m_pDecoder->CreateCompatibleSurface( m_iTextureWidth, m_iTextureHeight, TEXTUREMAN->GetPrefs().m_iMovieColorDepth == 32 );
PixelFormat pixfmt = DISPLAY->FindPixelFormat( m_pSurface->format->BitsPerPixel, PixelFormat pixfmt = DISPLAY->FindPixelFormat( m_pSurface->format->BitsPerPixel,
m_pSurface->format->Mask[0], m_pSurface->format->Mask[0],
@@ -36,7 +36,7 @@ public:
* The given size will usually be the next power of two higher than * The given size will usually be the next power of two higher than
* GetWidth/GetHeight, but on systems with limited texture resolution, * GetWidth/GetHeight, but on systems with limited texture resolution,
* may be smaller. */ * may be smaller. */
virtual RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight ) = 0; virtual RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor ) = 0;
/* The following functions return information about the current frame, /* The following functions return information about the current frame,
* decoded by the last successful call to GetFrame, and will never be * decoded by the last successful call to GetFrame, and will never be
@@ -4,7 +4,6 @@
#include "RageFile.h" #include "RageFile.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageSurface.h" #include "RageSurface.h"
#include "RageTextureManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "MovieTexture_FFMpeg.h" /* for AVCodecCreateCompatibleSurface */ #include "MovieTexture_FFMpeg.h" /* for AVCodecCreateCompatibleSurface */
@@ -30,7 +29,7 @@ public:
void Close(); void Close();
int GetFrame(); int GetFrame();
RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight ); RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor );
void ConvertToSurface( RageSurface *pSurface ) const; void ConvertToSurface( RageSurface *pSurface ) const;
int GetWidth() const { return m_TheoraInfo.frame_width; } int GetWidth() const { return m_TheoraInfo.frame_width; }
@@ -222,9 +221,9 @@ int MovieDecoder_Theora::GetFrame()
} }
} }
RageSurface *MovieDecoder_Theora::CreateCompatibleSurface( int iTextureWidth, int iTextureHeight ) RageSurface *MovieDecoder_Theora::CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor )
{ {
return MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( iTextureWidth, iTextureHeight, (int&) m_OutputPixFmt ); return MovieTexture_FFMpeg::AVCodecCreateCompatibleSurface( iTextureWidth, iTextureHeight, bPreferHighColor, (int&) m_OutputPixFmt );
} }
void MovieDecoder_Theora::ConvertToSurface( RageSurface *pSurface ) const void MovieDecoder_Theora::ConvertToSurface( RageSurface *pSurface ) const