2015-02-18 15:15:38 -08:00
|
|
|
#include "decklink-device-mode.hpp"
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
DeckLinkDeviceMode::DeckLinkDeviceMode(IDeckLinkDisplayMode *mode, long long id)
|
|
|
|
: id(id), mode(mode)
|
2015-02-18 15:15:38 -08:00
|
|
|
{
|
|
|
|
if (mode == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mode->AddRef();
|
|
|
|
|
|
|
|
decklink_string_t decklinkStringName;
|
|
|
|
if (mode->GetName(&decklinkStringName) == S_OK)
|
|
|
|
DeckLinkStringToStdString(decklinkStringName, name);
|
|
|
|
}
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
DeckLinkDeviceMode::DeckLinkDeviceMode(const std::string &name, long long id)
|
|
|
|
: id(id), mode(nullptr), name(name)
|
2015-02-18 15:15:38 -08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DeckLinkDeviceMode::~DeckLinkDeviceMode(void)
|
|
|
|
{
|
|
|
|
if (mode != nullptr)
|
|
|
|
mode->Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
BMDDisplayMode DeckLinkDeviceMode::GetDisplayMode(void) const
|
|
|
|
{
|
|
|
|
if (mode != nullptr)
|
|
|
|
return mode->GetDisplayMode();
|
|
|
|
|
|
|
|
return bmdModeUnknown;
|
|
|
|
}
|
|
|
|
|
2018-09-25 15:51:32 -07:00
|
|
|
int DeckLinkDeviceMode::GetWidth()
|
|
|
|
{
|
|
|
|
if (mode != nullptr)
|
|
|
|
return mode->GetWidth();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DeckLinkDeviceMode::GetHeight()
|
|
|
|
{
|
|
|
|
if (mode != nullptr)
|
|
|
|
return mode->GetHeight();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-05 05:55:06 -07:00
|
|
|
BMDDisplayModeFlags DeckLinkDeviceMode::GetDisplayModeFlags(void) const
|
|
|
|
{
|
|
|
|
if (mode != nullptr)
|
|
|
|
return mode->GetFlags();
|
|
|
|
|
|
|
|
return (BMDDisplayModeFlags)0;
|
|
|
|
}
|
|
|
|
|
2015-02-18 15:15:38 -08:00
|
|
|
long long DeckLinkDeviceMode::GetId(void) const
|
|
|
|
{
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
const std::string &DeckLinkDeviceMode::GetName(void) const
|
2015-02-18 15:15:38 -08:00
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
2017-05-05 05:55:06 -07:00
|
|
|
|
|
|
|
void DeckLinkDeviceMode::SetMode(IDeckLinkDisplayMode *mode_)
|
|
|
|
{
|
|
|
|
IDeckLinkDisplayMode *old = mode;
|
|
|
|
if (old != nullptr)
|
|
|
|
old->Release();
|
|
|
|
|
|
|
|
mode = mode_;
|
|
|
|
if (mode != nullptr)
|
|
|
|
mode->AddRef();
|
|
|
|
}
|