From 3def328a9a8da2b1ca655aa22b04611d8b1975ee Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 14 Feb 2006 11:40:24 +0000 Subject: [PATCH] spacing --- .../arch/MovieTexture/MovieTexture_DShow.cpp | 84 +++++++++---------- .../MovieTexture/MovieTexture_DShowHelper.cpp | 54 ++++++------ .../MovieTexture/MovieTexture_DShowHelper.h | 4 +- .../arch/MovieTexture/MovieTexture_FFMpeg.cpp | 4 +- .../MovieTexture/MovieTexture_Generic.cpp | 24 +++--- .../arch/MovieTexture/MovieTexture_Null.cpp | 46 +++++----- .../src/arch/MovieTexture/MovieTexture_Null.h | 28 +++---- 7 files changed, 122 insertions(+), 122 deletions(-) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp index 27b0a185e5..6da2563bd2 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp @@ -178,7 +178,7 @@ MovieTexture_DShow::~MovieTexture_DShow() /* Shut down the graph. We can't call Stop() here, since that will * call SkipUpdates again, which will deadlock if we call it twice * in a row. */ - if( m_pGB ) + if( m_pGB ) { LOG->Trace( "MovieTexture_DShow: shutdown" ); LOG->Flush(); @@ -264,7 +264,7 @@ void MovieTexture_DShow::Update(float fDeltaTime) if( m_bLoop ) { // Check for completion events - CComPtr pME; + CComPtr pME; m_pGB.QueryInterface(&pME); long lEventCode, lParam1, lParam2; @@ -325,49 +325,49 @@ RString MovieTexture_DShow::Create() { RageTextureID actualID = GetID(); - HRESULT hr; - + HRESULT hr; + actualID.iAlphaBits = 0; - if( FAILED( hr=CoInitialize(NULL) ) ) - RageException::Throw( hr_ssprintf(hr, "Could not CoInitialize") ); + if( FAILED( hr=CoInitialize(NULL) ) ) + RageException::Throw( hr_ssprintf(hr, "Could not CoInitialize") ); - // Create the filter graph - if( FAILED( hr=m_pGB.CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC) ) ) - RageException::Throw( hr_ssprintf(hr, "Could not create CLSID_FilterGraph!") ); - - // Create the Texture Renderer object - CTextureRenderer *pCTR = new CTextureRenderer; - - /* Get a pointer to the IBaseFilter on the TextureRenderer, and add it to the + // Create the filter graph + if( FAILED( hr=m_pGB.CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC) ) ) + RageException::Throw( hr_ssprintf(hr, "Could not create CLSID_FilterGraph!") ); + + // Create the Texture Renderer object + CTextureRenderer *pCTR = new CTextureRenderer; + + /* Get a pointer to the IBaseFilter on the TextureRenderer, and add it to the * graph. When m_pGB is released, it will free pFTR. */ - CComPtr pFTR = pCTR; - if( FAILED( hr = m_pGB->AddFilter(pFTR, L"TEXTURERENDERER" ) ) ) - RageException::Throw( hr_ssprintf(hr, "Could not add renderer filter to graph!") ); + CComPtr pFTR = pCTR; + if( FAILED( hr = m_pGB->AddFilter(pFTR, L"TEXTURERENDERER" ) ) ) + RageException::Throw( hr_ssprintf(hr, "Could not add renderer filter to graph!") ); - // Add the source filter - CComPtr pFSrc; // Source Filter - wstring wFileName = RStringToWstring(actualID.filename); + // Add the source filter + CComPtr pFSrc; // Source Filter + wstring wFileName = RStringToWstring(actualID.filename); // if this fails, it's probably because the user doesn't have DivX installed /* No, it also happens if the movie can't be opened for some reason; for example, * if another program has it open and locked. Missing codecs probably won't * show up until Connect(). */ - if( FAILED( hr = m_pGB->AddSourceFilter( wFileName.c_str(), wFileName.c_str(), &pFSrc ) ) ) + if( FAILED( hr = m_pGB->AddSourceFilter( wFileName.c_str(), wFileName.c_str(), &pFSrc ) ) ) return PrintCodecError( hr, "Could not create source filter to graph!" ); - - // Find the source's output and the renderer's input - CComPtr pFTRPinIn; // Texture Renderer Input Pin - if( FAILED( hr = pFTR->FindPin( L"In", &pFTRPinIn ) ) ) - return hr_ssprintf(hr, "Could not find input pin" ); - CComPtr pFSrcPinOut; // Source Filter Output Pin - if( FAILED( hr = pFSrc->FindPin( L"Output", &pFSrcPinOut ) ) ) - return hr_ssprintf( hr, "Could not find output pin" ); + // Find the source's output and the renderer's input + CComPtr pFTRPinIn; // Texture Renderer Input Pin + if( FAILED( hr = pFTR->FindPin( L"In", &pFTRPinIn ) ) ) + return hr_ssprintf(hr, "Could not find input pin" ); - // Connect these two filters - if( FAILED( hr = m_pGB->Connect( pFSrcPinOut, pFTRPinIn ) ) ) - return PrintCodecError( hr, "Could not connect pins" ); + CComPtr pFSrcPinOut; // Source Filter Output Pin + if( FAILED( hr = pFSrc->FindPin( L"Output", &pFSrcPinOut ) ) ) + return hr_ssprintf( hr, "Could not find output pin" ); + + // Connect these two filters + if( FAILED( hr = m_pGB->Connect( pFSrcPinOut, pFTRPinIn ) ) ) + return PrintCodecError( hr, "Could not connect pins" ); LOG->Trace( "Filters: %s", GetActiveFilterList().c_str() ); @@ -377,7 +377,7 @@ RString MovieTexture_DShow::Create() /* Cap the max texture size to the hardware max. */ actualID.iMaxSize = min( actualID.iMaxSize, DISPLAY->GetMaxTextureSize() ); - // The graph is built, now get the set the output video width and height. + // The graph is built, now get the set the output video width and height. // The source and image width will always be the same since we can't scale the video m_iSourceWidth = pCTR->GetVidWidth(); m_iSourceHeight = pCTR->GetVidHeight(); @@ -406,7 +406,7 @@ RString MovieTexture_DShow::Create() CHECKPOINT; // Start the graph running - Play(); + Play(); return RString(); } @@ -479,12 +479,12 @@ void MovieTexture_DShow::Play() LOG->Trace("MovieTexture_DShow::Play()"); CComPtr pMC; - m_pGB.QueryInterface(&pMC); + m_pGB.QueryInterface(&pMC); - // Start the graph running; + // Start the graph running; HRESULT hr; - if( FAILED(hr = pMC->Run()) ) - RageException::Throw( hr_ssprintf(hr, "Could not run the DirectShow graph.") ); + if( FAILED(hr = pMC->Run()) ) + RageException::Throw( hr_ssprintf(hr, "Could not run the DirectShow graph.") ); m_bPlaying = true; @@ -496,12 +496,12 @@ void MovieTexture_DShow::Pause() SkipUpdates(); CComPtr pMC; - m_pGB.QueryInterface(&pMC); + m_pGB.QueryInterface(&pMC); HRESULT hr; /* Use Pause(), so we'll get a still frame in CTextureRenderer::OnReceiveFirstSample. */ if( FAILED(hr = pMC->Pause()) ) - RageException::Throw( hr_ssprintf(hr, "Could not pause the DirectShow graph.") ); + RageException::Throw( hr_ssprintf(hr, "Could not pause the DirectShow graph.") ); StopSkippingUpdates(); } @@ -512,8 +512,8 @@ void MovieTexture_DShow::SetPosition( float fSeconds ) SkipUpdates(); CComPtr pMP; - m_pGB.QueryInterface(&pMP); - pMP->put_CurrentPosition(0); + m_pGB.QueryInterface(&pMP); + pMP->put_CurrentPosition(0); StopSkippingUpdates(); } diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.cpp index 4d5a679d5d..77d675af76 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.cpp @@ -12,11 +12,11 @@ struct __declspec(uuid("{71771540-2017-11cf-ae26-0020afd79767}")) CLSID_TextureR static HRESULT CBV_ret; CTextureRenderer::CTextureRenderer(): CBaseVideoRenderer(__uuidof(CLSID_TextureRenderer), - NAME("Texture Renderer"), NULL, &CBV_ret), + NAME("Texture Renderer"), NULL, &CBV_ret), m_OneFrameDecoded( "m_OneFrameDecoded", 0 ) { - if( FAILED(CBV_ret) ) - RageException::Throw( hr_ssprintf(CBV_ret, "Could not create texture renderer object!") ); + if( FAILED(CBV_ret) ) + RageException::Throw( hr_ssprintf(CBV_ret, "Could not create texture renderer object!") ); m_pTexture = NULL; } @@ -28,35 +28,35 @@ CTextureRenderer::~CTextureRenderer() HRESULT CTextureRenderer::CheckMediaType(const CMediaType *pmt) { - VIDEOINFO *pvi; - - // Reject the connection if this is not a video type - if( *pmt->FormatType() != FORMAT_VideoInfo ) - return E_INVALIDARG; - + VIDEOINFO *pvi; + + // Reject the connection if this is not a video type + if( *pmt->FormatType() != FORMAT_VideoInfo ) + return E_INVALIDARG; + /* Force the graph to R8G8B8. DirectShow won't generate a FMT_RGB5 that OpenGL * can handle. It's faster to generate FMT8 and let OpenGL convert on the fly * than to generate FMT_RGB5 and convert it ourself. */ - pvi = (VIDEOINFO *)pmt->Format(); - if(IsEqualGUID( *pmt->Type(), MEDIATYPE_Video) && - IsEqualGUID( *pmt->Subtype(), MEDIASUBTYPE_RGB24)) - return S_OK; - - return E_FAIL; + pvi = (VIDEOINFO *)pmt->Format(); + if( IsEqualGUID( *pmt->Type(), MEDIATYPE_Video) && + IsEqualGUID( *pmt->Subtype(), MEDIASUBTYPE_RGB24) ) + return S_OK; + + return E_FAIL; } // SetMediaType: Graph connection has been made. HRESULT CTextureRenderer::SetMediaType(const CMediaType *pmt) { - // Retrive the size of this media type - VIDEOINFO *pviBmp; // Bitmap info header - pviBmp = (VIDEOINFO *)pmt->Format(); - m_lVidWidth = pviBmp->bmiHeader.biWidth; - m_lVidHeight = abs(pviBmp->bmiHeader.biHeight); - m_lVidPitch = (m_lVidWidth * 3 + 3) + ~3; // We are forcing RGB24 + // Retrive the size of this media type + VIDEOINFO *pviBmp; // Bitmap info header + pviBmp = (VIDEOINFO *)pmt->Format(); + m_lVidWidth = pviBmp->bmiHeader.biWidth; + m_lVidHeight = abs(pviBmp->bmiHeader.biHeight); + m_lVidPitch = (m_lVidWidth * 3 + 3) + ~3; // We are forcing RGB24 - return S_OK; + return S_OK; } @@ -74,15 +74,15 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) return S_OK; } - BYTE *pBmpBuffer; // Bitmap buffer + BYTE *pBmpBuffer; // Bitmap buffer - // Get the video bitmap buffer - pSample->GetPointer( &pBmpBuffer ); + // Get the video bitmap buffer + pSample->GetPointer( &pBmpBuffer ); - // Copy the bits + // Copy the bits m_pTexture->NewData((char *) pBmpBuffer); - return S_OK; + return S_OK; } void CTextureRenderer::OnReceiveFirstSample( IMediaSample * pSample ) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.h b/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.h index f4840a0ced..e32df5665d 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShowHelper.h @@ -15,8 +15,8 @@ class CTextureRenderer : public CBaseVideoRenderer { public: - CTextureRenderer(); - ~CTextureRenderer(); + CTextureRenderer(); + ~CTextureRenderer(); HRESULT CheckMediaType( const CMediaType *pmt ); // Format acceptable? HRESULT SetMediaType( const CMediaType *pmt ); // Video format notification diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 70c28ddea1..fb98778194 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -422,10 +422,10 @@ void MovieDecoder_FFMpeg::ConvertToSurface( RageSurface *pSurface ) const static avcodec::AVStream *FindVideoStream( avcodec::AVFormatContext *m_fctx ) { - for( int stream = 0; stream < m_fctx->nb_streams; ++stream ) + for( int stream = 0; stream < m_fctx->nb_streams; ++stream ) { avcodec::AVStream *enc = m_fctx->streams[stream]; - if( enc->codec.codec_type == avcodec::CODEC_TYPE_VIDEO ) + if( enc->codec.codec_type == avcodec::CODEC_TYPE_VIDEO ) return enc; } return NULL; diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Generic.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_Generic.cpp index 59a2000f01..1f57d8396a 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Generic.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Generic.cpp @@ -22,7 +22,7 @@ MovieTexture_Generic::MovieTexture_Generic( RageTextureID ID, MovieDecoder *pDec m_uTexHandle = 0; m_bLoop = true; - m_State = DECODER_QUIT; /* it's quit until we call StartThread */ + m_State = DECODER_QUIT; /* it's quit until we call StartThread */ m_pSurface = NULL; m_ImageWaiting = FRAME_NONE; m_fRate = 1; @@ -93,8 +93,8 @@ void MovieTexture_Generic::DestroyTexture() void MovieTexture_Generic::CreateTexture() { - if( m_uTexHandle ) - return; + if( m_uTexHandle ) + return; CHECKPOINT; @@ -155,7 +155,7 @@ void MovieTexture_Generic::CreateTexture() } } - m_uTexHandle = DISPLAY->CreateTexture( pixfmt, m_pSurface, false ); + m_uTexHandle = DISPLAY->CreateTexture( pixfmt, m_pSurface, false ); } @@ -390,16 +390,16 @@ void MovieTexture_Generic::UpdateFrame() { ASSERT_M( m_ImageWaiting == FRAME_WAITING, ssprintf("%i", m_ImageWaiting) ); - /* Just in case we were invalidated: */ - CreateTexture(); + /* Just in case we were invalidated: */ + CreateTexture(); CHECKPOINT; DISPLAY->UpdateTexture( - m_uTexHandle, - m_pSurface, - 0, 0, - m_iImageWidth, m_iImageHeight ); - CHECKPOINT; + m_uTexHandle, + m_pSurface, + 0, 0, + m_iImageWidth, m_iImageHeight ); + CHECKPOINT; m_ImageWaiting = FRAME_NONE; } @@ -443,7 +443,7 @@ void MovieTexture_Generic::StopThread() void MovieTexture_Generic::SetPosition( float fSeconds ) { - ASSERT( m_State != DECODER_QUIT ); + ASSERT( m_State != DECODER_QUIT ); /* We can reset to 0, but I don't think this API supports fast seeking * yet. I don't think we ever actually seek except to 0 right now, diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp index a53406997a..32e18607c2 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp @@ -9,42 +9,42 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) { - LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)"); - texHandle = 0; + LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)"); + texHandle = 0; - RageTextureID actualID = GetID(); + RageTextureID actualID = GetID(); - actualID.iAlphaBits = 0; + actualID.iAlphaBits = 0; int size = 64; - m_iSourceWidth = size; - m_iSourceHeight = size; - m_iImageWidth = size; - m_iImageHeight = size; - m_iTextureWidth = power_of_two(size); - m_iTextureHeight = m_iTextureWidth; - m_iFramesWide = 1; - m_iFramesHigh = 1; + m_iSourceWidth = size; + m_iSourceHeight = size; + m_iImageWidth = size; + m_iImageHeight = size; + m_iTextureWidth = power_of_two(size); + m_iTextureHeight = m_iTextureWidth; + m_iFramesWide = 1; + m_iFramesHigh = 1; - CreateFrameRects(); + CreateFrameRects(); - PixelFormat pixfmt = PixelFormat_RGBA4; - if( !DISPLAY->SupportsTextureFormat(pixfmt) ) - pixfmt = PixelFormat_RGBA8; - ASSERT( DISPLAY->SupportsTextureFormat(pixfmt) ); + PixelFormat pixfmt = PixelFormat_RGBA4; + if( !DISPLAY->SupportsTextureFormat(pixfmt) ) + pixfmt = PixelFormat_RGBA8; + ASSERT( DISPLAY->SupportsTextureFormat(pixfmt) ); - const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt ); - RageSurface *img = CreateSurface( size, size, pfd->bpp, + const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt ); + RageSurface *img = CreateSurface( size, size, pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] ); - memset( img->pixels, 0, img->pitch*img->h ); + memset( img->pixels, 0, img->pitch*img->h ); - texHandle = DISPLAY->CreateTexture( pixfmt, img, false ); + texHandle = DISPLAY->CreateTexture( pixfmt, img, false ); - delete img; + delete img; } MovieTexture_Null::~MovieTexture_Null() { - DISPLAY->DeleteTexture( texHandle ); + DISPLAY->DeleteTexture( texHandle ); } /* diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h index 17106074c9..f6f24e59a5 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h @@ -13,21 +13,21 @@ #include "RageTexture.h" class MovieTexture_Null : public RageMovieTexture { -private: - bool playing; - bool loop; - unsigned texHandle; - public: - MovieTexture_Null(RageTextureID ID); - virtual ~MovieTexture_Null(); - void Invalidate() { texHandle = 0; } - unsigned GetTexHandle() const { return texHandle; } - void Update(float delta) { } - void Reload() { } - void SetPosition(float seconds) { } - void SetPlaybackRate(float rate) { } - void SetLooping(bool looping=true) { loop = looping; } + MovieTexture_Null(RageTextureID ID); + virtual ~MovieTexture_Null(); + void Invalidate() { texHandle = 0; } + unsigned GetTexHandle() const { return texHandle; } + void Update(float delta) { } + void Reload() { } + void SetPosition(float seconds) { } + void SetPlaybackRate(float rate) { } + void SetLooping(bool looping=true) { loop = looping; } + +private: + bool playing; + bool loop; + unsigned texHandle; }; #define USE_MOVIE_TEXTURE_NULL