yolobs-studio/plugins/decklink/decklink-device-mode.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
1.4 KiB
C++
Raw Normal View History

2016-02-23 23:16:51 +00:00
#include "decklink-device-mode.hpp"
2019-09-22 21:19:10 +00:00
DeckLinkDeviceMode::DeckLinkDeviceMode(IDeckLinkDisplayMode *mode, long long id)
: id(id), mode(mode)
2016-02-23 23:16:51 +00:00
{
if (mode == nullptr)
return;
mode->AddRef();
decklink_string_t decklinkStringName;
if (mode->GetName(&decklinkStringName) == S_OK)
DeckLinkStringToStdString(decklinkStringName, name);
}
2019-09-22 21:19:10 +00:00
DeckLinkDeviceMode::DeckLinkDeviceMode(const std::string &name, long long id)
: id(id), mode(nullptr), name(name)
2016-02-23 23:16:51 +00:00
{
}
DeckLinkDeviceMode::~DeckLinkDeviceMode(void)
{
if (mode != nullptr)
mode->Release();
}
BMDDisplayMode DeckLinkDeviceMode::GetDisplayMode(void) const
{
if (mode != nullptr)
return mode->GetDisplayMode();
return bmdModeUnknown;
}
2019-07-27 12:47:10 +00:00
int DeckLinkDeviceMode::GetWidth()
{
if (mode != nullptr)
return mode->GetWidth();
return 0;
}
int DeckLinkDeviceMode::GetHeight()
{
if (mode != nullptr)
return mode->GetHeight();
return 0;
}
2018-02-19 19:54:37 +00:00
BMDDisplayModeFlags DeckLinkDeviceMode::GetDisplayModeFlags(void) const
{
if (mode != nullptr)
return mode->GetFlags();
return (BMDDisplayModeFlags)0;
}
2016-02-23 23:16:51 +00:00
long long DeckLinkDeviceMode::GetId(void) const
{
return id;
}
2019-09-22 21:19:10 +00:00
const std::string &DeckLinkDeviceMode::GetName(void) const
2016-02-23 23:16:51 +00:00
{
return name;
}
2018-02-19 19:54:37 +00:00
void DeckLinkDeviceMode::SetMode(IDeckLinkDisplayMode *mode_)
{
IDeckLinkDisplayMode *old = mode;
if (old != nullptr)
old->Release();
mode = mode_;
if (mode != nullptr)
mode->AddRef();
}