-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
MyDeckLinkAPI.h
101 lines (90 loc) · 1.74 KB
/
MyDeckLinkAPI.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef DECKLINKAPI_H
#define DECKLINKAPI_H
#include <QMetaType>
#include <QString>
#if defined(Q_OS_WIN)
#include "sdk/Win/DeckLinkAPI_h.h"
typedef IID CFUUIDBytes;
class DLString {
private:
BSTR str = nullptr;
public:
~DLString();
void clear();
BSTR *operator & ()
{
return &str;
}
operator QString ()
{
return str ? QString::fromUtf16((ushort const *)str) : QString();
}
operator std::string ()
{
return operator QString ().toStdString();
}
bool empty() const
{
return !(str && *str);
}
};
#elif defined(Q_OS_MAC)
#include "sdk/Mac/include/DeckLinkAPI.h"
typedef bool BOOL;
class DLString {
private:
CFStringRef str = nullptr;
public:
~DLString();
void clear();
CFStringRef *operator & ()
{
return &str;
}
operator QString () const
{
if (!str) return QString();
CFIndex length = CFStringGetLength(str);
if (length == 0) return QString();
QString string(length, Qt::Uninitialized);
CFStringGetCharacters(str, CFRangeMake(0, length), reinterpret_cast<UniChar *>(const_cast<QChar *>(string.unicode())));
return string;
}
operator std::string () const
{
return operator QString ().toStdString();
}
bool empty() const
{
return !(str && CFStringGetLength(str) > 0);
}
};
#elif defined(Q_OS_LINUX)
#include "sdk/Linux/include/DeckLinkAPI.h"
typedef bool BOOL;
class DLString {
private:
char const *str = nullptr;
public:
~DLString();
void clear();
char const **operator & ()
{
return &str;
}
operator QString () const
{
return str ? QString::fromUtf8(str) : QString();
}
operator std::string () const
{
return str ? std::string(str) : std::string();
}
bool empty() const
{
return !(str && *str);
}
};
#endif
HRESULT GetDeckLinkIterator(IDeckLinkIterator **deckLinkIterator);
#endif // DECKLINKAPI_H