fix: DeckLink macOS build — CFStringRef and CoreFoundation
GetDisplayName returns CFStringRef on macOS (not const char*). Add #ifdef __APPLE__ handling in DeckLinkSender.hpp and DeckLinkReceiver.hpp, and link -framework CoreFoundation in decklinkin/decklinkout CMakeLists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,4 +8,7 @@ add_executable(dmf-node-decklinkin
|
||||
target_compile_features(dmf-node-decklinkin PRIVATE cxx_std_20)
|
||||
target_include_directories(dmf-node-decklinkin PRIVATE "${DECKLINK_INCLUDE}")
|
||||
target_link_libraries(dmf-node-decklinkin PRIVATE dmf-shared ${CMAKE_DL_LIBS})
|
||||
if(APPLE)
|
||||
target_link_libraries(dmf-node-decklinkin PRIVATE "-framework CoreFoundation")
|
||||
endif()
|
||||
install(TARGETS dmf-node-decklinkin RUNTIME DESTINATION bin)
|
||||
|
||||
@@ -8,4 +8,7 @@ add_executable(dmf-node-decklinkout
|
||||
target_compile_features(dmf-node-decklinkout PRIVATE cxx_std_20)
|
||||
target_include_directories(dmf-node-decklinkout PRIVATE "${DECKLINK_INCLUDE}")
|
||||
target_link_libraries(dmf-node-decklinkout PRIVATE dmf-shared ${CMAKE_DL_LIBS})
|
||||
if(APPLE)
|
||||
target_link_libraries(dmf-node-decklinkout PRIVATE "-framework CoreFoundation")
|
||||
endif()
|
||||
install(TARGETS dmf-node-decklinkout RUNTIME DESTINATION bin)
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <DeckLinkAPI.h>
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
#include "Signal.hpp"
|
||||
|
||||
namespace dmf {
|
||||
@@ -268,9 +271,20 @@ private:
|
||||
IDeckLinkInput* inp = nullptr;
|
||||
if (device->QueryInterface(IID_IDeckLinkInput, (void**)&inp) == S_OK) {
|
||||
inp->Release();
|
||||
const char* name = nullptr;
|
||||
device->GetDisplayName(&name);
|
||||
devices.push_back({index, name ? name : "?"});
|
||||
std::string name = "?";
|
||||
#ifdef __APPLE__
|
||||
CFStringRef cfName = nullptr;
|
||||
if (device->GetDisplayName(&cfName) == S_OK && cfName) {
|
||||
char buf[256] = {};
|
||||
CFStringGetCString(cfName, buf, sizeof(buf), kCFStringEncodingUTF8);
|
||||
name = buf;
|
||||
CFRelease(cfName);
|
||||
}
|
||||
#else
|
||||
const char* cname = nullptr;
|
||||
if (device->GetDisplayName(&cname) == S_OK && cname) name = cname;
|
||||
#endif
|
||||
devices.push_back({index, name});
|
||||
raw_devices.push_back(device);
|
||||
index++;
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <DeckLinkAPI.h>
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#include "Signal.hpp"
|
||||
#include "V210.hpp"
|
||||
@@ -263,9 +266,20 @@ private:
|
||||
IDeckLinkOutput* out = nullptr;
|
||||
if (device->QueryInterface(IID_IDeckLinkOutput, (void**)&out) == S_OK) {
|
||||
out->Release();
|
||||
const char* name = nullptr;
|
||||
device->GetDisplayName(&name);
|
||||
devices.push_back({index, name ? name : "?"});
|
||||
std::string name = "?";
|
||||
#ifdef __APPLE__
|
||||
CFStringRef cfName = nullptr;
|
||||
if (device->GetDisplayName(&cfName) == S_OK && cfName) {
|
||||
char buf[256] = {};
|
||||
CFStringGetCString(cfName, buf, sizeof(buf), kCFStringEncodingUTF8);
|
||||
name = buf;
|
||||
CFRelease(cfName);
|
||||
}
|
||||
#else
|
||||
const char* cname = nullptr;
|
||||
if (device->GetDisplayName(&cname) == S_OK && cname) name = cname;
|
||||
#endif
|
||||
devices.push_back({index, name});
|
||||
raw_devices.push_back(device);
|
||||
index++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user