decklink: Use ComPtr for variables

This makes sure Decklink variables are automatically released.

Closes https://github.com/obsproject/obs-studio/pull/5508
This commit is contained in:
cg2121 2022-02-20 14:14:24 -06:00 • committed by Jim
commit efce0f41d0
7 changed files with 19 additions and 44 deletions

View file

@ -18,11 +18,7 @@ DeckLinkDeviceMode::DeckLinkDeviceMode(const std::string &name, long long id)
{
}
DeckLinkDeviceMode::~DeckLinkDeviceMode(void)
{
if (mode != nullptr)
mode->Release();
}
DeckLinkDeviceMode::~DeckLinkDeviceMode(void) {}
BMDDisplayMode DeckLinkDeviceMode::GetDisplayMode(void) const
{
@ -82,11 +78,5 @@ bool DeckLinkDeviceMode::IsEqualFrameRate(int64_t num, int64_t den)
void DeckLinkDeviceMode::SetMode(IDeckLinkDisplayMode *mode_)
{
IDeckLinkDisplayMode *old = mode;
if (old != nullptr)
old->Release();
mode = mode_;
if (mode != nullptr)
mode->AddRef();
}