diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a1d4ae..771a60b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,10 +70,12 @@ set_target_properties(openpnp-capture PROPERTIES SOVERSION ${OPENPNP_CAPTURE_LIB_SOVERSION}) IF (WIN32) - # build with static runtime rather than DLL based so that we - # don't have to distribute it - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + if(MSVC) + # build with static runtime rather than DLL based so that we + # don't have to distribute it + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + endif() # set the platform identification string add_definitions(-D__PLATFORM__="Win ${COMPILERBITS}") @@ -84,6 +86,7 @@ IF (WIN32) # add files for WIN32 target_sources(openpnp-capture PRIVATE win/platformcontext.cpp win/platformstream.cpp) + target_link_libraries(openpnp-capture strmiids) # add windows-specific test application add_subdirectory(win/tests) diff --git a/win/platformcontext.cpp b/win/platformcontext.cpp index c37e7d2..8b2f52b 100644 --- a/win/platformcontext.cpp +++ b/win/platformcontext.cpp @@ -32,6 +32,9 @@ #include #include +#include +#include // for MAKEFOURCC macro + #include "../common/logging.h" #include "scopedcomptr.h" #include "platformstream.h" @@ -94,7 +97,7 @@ bool PlatformContext::enumerateDevices() ScopedComPtr devEnum(dev_enum); - hr = devEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,&enum_moniker,NULL); + hr = devEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,&enum_moniker, 0); if (hr == S_FALSE) { // no devices found! @@ -371,11 +374,11 @@ bool PlatformContext::enumerateFrameInfo(IMoniker *moniker, platformDeviceInfo * newFrameInfo.bpp = pVih->bmiHeader.biBitCount; if (pVih->bmiHeader.biCompression == BI_RGB) { - newFrameInfo.fourcc = 'RGB '; + newFrameInfo.fourcc = MAKEFOURCC('R', 'G', 'B', ' '); } else if (pVih->bmiHeader.biCompression == BI_BITFIELDS) { - newFrameInfo.fourcc = ' '; + newFrameInfo.fourcc = MAKEFOURCC(' ', ' ', ' ', ' '); } else { diff --git a/win/platformdeviceinfo.h b/win/platformdeviceinfo.h index 2b75ef3..25dbffe 100644 --- a/win/platformdeviceinfo.h +++ b/win/platformdeviceinfo.h @@ -27,7 +27,7 @@ #define win_platformdeviceinfo_h #include -#include +#include #include #include "../common/deviceinfo.h" diff --git a/win/platformstream.cpp b/win/platformstream.cpp index 2ae0f33..8b69b98 100644 --- a/win/platformstream.cpp +++ b/win/platformstream.cpp @@ -31,6 +31,8 @@ #include "platformcontext.h" #include "scopedcomptr.h" +#include + extern HRESULT FindCaptureDevice(IBaseFilter** ppSrcFilter, const wchar_t* wDeviceName); extern void _FreeMediaType(AM_MEDIA_TYPE& mt); @@ -544,8 +546,8 @@ void PlatformStream::dumpCameraProperties() if (m_camControl->GetRange(CameraControl_Exposure, &mmin, &mmax, &delta, &defaultValue, &flags) == S_OK) { - LOG(LOG_INFO, "Exposure min : %2.3f seconds (%d integer)\n", pow(2.0f, (float)mmin), mmin); - LOG(LOG_INFO, "Exposure max : %2.3f seconds (%d integer)\n", pow(2.0f, (float)mmax), mmax); + LOG(LOG_INFO, "Exposure min : %2.3f seconds (%d integer)\n", std::pow(2.0f, (float)mmin), mmin); + LOG(LOG_INFO, "Exposure max : %2.3f seconds (%d integer)\n", std::pow(2.0f, (float)mmax), mmax); LOG(LOG_INFO, "Exposure step : %d (integer)\n", delta); LOG(LOG_INFO, "Exposure default : %2.3f seconds\n", pow(2.0f, (float)defaultValue)); LOG(LOG_INFO, "Flags : %08X\n", flags); diff --git a/win/platformstream.h b/win/platformstream.h index 8be74fe..56b9c83 100644 --- a/win/platformstream.h +++ b/win/platformstream.h @@ -31,8 +31,8 @@ #include #include -#include -#include +#include +#include #include #include