From 5c4a1e00fc1c30ea2a13cd011f46dd1efff9057b Mon Sep 17 00:00:00 2001 From: shenweip <1037567878@qq.com> Date: Tue, 14 Jan 2020 08:19:44 +0800 Subject: [PATCH] BuildFix --- UI/NativeApp.cpp | 6 ++++-- Windows/CaptureDevice.cpp | 7 +++++-- headless/Headless.vcxproj | 13 +++++++------ headless/Headless.vcxproj.filters | 3 +++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index a855348f35..7de044f077 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -889,8 +889,10 @@ void NativeShutdownGraphics() { #endif #ifdef _WIN32 - delete winCamera; - winCamera = nullptr; + if (winCamera) { + delete winCamera; + winCamera = nullptr; + } #endif ShutdownWebServer(); diff --git a/Windows/CaptureDevice.cpp b/Windows/CaptureDevice.cpp index 45d55a2a23..d05f4bba4d 100644 --- a/Windows/CaptureDevice.cpp +++ b/Windows/CaptureDevice.cpp @@ -20,6 +20,7 @@ #include "CaptureDevice.h" #include "BufferLock.h" #include "ext/jpge/jpge.h" +#include "CommonTypes.h" #include "Core/HLE/sceUsbCam.h" #include "Core/Config.h" @@ -112,8 +113,7 @@ HRESULT ReaderCallback::OnReadSample( imgConvert( device->imageRGB, dstW, dstH, device->imgRGBLineSizes, pbScanline0, srcW, srcH, srcMFVideoFormat, srcPadding); - } - else { + } else { // If stride < 0, the pointer to the first row of source image is the last row in memory,should invert it in memory. invertedSrcImg = (unsigned char*)av_malloc(av_image_get_buffer_size(getAVVideoFormatbyMFVideoFormat(srcMFVideoFormat), srcW, srcH, 1)); imgInvert(invertedSrcImg, pbScanline0, srcW, srcH, device->deviceParam.videoFormat, lStride); @@ -523,6 +523,8 @@ std::vector WindowsCaptureDevice::getDeviceList(int *pActuallCount) deviceList.push_back(strName); } + CoTaskMemFree(pwstrName); + if (FAILED(hr)) { setError(CAPTUREDEVIDE_ERROR_GETNAMES_FAILED, "Error occurred,gotten " + std::to_string((int)count) + " device names"); if(pActuallCount) @@ -640,6 +642,7 @@ void WindowsCaptureDevice::messageHandler() { std::lock_guard lock(sdMutex); SafeRelease(&m_pSource); SafeRelease(&m_pReader); + CoTaskMemFree(param.ppDevices); delete m_pCallback; MFShutdown(); diff --git a/headless/Headless.vcxproj b/headless/Headless.vcxproj index dd42cbe4fc..94c6d72c8a 100644 --- a/headless/Headless.vcxproj +++ b/headless/Headless.vcxproj @@ -301,7 +301,7 @@ true true USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_32=1;_CONSOLE;_UNICODE;UNICODE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS - ../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native false StreamingSIMDExtensions2 Precise @@ -316,7 +316,7 @@ true true true - Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9.lib;dxguid.lib;%(AdditionalDependencies) + mf.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;shlwapi.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9.lib;dxguid.lib;%(AdditionalDependencies) 0x00400000 false true @@ -336,7 +336,7 @@ true true USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_64=1;_CONSOLE;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native false NotSet Precise @@ -353,7 +353,7 @@ true true true - Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9.lib;dxguid.lib;%(AdditionalDependencies) + mf.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;shlwapi.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9.lib;dxguid.lib;%(AdditionalDependencies) 0x00400000 false true @@ -407,7 +407,7 @@ true true USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_32=1;_CONSOLE;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../dx9sdk/Include/DX11;../Common;..;../Core;../ext/glew;../ext/native false NotSet Precise @@ -424,7 +424,7 @@ true true true - shell32.lib;advapi32.lib;gdi32.lib;Winmm.lib;Ws2_32.lib;dsound.lib;..\ffmpeg\Windows\arm\lib\avcodec.lib;..\ffmpeg\Windows\arm\lib\avformat.lib;..\ffmpeg\Windows\arm\lib\avutil.lib;..\ffmpeg\Windows\arm\lib\swresample.lib;..\ffmpeg\Windows\arm\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies) + mf.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;shlwapi.lib;shell32.lib;advapi32.lib;gdi32.lib;Winmm.lib;Ws2_32.lib;dsound.lib;..\ffmpeg\Windows\arm\lib\avcodec.lib;..\ffmpeg\Windows\arm\lib\avformat.lib;..\ffmpeg\Windows\arm\lib\avutil.lib;..\ffmpeg\Windows\arm\lib\swresample.lib;..\ffmpeg\Windows\arm\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies) /ignore:4049 /ignore:4217 %(AdditionalOptions) @@ -441,6 +441,7 @@ true true + diff --git a/headless/Headless.vcxproj.filters b/headless/Headless.vcxproj.filters index 962db7ee84..f084554e71 100644 --- a/headless/Headless.vcxproj.filters +++ b/headless/Headless.vcxproj.filters @@ -26,6 +26,9 @@ Other Platforms + + Windows +