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
@ -967,7 +967,7 @@ init_devices (gpointer data)
|
|||||||
|
|
||||||
GST_DEBUG ("Input %d supports:", i);
|
GST_DEBUG ("Input %d supports:", i);
|
||||||
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
||||||
const char *name;
|
char *name;
|
||||||
|
|
||||||
mode->GetName ((COMSTR_T *) & name);
|
mode->GetName ((COMSTR_T *) & name);
|
||||||
CONVERT_COM_STRING (name);
|
CONVERT_COM_STRING (name);
|
||||||
@ -1005,7 +1005,7 @@ init_devices (gpointer data)
|
|||||||
|
|
||||||
GST_DEBUG ("Output %d supports:", i);
|
GST_DEBUG ("Output %d supports:", i);
|
||||||
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
while ((ret = mode_iter->Next (&mode)) == S_OK) {
|
||||||
const char *name;
|
char *name;
|
||||||
|
|
||||||
mode->GetName ((COMSTR_T *) & name);
|
mode->GetName ((COMSTR_T *) & name);
|
||||||
CONVERT_COM_STRING (name);
|
CONVERT_COM_STRING (name);
|
||||||
|
@ -39,13 +39,19 @@
|
|||||||
#define bool BOOL
|
#define bool BOOL
|
||||||
|
|
||||||
#define COMSTR_T BSTR
|
#define COMSTR_T BSTR
|
||||||
#define FREE_COM_STRING(s) delete[] 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 CONVERT_COM_STRING(s) BSTR _s = (BSTR)s; s = _com_util::ConvertBSTRToString(_s); ::SysFreeString(_s);
|
||||||
|
# define FREE_COM_STRING(s) delete[] s;
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#define COMSTR_T const char*
|
#define COMSTR_T const char*
|
||||||
#define FREE_COM_STRING(s)
|
|
||||||
#define CONVERT_COM_STRING(s)
|
#define CONVERT_COM_STRING(s)
|
||||||
#endif /* _MSC_VER */
|
#define FREE_COM_STRING(s)
|
||||||
|
#endif /* G_OS_WIN32 */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_DECKLINK_MODE_AUTO,
|
GST_DECKLINK_MODE_AUTO,
|
||||||
|
@ -12,13 +12,16 @@ decklink_libs = []
|
|||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
decklink_sources += ['win/DeckLinkAPIDispatch.cpp', 'win/DeckLinkAPI_i.c']
|
decklink_sources += ['win/DeckLinkAPIDispatch.cpp', 'win/DeckLinkAPI_i.c']
|
||||||
# Only used by MSVC. On MinGW, this is all inlined.
|
if cxx.get_id() == 'msvc'
|
||||||
# FIXME: Use commsuppwd.lib for debug builds?
|
# FIXME: Use commsuppwd.lib for debug builds?
|
||||||
comutil_dep = cxx.find_library('comsuppw', required : false)
|
comutil_dep = cxx.find_library('comsuppw')
|
||||||
if comutil_dep.found()
|
if comutil_dep.found()
|
||||||
build_decklink = true
|
build_decklink = true
|
||||||
decklink_libs = [comutil_dep]
|
decklink_libs = [comutil_dep]
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
build_decklink = true
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
libdl = cc.find_library('dl', required: false)
|
libdl = cc.find_library('dl', required: false)
|
||||||
have_pthread_h = cdata.has('HAVE_PTHREAD_H')
|
have_pthread_h = cdata.has('HAVE_PTHREAD_H')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user