From b2334095806caef897d826643f5a7c1f5b4190ec Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 11 Aug 2020 10:17:46 -0600 Subject: [PATCH] Patches contributed by Adam to resolve movie playback: - vcxproj file issues (local paths, Debug configurations) - defer movie playback until mouse plate properly sized - correct conditional and type for plMoviePlayer::Start() reference fVideoTrack - fix typing to call plPlanarImage::Yuv420ToRgba() causing color artifacting --- .../Plasma/Apps/plClient/plClient.vcxproj | 6 +++--- .../FeatureLib/pfMoviePlayer/pfMoviePlayer.vcxproj | 6 +++--- .../Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp | 9 ++++----- .../Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp | 4 ++-- .../Plasma/FeatureLib/pfMoviePlayer/plPlanarImage.cpp | 10 +++++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/Apps/plClient/plClient.vcxproj b/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/Apps/plClient/plClient.vcxproj index 03670c68..e2c3a621 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/Apps/plClient/plClient.vcxproj +++ b/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/Apps/plClient/plClient.vcxproj @@ -106,10 +106,10 @@ true - winhttp.lib;ws2_32.lib;strmiids.lib;vfw32.lib;version.lib;Rpcrt4.lib;d3dx9.lib;dinput8.lib;dxerr.lib;dxguid.lib;dsound.lib;OpenAL32.lib;libeay32.lib;NxCharacter.lib;PhysXLoader.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;libspeex.lib;libjpeg.lib;zlibd.lib;libpngd.lib;NxCooking.lib;%(AdditionalDependencies) + winhttp.lib;ws2_32.lib;strmiids.lib;vfw32.lib;version.lib;Rpcrt4.lib;d3dx9.lib;dinput8.lib;dxerr.lib;dxguid.lib;dsound.lib;OpenAL32.lib;libeay32.lib;NxCharacter.lib;PhysXLoader.lib;opus.lib;vpxmdd.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;libspeex.lib;libjpeg.lib;zlibd.lib;libpngd.lib;NxCooking.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) true - ..\..\..\..\..\StaticSDKs\Win32\DX9.0c\Lib\x86;..\..\..\..\..\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK\libs\Win32;..\..\..\..\..\StaticSDKs\Win32\OpenSSL\lib;..\..\..\..\..\StaticSDKs\Win32\PhysX\lib\win32;..\..\..\..\..\StaticSDKs\Win32\opus\opus-1.3.1\win32\VS2015\Win32\Release\opus;D:\Users\richards\Desktop\Minkata-build-VS2010\CWE-ou-minkata\MOULOpenSourceClientPlugin\StaticSDKs\Win32\webm\libvpx_build_win32_vs14;..\..\..\..\..\StaticSDKs\Win32\xiph\lib\Debug;..\..\..\..\..\StaticSDKs\XPlatform\expat-1.95.7\StaticLibs\Win32;..\..\..\..\..\StaticSDKs\XPlatform\jpeg-8c-rgba;..\..\..\..\..\StaticSDKs\XPlatform\zlib\lib;..\..\..\..\..\StaticSDKs\XPlatform\png\lib;%(AdditionalLibraryDirectories) + ..\..\..\..\..\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\Debug;..\..\..\..\..\StaticSDKs\Win32\DX9.0c\Lib\x86;..\..\..\..\..\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK\libs\Win32;..\..\..\..\..\StaticSDKs\Win32\OpenSSL\lib;..\..\..\..\..\StaticSDKs\Win32\PhysX\lib\win32;..\..\..\..\..\StaticSDKs\Win32\opus\opus-1.3.1\win32\VS2015\Win32\Release;..\..\..\..\..\StaticSDKs\Win32\webm\libvpx_build_win32_vs10\Win32\Debug;..\..\..\..\..\StaticSDKs\Win32\xiph\lib\Debug;..\..\..\..\..\StaticSDKs\XPlatform\expat-1.95.7\StaticLibs\Win32;..\..\..\..\..\StaticSDKs\XPlatform\jpeg-8c-rgba;..\..\..\..\..\StaticSDKs\XPlatform\zlib\lib;..\..\..\..\..\StaticSDKs\XPlatform\png\lib;%(AdditionalLibraryDirectories) libc.lib;libcd.lib;libci.lib;libcid.lib;libcmtd.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries) true true @@ -223,7 +223,7 @@ winhttp.lib;ws2_32.lib;strmiids.lib;vfw32.lib;version.lib;Rpcrt4.lib;d3dx9.lib;dinput8.lib;dxerr.lib;dxguid.lib;dsound.lib;OpenAL32.lib;libeay32.lib;NxCharacter.lib;PhysXLoader.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opus.lib;vpxmd.lib;libspeex.lib;libjpeg.lib;zlib.lib;libpng.lib;NxCooking.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) true - ..\..\..\..\..\StaticSDKs\Win32\DX9.0c\Lib\x86;..\..\..\..\..\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK\libs\Win32;..\..\..\..\..\StaticSDKs\Win32\OpenSSL\lib;..\..\..\..\..\StaticSDKs\Win32\PhysX\lib\win32;..\..\..\..\..\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\Release;..\..\..\..\..\StaticSDKs\Win32\opus\opus-1.3.1-build-win32-VS2010\win32\VS2010\Win32\Release;..\..\..\..\..\StaticSDKs\Win32\webm\libvpx_build_win32_vs10\Win32\Release;..\..\..\..\..\StaticSDKs\Win32\xiph\lib\Release;..\..\..\..\..\StaticSDKs\XPlatform\expat-1.95.7\StaticLibs\Win32;..\..\..\..\..\StaticSDKs\XPlatform\jpeg-8c-rgba;..\..\..\..\..\StaticSDKs\XPlatform\zlib\lib;..\..\..\..\..\StaticSDKs\XPlatform\png\lib;%(AdditionalLibraryDirectories) + ..\..\..\..\..\StaticSDKs\Win32\DX9.0c\Lib\x86;..\..\..\..\..\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK\libs\Win32;..\..\..\..\..\StaticSDKs\Win32\OpenSSL\lib;..\..\..\..\..\StaticSDKs\Win32\PhysX\lib\win32;..\..\..\..\..\StaticSDKs\Win32\speex-1.0.1\win32\libspeex\Release;..\..\..\..\..\StaticSDKs\Win32\opus\opus-1.3.1\win32\VS2015\Win32\Release;..\..\..\..\..\StaticSDKs\Win32\webm\libvpx_build_win32_vs10\Win32\Release;..\..\..\..\..\StaticSDKs\Win32\xiph\lib\Release;..\..\..\..\..\StaticSDKs\XPlatform\expat-1.95.7\StaticLibs\Win32;..\..\..\..\..\StaticSDKs\XPlatform\jpeg-8c-rgba;..\..\..\..\..\StaticSDKs\XPlatform\zlib\lib;..\..\..\..\..\StaticSDKs\XPlatform\png\lib;%(AdditionalLibraryDirectories) libc.lib;libci.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries) true false diff --git a/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/FeatureLib/pfMoviePlayer/pfMoviePlayer.vcxproj b/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/FeatureLib/pfMoviePlayer/pfMoviePlayer.vcxproj index 0b97c36a..38b645f8 100755 --- a/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/FeatureLib/pfMoviePlayer/pfMoviePlayer.vcxproj +++ b/MOULOpenSourceClientPlugin/Plasma20/MSVC10Projects/Plasma/FeatureLib/pfMoviePlayer/pfMoviePlayer.vcxproj @@ -92,7 +92,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;PLASMA_USE_WEBM;_DEBUG;_LIB;%(PreprocessorDefinitions) ../../../../Sources/Plasma/FeatureLib/inc;../../../../Sources/Plasma/NucleusLib/inc;../../../../Sources/Plasma/PubUtilLib/inc;../../../../Sources/Plasma/CoreLib;../../../../../StaticSDKs/Win32/OpenAL 1.1 with EFX SDK/include;../../../../../StaticSDKs/Win32/opus/opus-1.3.1/include;../../../../../StaticSDKs/Win32/webm/libvpx;%(AdditionalIncludeDirectories) true false @@ -108,7 +108,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;PLASMA_USE_WEBM;_DEBUG;_LIB;%(PreprocessorDefinitions) ../../../../Sources/Plasma/FeatureLib/inc;../../../../Sources/Plasma/NucleusLib/inc;../../../../Sources/Plasma/PubUtilLib/inc;../../../../Sources/Plasma/CoreLib;../../../../../StaticSDKs/Win32/OpenAL 1.1 with EFX SDK/include;../../../../../StaticSDKs/Win32/opus/opus-1.3.1/include;../../../../../StaticSDKs/Win32/webm/libvpx;%(AdditionalIncludeDirectories) true false @@ -147,7 +147,7 @@ true true WIN32;NDEBUG;PLASMA_USE_WEBM;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - ../../../../Sources/Plasma/FeatureLib/inc;../../../../Sources/Plasma/NucleusLib/inc;../../../../Sources/Plasma/PubUtilLib/inc;../../../../Sources/Plasma/CoreLib;../../../../../StaticSDKs/Win32/OpenAL 1.1 with EFX SDK/include;../../../../../StaticSDKs/Win32/opus/opus-1.3.1-build-win32-VS2010/include;../../../../../StaticSDKs/Win32/webm/libvpx;%(AdditionalIncludeDirectories) + ../../../../Sources/Plasma/FeatureLib/inc;../../../../Sources/Plasma/NucleusLib/inc;../../../../Sources/Plasma/PubUtilLib/inc;../../../../Sources/Plasma/CoreLib;../../../../../StaticSDKs/Win32/OpenAL 1.1 with EFX SDK/include;../../../../../StaticSDKs/Win32/opus/opus-1.3.1/include;../../../../../StaticSDKs/Win32/webm/libvpx;%(AdditionalIncludeDirectories) true false diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp index ec1f18ee..32600838 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp @@ -1519,11 +1519,6 @@ hsBool plClient::StartInit() plgDispatch::Dispatch()->RegisterForExactType(plAudioSysMsg::Index(), pLMod->GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plMovieMsg::Index(), GetKey()); - plConst(hsScalar) delay(2.f); - IPlayIntroMovie("avi/intro1.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); - IPlayIntroMovie("avi/EventIntro.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); - IPlayIntroMovie("avi/URULiveIntro.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); - // // Init Net before loading things // @@ -1552,6 +1547,10 @@ hsBool plClient::StartInit() plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height()); plInputManager::SetRecenterMouse(false); + IPlayIntroMovie("avi/intro1.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); + IPlayIntroMovie("avi/EventIntro.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); + IPlayIntroMovie("avi/URULiveIntro.webm", 0.f, 0.f, 0.f, 1.f, 1.f, 0.75); + plSynchedObject::PushSynchDisabled(false); // enable dirty tracking if (StrCmp(NetCommGetStartupAge()->ageDatasetName, "StartUp") == 0) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp index e092abee..5ba653e4 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp @@ -347,7 +347,7 @@ bool plMoviePlayer::Start() #ifdef PLASMA_USE_WEBM if (!IOpenMovie()) return false; - hsAssert(fVideoTrack, "nil video track -- expect bad things to happen!"); + hsAssert(fVideoTrack.get(), "nil video track -- expect bad things to happen!"); hsStatusMessageF("Opened movie %s\n", fMoviePath); // Initialize VPX @@ -415,7 +415,7 @@ bool plMoviePlayer::NextFrame() fMovieTime += frameTimeDelta; std::vector video; - if (fVideoTrack.get() != nullptr || !fVideoTrack->GetFrames(fReader, fMovieTime * 1000000, video)) { + if (fVideoTrack.get() == nullptr || !fVideoTrack->GetFrames(fReader, fMovieTime * 1000000, video)) { Stop(); return false; } diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plPlanarImage.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plPlanarImage.cpp index 898e3e29..554e2a80 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plPlanarImage.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfMoviePlayer/plPlanarImage.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /////////////////////////////////////////////////////////////////////////////// -static UInt8 Clip(UInt32 val) { +static UInt8 Clip(Int32 val) { if (val < 0) { return 0; } else if (val > 255) { @@ -83,10 +83,10 @@ void plPlanarImage::Yuv420ToRgba(UInt32 w, UInt32 h, const Int32* stride, UInt8* size_t v_idx = stride[2] * (i/2) + (j/2); size_t dest_idx = w * i + j; - UInt32 y = static_cast(y_src[y_idx]); - UInt32 u = static_cast(u_src[u_idx]); - UInt32 v = static_cast(v_src[v_idx]); - UInt32 y1 = (y - 16) * YG; + Int32 y = static_cast(y_src[y_idx]); + Int32 u = static_cast(u_src[u_idx]); + Int32 v = static_cast(v_src[v_idx]); + Int32 y1 = (y - 16) * YG; dest[dest_idx*4+0] = Clip(((u * UB + v * VB) - (BB) + y1) >> 6); dest[dest_idx*4+1] = Clip(((u * UG + v * VG) - (BG) + y1) >> 6);