-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
MyDeckLinkAPI.cpp
45 lines (39 loc) · 892 Bytes
/
MyDeckLinkAPI.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "MyDeckLinkAPI.h"
HRESULT GetDeckLinkIterator(IDeckLinkIterator **deckLinkIterator)
{
HRESULT result = S_OK;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
#ifdef Q_OS_WIN
if (CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL, IID_IDeckLinkIterator, (void **)deckLinkIterator) != S_OK) {
*deckLinkIterator = nullptr;
result = E_FAIL;
}
#else
*deckLinkIterator = CreateDeckLinkIteratorInstance();
if (!*deckLinkIterator) {
fprintf(stderr, "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n");
result = E_FAIL;
}
#endif
return result;
}
// DLString
DLString::~DLString()
{
clear();
}
void DLString::clear()
{
if (str) {
#ifdef Q_OS_WIN
SysFreeString(str);
#endif
#ifdef Q_OS_MAC
CFRelease(str);
#endif
#ifdef Q_OS_LINUX
free((void *)str);
#endif
str = nullptr;
}
}