From: Sebastian Dröge Date: Tue, 30 May 2023 10:22:44 +0000 (+0300) Subject: decklink: Correctly handle SDK strings on macOS X-Git-Tag: 1.22.7~233 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52e3d54bde0689b8d3a482bd4820daa5ec2fe0fc;p=platform%2Fupstream%2Fgstreamer.git decklink: Correctly handle SDK strings on macOS They're CFStringRef* and not plain NUL-terminated char* C strings. Part-of: --- diff --git a/subprojects/gst-plugins-bad/sys/decklink/gstdecklink.h b/subprojects/gst-plugins-bad/sys/decklink/gstdecklink.h index 06caa5f..13f76cb 100644 --- a/subprojects/gst-plugins-bad/sys/decklink/gstdecklink.h +++ b/subprojects/gst-plugins-bad/sys/decklink/gstdecklink.h @@ -50,7 +50,16 @@ # define FREE_COM_STRING(s) G_STMT_START { delete[] s; } G_STMT_END # define CONVERT_TO_COM_STRING(s) G_STMT_START { char * _s = (char *)s; s = _com_util::ConvertStringToBSTR(_s); g_free(_s); } G_STMT_END # endif /* __MINGW32__ */ -#else +#elif defined(__APPLE__) + +#include + +#define COMSTR_T CFStringRef +#define CONVERT_COM_STRING(s) G_STMT_START { CFStringRef _s = (CFStringRef)s; s = (char*) malloc(100); CFStringGetCString(_s, s, 100, kCFStringEncodingUTF8); CFRelease(_s); } G_STMT_END +#define FREE_COM_STRING(s) free(s); +#define CONVERT_TO_COM_STRING(s) G_STMT_START { char * _s = (char *)s; s = CFStringCreateWithCString(kCFAllocatorDefault, _s, kCFStringEncodingUTF8); g_free(_s); } G_STMT_END +#define WINAPI +#else /* Linux */ #define COMSTR_T const char* #define CONVERT_COM_STRING(s) #define CONVERT_TO_COM_STRING(s)