From 90cd567b48687772e687ccea468b28cd005f5280 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 2 Oct 2003 09:36:49 +0000 Subject: [PATCH] Move codec dump to DShow renderer; it's usually not needed anymore, and ACM codecs are a potential cause of crashes. --- .../arch/MovieTexture/MovieTexture_DShow.cpp | 105 ++++++++++++++++++ .../src/archutils/Win32/DebugInfoHunt.cpp | 97 ---------------- 2 files changed, 105 insertions(+), 97 deletions(-) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp index eff17b25d0..992d12f150 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp @@ -34,6 +34,104 @@ #include "SDL_utils.h" +#include /* for GetVideoCodecDebugInfo */ +#pragma comment(lib, "vfw32.lib") +#include "arch/ArchHooks/ArchHooks.h" + +static CString FourCCToString(int fcc) +{ + char c[4]; + c[0] = char((fcc >> 0) & 0xFF); + c[1] = char((fcc >> 8) & 0xFF); + c[2] = char((fcc >> 16) & 0xFF); + c[3] = char((fcc >> 24) & 0xFF); + + CString s; + for( int i = 0; i < 4; ++i ) + s += clamp( c[i], '\x20', '\x7e' ); + + return s; +} + +static void CheckCodecVersion( CString codec, CString desc ) +{ + if( !codec.CompareNoCase("DIVX") ) + { + /* "DivX 5.0.5 Codec" */ + Regex GetDivXVersion; + + int major, minor, rev; + if( sscanf( desc, "DivX %i.%i.%i", &major, &minor, &rev ) != 3 && + sscanf( desc, "DivX Pro %i.%i.%i", &major, &minor, &rev ) != 3 ) + { + LOG->Warn( "Couldn't parse DivX version \"%s\"", desc.c_str() ); + return; + } + + /* 5.0.0 through 5.0.4 are old and cause crashes. Warn. */ + if( major == 5 && minor == 0 && rev < 5 ) + { + HOOKS->MessageBoxOK( + ssprintf("The version of DivX installed, %i.%i.%i, is out of date and may\n" + "cause instability. Please upgrade to DivX 5.0.5 or newer, available at:\n" + "\n" + "http://www.divx.com/", major, minor, rev), + desc ); + return; + } + } +} + + +static void GetVideoCodecDebugInfo() +{ + ICINFO info = { sizeof(ICINFO) }; + int i; + LOG->Info("Video codecs:"); + CHECKPOINT; + for(i=0; ICInfo(ICTYPE_VIDEO, i, &info); ++i) + { + CHECKPOINT; + if( FourCCToString(info.fccHandler) == "ASV1" ) + { + /* Broken. */ + LOG->Info("%i: %s: skipped", i, FourCCToString(info.fccHandler).c_str()); + continue; + } + + LOG->Trace( "Scanning codec %s", FourCCToString(info.fccHandler).c_str() ); + CHECKPOINT; + HIC hic; + hic = ICOpen(info.fccType, info.fccHandler, ICMODE_DECOMPRESS); + if(!hic) + { + LOG->Info("Couldn't open video codec %s", + FourCCToString(info.fccHandler).c_str()); + continue; + } + + CHECKPOINT; + if (ICGetInfo(hic, &info, sizeof(ICINFO))) + { + CheckCodecVersion( FourCCToString(info.fccHandler), WStringToCString(info.szDescription) ); + CHECKPOINT; + + LOG->Info(" %s: %ls (%ls)", + FourCCToString(info.fccHandler).c_str(), info.szName, info.szDescription); + } + else + LOG->Info("ICGetInfo(%s) failed", + FourCCToString(info.fccHandler).c_str()); + + CHECKPOINT; + ICClose(hic); + } + + if(!i) + LOG->Info(" None found"); +} + + //----------------------------------------------------------------------------- // MovieTexture_DShow constructor //----------------------------------------------------------------------------- @@ -42,6 +140,13 @@ MovieTexture_DShow::MovieTexture_DShow( RageTextureID ID ) : { LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" ); + static bool first = true; + if( first ) + { + first = false; + GetVideoCodecDebugInfo(); + } + m_bLoop = true; m_bPlaying = false; diff --git a/stepmania/src/archutils/Win32/DebugInfoHunt.cpp b/stepmania/src/archutils/Win32/DebugInfoHunt.cpp index 9db30f18d2..75fa888609 100644 --- a/stepmania/src/archutils/Win32/DebugInfoHunt.cpp +++ b/stepmania/src/archutils/Win32/DebugInfoHunt.cpp @@ -3,7 +3,6 @@ #include "RageLog.h" #include "RageUtil.h" #include "VideoDriverInfo.h" -#include "arch/ArchHooks/ArchHooks.h" void LogVideoDriverInfo( VideoDriverInfo info ) @@ -128,101 +127,6 @@ static void GetSoundDriverDebugInfo() } } -#include -#pragma comment(lib, "vfw32.lib") - -static CString FourCCToString(int fcc) -{ - char c[4]; - c[0] = char((fcc >> 0) & 0xFF); - c[1] = char((fcc >> 8) & 0xFF); - c[2] = char((fcc >> 16) & 0xFF); - c[3] = char((fcc >> 24) & 0xFF); - - CString s; - for( int i = 0; i < 4; ++i ) - s += clamp( c[i], '\x20', '\x7e' ); - - return s; -} - -static void CheckCodecVersion( CString codec, CString desc ) -{ - if( !codec.CompareNoCase("DIVX") ) - { - /* "DivX 5.0.5 Codec" */ - Regex GetDivXVersion; - - int major, minor, rev; - if( sscanf( desc, "DivX %i.%i.%i", &major, &minor, &rev ) != 3 && - sscanf( desc, "DivX Pro %i.%i.%i", &major, &minor, &rev ) != 3 ) - { - LOG->Warn( "Couldn't parse DivX version \"%s\"", desc.c_str() ); - return; - } - - /* 5.0.0 through 5.0.4 are old and cause crashes. Warn. */ - if( major == 5 && minor == 0 && rev < 5 ) - { - HOOKS->MessageBoxOK( - ssprintf("The version of DivX installed, %i.%i.%i, is out of date and may\n" - "cause instability. Please upgrade to DivX 5.0.5 or newer, available at:\n" - "\n" - "http://www.divx.com/", major, minor, rev), - desc ); - return; - } - } -} - - -static void GetVideoCodecDebugInfo() -{ - ICINFO info = { sizeof(ICINFO) }; - int i; - LOG->Info("Video codecs:"); - CHECKPOINT; - for(i=0; ICInfo(ICTYPE_VIDEO, i, &info); ++i) - { - CHECKPOINT; - if( FourCCToString(info.fccHandler) == "ASV1" ) - { - /* Broken. */ - LOG->Info("%i: %s: skipped", i, FourCCToString(info.fccHandler).c_str()); - continue; - } - - LOG->Trace( "Scanning codec %s", FourCCToString(info.fccHandler).c_str() ); - CHECKPOINT; - HIC hic; - hic = ICOpen(info.fccType, info.fccHandler, ICMODE_DECOMPRESS); - if(!hic) - { - LOG->Info("Couldn't open video codec %s", - FourCCToString(info.fccHandler).c_str()); - continue; - } - - CHECKPOINT; - if (ICGetInfo(hic, &info, sizeof(ICINFO))) - { - CheckCodecVersion( FourCCToString(info.fccHandler), WStringToCString(info.szDescription) ); - CHECKPOINT; - - LOG->Info(" %s: %ls (%ls)", - FourCCToString(info.fccHandler).c_str(), info.szName, info.szDescription); - } - else - LOG->Info("ICGetInfo(%s) failed", - FourCCToString(info.fccHandler).c_str()); - - CHECKPOINT; - ICClose(hic); - } - - if(!i) - LOG->Info(" None found"); -} void SearchForDebugInfo() { @@ -230,7 +134,6 @@ void SearchForDebugInfo() GetMemoryDebugInfo(); GetDisplayDriverDebugInfo(); GetSoundDriverDebugInfo(); - GetVideoCodecDebugInfo(); } /*