mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #27355 from asmorkalov:as/gapi_control_msmf
Check MS Media Foundation availability in G-API too #27355 Tries to address https://github.com/opencv/opencv-python/issues/771 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
a2c381a82b
commit
9e18169959
@ -380,6 +380,15 @@ if(WIN32)
|
|||||||
ocv_target_link_libraries(${the_module} PRIVATE wsock32 ws2_32)
|
ocv_target_link_libraries(${the_module} PRIVATE wsock32 ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
ocv_option(OPENCV_GAPI_MSMF "Build G-API with MS Media Foundation support" HAVE_MSMF)
|
||||||
|
if(HAVE_MSMF AND OPENCV_GAPI_MSMF)
|
||||||
|
if(TARGET opencv_test_gapi)
|
||||||
|
ocv_target_compile_definitions(opencv_test_gapi PRIVATE -DHAVE_GAPI_MSMF)
|
||||||
|
endif()
|
||||||
|
ocv_target_compile_definitions(${the_module} PRIVATE -DHAVE_GAPI_MSMF)
|
||||||
|
ocv_target_link_libraries(${the_module} PRIVATE ocv.3rdparty.msmf)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_DIRECTML)
|
if(HAVE_DIRECTML)
|
||||||
ocv_target_compile_definitions(${the_module} PRIVATE HAVE_DIRECTML=1)
|
ocv_target_compile_definitions(${the_module} PRIVATE HAVE_DIRECTML=1)
|
||||||
endif()
|
endif()
|
||||||
|
@ -14,7 +14,9 @@ namespace cv {
|
|||||||
namespace gapi {
|
namespace gapi {
|
||||||
namespace wip {
|
namespace wip {
|
||||||
namespace onevpl {
|
namespace onevpl {
|
||||||
#ifdef _WIN32
|
|
||||||
|
#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];
|
||||||
GAPI_Assert(url.size() < MAX_PATH && "Windows MAX_PATH limit was reached");
|
GAPI_Assert(url.size() < MAX_PATH && "Windows MAX_PATH limit was reached");
|
||||||
@ -785,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 // _WIN32
|
#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");
|
||||||
@ -804,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 // _WIN32
|
#endif // HAVE_GAPI_MSMF
|
||||||
} // namespace onevpl
|
} // namespace onevpl
|
||||||
} // namespace wip
|
} // namespace wip
|
||||||
} // namespace gapi
|
} // namespace gapi
|
||||||
|
@ -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 _WIN32
|
#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 // _WIN32
|
#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 // _WIN32
|
#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
|
||||||
|
Loading…
Reference in New Issue
Block a user