forked from petersimonsson/libqatemcontrol
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathqatemrecording.cpp
More file actions
124 lines (96 loc) · 3.08 KB
/
Copy pathqatemrecording.cpp
File metadata and controls
124 lines (96 loc) · 3.08 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
Copyright 2023 Kaj-Michael Lang <milang@tal.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qatemrecording.h"
QAtemRecording::QAtemRecording(QObject *parent)
: QAtemSubsystemBase{parent}
{
m_commands << "RTMD" << "RTMS" << "RTMR";
m_atemConnection=nullptr;
m_is_supported=false;
}
/**
* @brief QAtemConnection::onRTMD
* @param payload
*
* Recording media information
*/
void QAtemRecording::onRTMD(const QByteArray& payload)
{
QAtem::RecordingInfo r;
r.disk=QAtem::uint32at(payload, 6);
r.available=QAtem::uint32at(payload, 10);
r.volumeName=payload.mid(16, 64);
r.status=static_cast<QAtem::RecordingDiskStatus>(QAtem::uint16at(payload, 14));
m_info.insert(r.disk, r);
emit infoChanged(r);
}
/**
* @brief QAtemConnection::onRTMS
* @param payload
*/
void QAtemRecording::onRTMS(const QByteArray& payload)
{
QAtem::U32_U8 val1, val2;
val1.u8[3] = static_cast<quint8>(payload.at(6));
val1.u8[2] = static_cast<quint8>(payload.at(7));
val1.u8[1] = static_cast<quint8>(payload.at(8));
val1.u8[0] = static_cast<quint8>(payload.at(9));
val2.u8[3] = static_cast<quint8>(payload.at(10));
val2.u8[2] = static_cast<quint8>(payload.at(11));
val2.u8[1] = static_cast<quint8>(payload.at(12));
val2.u8[0] = static_cast<quint8>(payload.at(13));
qDebug() << "RTMS" << payload.size() << ":" << val1.u16 << val1.u16 << val2.u32;
if (!m_is_supported) {
m_is_supported=true;
emit isSupportedChanged();
}
}
/**
* @brief QAtemConnection::onRTMR
* @param payload
*/
void QAtemRecording::onRTMR(const QByteArray& payload)
{
quint8 h,m,s,f;
h = static_cast<quint8>(payload.at(6)); // h
m = static_cast<quint8>(payload.at(7)); // m
s = static_cast<quint8>(payload.at(8)); // s
f = static_cast<quint8>(payload.at(9)); // frame
m_record_framedrop = static_cast<bool>(payload.at(10));
m_record_time.setHMS(h, m, s);
m_record_frame=f;
emit recordingTimeChanged(m_record_time, m_record_frame);
qDebug() << "RTMR" << m_record_time << f << m_record_framedrop;
}
void QAtemRecording::record(bool record)
{
QByteArray cmd("RcTM");
QByteArray payload(4, 0x0);
payload[0] = static_cast<char>(record);
sendCommand(cmd, payload);
}
void QAtemRecording::startRecording()
{
record(true);
}
void QAtemRecording::stopRecording()
{
record(false);
}
void QAtemRecording::requestRecordingStatus()
{
QByteArray cmd("RMDR");
QByteArray payload;
sendCommand(cmd, payload);
}