qsv: Enable MinGW toolchain support

Use PCRE regex method to work around (likely) GCC std::regex bug,
and enable building for non-MSVC

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3239>
This commit is contained in:
Seungha Yang 2022-10-21 23:20:47 +09:00 committed by GStreamer Marge Bot
parent e392d9c597
commit 23261bccbb
3 changed files with 32 additions and 12 deletions

View file

@ -1515,15 +1515,27 @@ bool ConfigCtxVPL::CheckLowLatencyConfig(std::list<ConfigCtxVPL *> configCtxList
return bLowLatency;
}
#include <gst/gst.h>
bool ConfigCtxVPL::ParseDeviceIDx86(mfxChar *cDeviceID, mfxU32 &deviceID, mfxU32 &adapterIdx) {
std::string strDevID(cDeviceID);
// XXX: std::regex is crashing on Windows + gcc
#if 0
std::regex reDevIDAll("[0-9a-fA-F]+/[0-9]+");
std::regex reDevIDMin("[0-9a-fA-F]+");
#else
static const gchar *reDevIDAll = "[0-9a-fA-F]+/[0-9]+";
static const gchar *reDevIDMin = "[0-9a-fA-F]+";
if (!cDeviceID)
return false;
#endif
deviceID = DEVICE_ID_UNKNOWN;
adapterIdx = ADAPTER_IDX_UNKNOWN;
bool bHasAdapterIdx = false;
#if 0
if (std::regex_match(strDevID, reDevIDAll)) {
// check for DeviceID in format "devID/adapterIdx"
// devID = hex value
@ -1539,6 +1551,25 @@ bool ConfigCtxVPL::ParseDeviceIDx86(mfxChar *cDeviceID, mfxU32 &deviceID, mfxU32
// invalid format
return false;
}
#else
if (g_regex_match_simple(reDevIDAll, cDeviceID,
(GRegexCompileFlags)0, (GRegexMatchFlags)0)) {
// check for DeviceID in format "devID/adapterIdx"
// devID = hex value
// adapterIdx = decimal integer
bHasAdapterIdx = true;
}
else if (g_regex_match_simple(reDevIDMin, cDeviceID,
(GRegexCompileFlags)0, (GRegexMatchFlags)0)) {
// check for DeviceID in format "devID"
// (no adpaterIdx)
bHasAdapterIdx = false;
}
else {
// invalid format
return false;
}
#endif
// get deviceID (value before the slash, if present)
try {

View file

@ -78,7 +78,7 @@ libmfx_static = static_library('libmfx-static',
libmfx_sources,
c_args : libmfx_extra_args,
cpp_args : libmfx_extra_args,
dependencies : libmfx_extra_deps,
dependencies : libmfx_extra_deps + [gst_dep],
include_directories : libmfx_incl,
override_options: ['werror=false'],
)

View file

@ -32,17 +32,6 @@ endif
qsv_platform_deps = []
if host_system == 'windows'
# TODO: We can cross-compile this plugin using MinGW but there's an issue.
# Re-enable cross-compile once it's investigated and addressed
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/854
if cc.get_id() != 'msvc'
if qsv_option.enabled()
error('qsv plugin supports only MSVC build')
else
subdir_done()
endif
endif
if not gstd3d11_dep.found()
if qsv_option.enabled()
error('The qsv was enabled explicitly, but required d3d11 was not found')