UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
decklink_temperature.cpp File Reference
#include <cstdint>
#include <iostream>
#include "../ext-deps/DeckLink/Linux/DeckLinkAPI.h"
Include dependency graph for decklink_temperature.cpp:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

In Linux, link with DeckLinkAPIDispatch.cpp.

See also StatusMonitor.cpp BMD SDK example.

This file may be safely removed - nothing depends on it.

Todo
Now most of the devices doesn't implement temperature interface. When it does, consider merging this to UltraGrid. (Also check usual range and units - some warning about overheating can be issued.)

Definition in file decklink_temperature.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 27 of file decklink_temperature.cpp.

27 {
28 cout << "Prints temperatures for all BMD devices. Takes no argument.\n\n";
29 IDeckLinkIterator *deckLinkIterator = nullptr;
30#ifdef WIN32
31 // Initialize COM on this thread
32 HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
33 if (FAILED(result)) {
34 return 2;
35 }
36 result = CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL,
37 IID_IDeckLinkIterator, (void **) &deckLinkIterator);
38 if (FAILED(result)) {
39 return 2;
40 }
41#else
42 deckLinkIterator = CreateDeckLinkIteratorInstance();
43#endif
44 if (deckLinkIterator == nullptr) {
45 return 1;
46 }
47
48 int numDevices = 0;
49 // Enumerate all cards in this system
50 IDeckLink *deckLink = nullptr;
51 while (deckLinkIterator->Next(&deckLink) == S_OK)
52 {
53 IDeckLinkStatus *stat = nullptr;
54 deckLink->QueryInterface(IID_IDeckLinkStatus, reinterpret_cast<void**>(&stat));
55 int64_t temp;
56 cout << "Device " << numDevices++ << " temperature: ";
57 if (HRESULT res = stat->GetInt(bmdDeckLinkStatusDeviceTemperature, &temp); res != S_OK) {
58 if (res == E_NOTIMPL) {
59 cout << "NOT IMPLEMENTED\n";
60 } else {
61 cout << "error: 0x" << hex << "\n";
62 }
63 } else {
64 cout << temp << "\n";
65 }
66
67 deckLink->Release();
68 }
69 if (numDevices == 0) {
70 cout << "\tno devices found!\n";
71 }
72
73 deckLinkIterator->Release();
74
75#ifdef WIN32
76 CoUninitialize();
77#endif
78}
@ FAILED

References FAILED.