Use own macro for MSMF in G-API to exclude side effects with videoio.

This commit is contained in:
Alexander Smorkalov 2025-05-30 15:15:13 +03:00
parent d3d477e4a0
commit 03fdbb1e4b
4 changed files with 9 additions and 9 deletions

View File

@ -369,7 +369,7 @@ OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON
OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON
VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT
VERIFY HAVE_DSHOW) VERIFY HAVE_DSHOW)
OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" OFF # NOT MINGW OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" NOT MINGW
VISIBLE_IF WIN32 VISIBLE_IF WIN32
VERIFY HAVE_MSMF) VERIFY HAVE_MSMF)
OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF

View File

@ -383,9 +383,9 @@ endif()
ocv_option(OPENCV_GAPI_MSMF "Build G-API with MS Media Foundation support" HAVE_MSMF) ocv_option(OPENCV_GAPI_MSMF "Build G-API with MS Media Foundation support" HAVE_MSMF)
if(HAVE_MSMF AND OPENCV_GAPI_MSMF) if(HAVE_MSMF AND OPENCV_GAPI_MSMF)
if(TARGET opencv_test_gapi) if(TARGET opencv_test_gapi)
ocv_target_compile_definitions(opencv_test_gapi PRIVATE -DHAVE_MSMF) ocv_target_compile_definitions(opencv_test_gapi PRIVATE -DHAVE_GAPI_MSMF)
endif() endif()
ocv_target_compile_definitions(${the_module} PRIVATE -DHAVE_MSMF) ocv_target_compile_definitions(${the_module} PRIVATE -DHAVE_GAPI_MSMF)
ocv_target_link_libraries(${the_module} PRIVATE ocv.3rdparty.msmf) ocv_target_link_libraries(${the_module} PRIVATE ocv.3rdparty.msmf)
endif() endif()

View File

@ -15,7 +15,7 @@ namespace gapi {
namespace wip { namespace wip {
namespace onevpl { namespace onevpl {
#ifdef HAVE_MSMF #ifdef HAVE_GAPI_MSMF
static HRESULT create_media_source(const std::string& url, IMFMediaSource **ppSource) { static HRESULT create_media_source(const std::string& url, IMFMediaSource **ppSource) {
wchar_t sURL[MAX_PATH]; wchar_t sURL[MAX_PATH];
@ -787,7 +787,7 @@ bool MFPAsyncDemuxDataProvider::empty() const {
(processing_locked_buffer_storage.size() == 0) && (processing_locked_buffer_storage.size() == 0) &&
(get_locked_buffer_size() == 0); (get_locked_buffer_size() == 0);
} }
#else // HAVE_MSMF #else // HAVE_GAPI_MSMF
MFPAsyncDemuxDataProvider::MFPAsyncDemuxDataProvider(const std::string&) { MFPAsyncDemuxDataProvider::MFPAsyncDemuxDataProvider(const std::string&) {
GAPI_Error("Unsupported: Microsoft Media Foundation is not available"); GAPI_Error("Unsupported: Microsoft Media Foundation is not available");
@ -806,7 +806,7 @@ bool MFPAsyncDemuxDataProvider::empty() const {
GAPI_Error("Unsupported: Microsoft Media Foundation is not available"); GAPI_Error("Unsupported: Microsoft Media Foundation is not available");
return true; return true;
} }
#endif // HAVE_MSMF #endif // HAVE_GAPI_MSMF
} // namespace onevpl } // namespace onevpl
} // namespace wip } // namespace wip
} // namespace gapi } // namespace gapi

View File

@ -16,7 +16,7 @@
#include "streaming/onevpl/onevpl_export.hpp" #include "streaming/onevpl/onevpl_export.hpp"
#include <opencv2/gapi/streaming/onevpl/data_provider_interface.hpp> #include <opencv2/gapi/streaming/onevpl/data_provider_interface.hpp>
#ifdef HAVE_MSMF #ifdef HAVE_GAPI_MSMF
#define NOMINMAX #define NOMINMAX
#include <mfapi.h> #include <mfapi.h>
#include <mfidl.h> #include <mfidl.h>
@ -104,7 +104,7 @@ private:
} // namespace gapi } // namespace gapi
} // namespace cv } // namespace cv
#else // HAVE_MSMF #else // HAVE_GAPI_MSMF
namespace cv { namespace cv {
namespace gapi { namespace gapi {
namespace wip { namespace wip {
@ -121,6 +121,6 @@ struct GAPI_EXPORTS MFPAsyncDemuxDataProvider : public IDataProvider {
} // namespace gapi } // namespace gapi
} // namespace cv } // namespace cv
#endif // HAVE_MSMF #endif // HAVE_GAPI_MSMF
#endif // HAVE_ONEVPL #endif // HAVE_ONEVPL
#endif // GAPI_STREAMING_ONEVPL_DEMUX_ASYNC_MFP_DEMUX_DATA_PROVIDER_HPP #endif // GAPI_STREAMING_ONEVPL_DEMUX_ASYNC_MFP_DEMUX_DATA_PROVIDER_HPP