mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
RPC: Remove usage of std::optional
Stupid 10.13 doesnt support C++17. No idea how we built 4.9.0
This commit is contained in:
parent
d0d89dd133
commit
b5f267d3bb
@ -252,14 +252,14 @@ void WSEvents::broadcastUpdate(const char* updateType,
|
|||||||
if (!_srv->isListening()) {
|
if (!_srv->isListening()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::optional<uint64_t> streamTime;
|
uint64_t streamTime = 0;
|
||||||
if (obs_frontend_streaming_active()) {
|
if (obs_frontend_streaming_active()) {
|
||||||
streamTime = std::make_optional(getStreamingTime());
|
streamTime = getStreamingTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<uint64_t> recordingTime;
|
uint64_t recordingTime;
|
||||||
if (obs_frontend_recording_active()) {
|
if (obs_frontend_recording_active()) {
|
||||||
recordingTime = std::make_optional(getRecordingTime());
|
recordingTime = getRecordingTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcEvent event(QString(updateType), streamTime, recordingTime, additionalFields);
|
RpcEvent event(QString(updateType), streamTime, recordingTime, additionalFields);
|
||||||
|
@ -64,15 +64,15 @@ std::string OBSRemoteProtocol::encodeEvent(const RpcEvent& event)
|
|||||||
QString updateType = event.updateType();
|
QString updateType = event.updateType();
|
||||||
obs_data_set_string(eventData, "update-type", updateType.toUtf8().constData());
|
obs_data_set_string(eventData, "update-type", updateType.toUtf8().constData());
|
||||||
|
|
||||||
std::optional<uint64_t> streamTime = event.streamTime();
|
auto streamTime = event.streamTime();
|
||||||
if (streamTime.has_value()) {
|
if (streamTime) {
|
||||||
QString streamingTimecode = Utils::nsToTimestamp(streamTime.value());
|
QString streamingTimecode = Utils::nsToTimestamp(streamTime);
|
||||||
obs_data_set_string(eventData, "stream-timecode", streamingTimecode.toUtf8().constData());
|
obs_data_set_string(eventData, "stream-timecode", streamingTimecode.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<uint64_t> recordingTime = event.recordingTime();
|
auto recordingTime = event.recordingTime();
|
||||||
if (recordingTime.has_value()) {
|
if (recordingTime) {
|
||||||
QString recordingTimecode = Utils::nsToTimestamp(recordingTime.value());
|
QString recordingTimecode = Utils::nsToTimestamp(recordingTime);
|
||||||
obs_data_set_string(eventData, "rec-timecode", recordingTimecode.toUtf8().constData());
|
obs_data_set_string(eventData, "rec-timecode", recordingTimecode.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
RpcEvent::RpcEvent(
|
RpcEvent::RpcEvent(
|
||||||
const QString& updateType,
|
const QString& updateType,
|
||||||
std::optional<uint64_t> streamTime, std::optional<uint64_t> recordingTime,
|
uint64_t streamTime, uint64_t recordingTime,
|
||||||
obs_data_t* additionalFields
|
obs_data_t* additionalFields
|
||||||
) :
|
) :
|
||||||
_updateType(updateType),
|
_updateType(updateType),
|
||||||
|
@ -18,7 +18,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <optional>
|
|
||||||
#include <obs-data.h>
|
#include <obs-data.h>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class RpcEvent
|
|||||||
public:
|
public:
|
||||||
explicit RpcEvent(
|
explicit RpcEvent(
|
||||||
const QString& updateType,
|
const QString& updateType,
|
||||||
std::optional<uint64_t> streamTime, std::optional<uint64_t> recordingTime,
|
uint64_t streamTime, uint64_t recordingTime,
|
||||||
obs_data_t* additionalFields = nullptr
|
obs_data_t* additionalFields = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -38,12 +37,12 @@ public:
|
|||||||
return _updateType;
|
return _updateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::optional<uint64_t> streamTime() const
|
const uint64_t streamTime() const
|
||||||
{
|
{
|
||||||
return _streamTime;
|
return _streamTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::optional<uint64_t> recordingTime() const
|
const uint64_t recordingTime() const
|
||||||
{
|
{
|
||||||
return _recordingTime;
|
return _recordingTime;
|
||||||
}
|
}
|
||||||
@ -55,7 +54,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString _updateType;
|
QString _updateType;
|
||||||
std::optional<uint64_t> _streamTime;
|
uint64_t _streamTime;
|
||||||
std::optional<uint64_t> _recordingTime;
|
uint64_t _recordingTime;
|
||||||
OBSDataAutoRelease _additionalFields;
|
OBSDataAutoRelease _additionalFields;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user