-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecordingControl.cpp
65 lines (53 loc) · 1.97 KB
/
RecordingControl.cpp
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
#include "RecordingControl.h"
#include <iostream>
#include <chrono>
#include <thread>
HRESULT StartRecording(IBMDSwitcher* switcher) {
HRESULT result;
// Check if ISO recording is supported
IBMDSwitcherRecordAV* recordAV = nullptr;
result = switcher->QueryInterface(IID_IBMDSwitcherRecordAV, (void**)&recordAV);
if (result == S_OK && recordAV) {
Boolean supportsISORecording = false;
result = recordAV->DoesSupportISORecording(reinterpret_cast<bool*>(&supportsISORecording));
if (result == S_OK && supportsISORecording) {
std::cout << "ISO recording is supported!" << std::endl;
// Start recording
result = recordAV->StartRecording();
if (result == S_OK) {
//std::cout << "Recording started!" << std::endl;
return S_OK;
} else {
std::cerr << "Failed to start recording!" << std::endl;
}
} else {
std::cout << "ISO recording is not supported." << std::endl;
}
// Release the recordAV interface
recordAV->Release();
} else {
std::cerr << "Failed to obtain IBMDSwitcherRecordAV interface!" << std::endl;
}
return result;
}
HRESULT StopRecording(IBMDSwitcher* switcher) {
HRESULT result;
// Check if ISO recording is supported
IBMDSwitcherRecordAV* recordAV = nullptr;
result = switcher->QueryInterface(IID_IBMDSwitcherRecordAV, (void**)&recordAV);
if (result == S_OK && recordAV) {
// Stop recording
result = recordAV->StopRecording();
if (result == S_OK) {
//std::cout << "Recording stopped!" << std::endl;
return S_OK;
} else {
std::cerr << "Failed to stop recording!" << std::endl;
}
// Release the recordAV interface
recordAV->Release();
} else {
std::cerr << "Failed to obtain IBMDSwitcherRecordAV interface!" << std::endl;
}
return result;
}