mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
decklink: Fix linking on MinGW
MinGW does not provide comsupp.lib, so there's no implementation of _com_util::ConvertBSTRToString. Use a fallback implementation that uses wcstombs() instead. On MinGW we also truncate the name to 100 chars which should be fine.
This commit is contained in:
parent
3d4c428e41
commit
8865b440d9
3 changed files with 20 additions and 11 deletions
|
@ -967,7 +967,7 @@ init_devices (gpointer data)
|
|||
|
||||
GST_DEBUG ("Input %d supports:", i);
|
||||
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
||||
const char *name;
|
||||
char *name;
|
||||
|
||||
mode->GetName ((COMSTR_T *) & name);
|
||||
CONVERT_COM_STRING (name);
|
||||
|
@ -1005,7 +1005,7 @@ init_devices (gpointer data)
|
|||
|
||||
GST_DEBUG ("Output %d supports:", i);
|
||||
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
||||
const char *name;
|
||||
char *name;
|
||||
|
||||
mode->GetName ((COMSTR_T *) & name);
|
||||
CONVERT_COM_STRING (name);
|
||||
|
|
|
@ -39,13 +39,19 @@
|
|||
#define bool BOOL
|
||||
|
||||
#define COMSTR_T BSTR
|
||||
#define FREE_COM_STRING(s) delete[] s;
|
||||
#define CONVERT_COM_STRING(s) BSTR _s = (BSTR)s; s = _com_util::ConvertBSTRToString(_s); ::SysFreeString(_s);
|
||||
/* MinGW does not have comsuppw.lib, so no _com_util::ConvertBSTRToString */
|
||||
# ifdef __MINGW32__
|
||||
# define CONVERT_COM_STRING(s) BSTR _s = (BSTR)s; s = (char*) malloc(100); wcstombs(s, _s, 100); ::SysFreeString(_s);
|
||||
# define FREE_COM_STRING(s) free(s);
|
||||
# else
|
||||
# define CONVERT_COM_STRING(s) BSTR _s = (BSTR)s; s = _com_util::ConvertBSTRToString(_s); ::SysFreeString(_s);
|
||||
# define FREE_COM_STRING(s) delete[] s;
|
||||
# endif
|
||||
#else
|
||||
#define COMSTR_T const char*
|
||||
#define FREE_COM_STRING(s)
|
||||
#define CONVERT_COM_STRING(s)
|
||||
#endif /* _MSC_VER */
|
||||
#define FREE_COM_STRING(s)
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
typedef enum {
|
||||
GST_DECKLINK_MODE_AUTO,
|
||||
|
|
|
@ -12,12 +12,15 @@ decklink_libs = []
|
|||
|
||||
if host_machine.system() == 'windows'
|
||||
decklink_sources += ['win/DeckLinkAPIDispatch.cpp', 'win/DeckLinkAPI_i.c']
|
||||
# Only used by MSVC. On MinGW, this is all inlined.
|
||||
# FIXME: Use commsuppwd.lib for debug builds?
|
||||
comutil_dep = cxx.find_library('comsuppw', required : false)
|
||||
if comutil_dep.found()
|
||||
if cxx.get_id() == 'msvc'
|
||||
# FIXME: Use commsuppwd.lib for debug builds?
|
||||
comutil_dep = cxx.find_library('comsuppw')
|
||||
if comutil_dep.found()
|
||||
build_decklink = true
|
||||
decklink_libs = [comutil_dep]
|
||||
endif
|
||||
else
|
||||
build_decklink = true
|
||||
decklink_libs = [comutil_dep]
|
||||
endif
|
||||
else
|
||||
libdl = cc.find_library('dl', required: false)
|
||||
|
|
Loading…
Reference in a new issue