yolobs-studio/plugins/decklink/mac/platform.cpp

18 lines
385 B
C++
Raw Normal View History

2016-02-23 23:16:51 +00:00
#include "../platform.hpp"
2019-07-27 12:47:10 +00:00
#include <util/apple/cfstring-utils.h>
2016-02-23 23:16:51 +00:00
2019-09-22 21:19:10 +00:00
bool DeckLinkStringToStdString(decklink_string_t input, std::string &output)
2016-02-23 23:16:51 +00:00
{
const CFStringRef string = static_cast<CFStringRef>(input);
2019-07-27 12:47:10 +00:00
char *buffer = cfstr_copy_cstr(string, kCFStringEncodingASCII);
2016-02-23 23:16:51 +00:00
2019-07-27 12:47:10 +00:00
if (buffer)
2016-02-23 23:16:51 +00:00
output = std::string(buffer);
2019-07-27 12:47:10 +00:00
bfree(buffer);
2016-02-23 23:16:51 +00:00
CFRelease(string);
2019-07-27 12:47:10 +00:00
return (buffer != NULL);
2016-02-23 23:16:51 +00:00
}