2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add hardware acceleartion video decoding setting.

This commit is contained in:
John Preston
2022-03-30 15:20:11 +04:00
parent 27d9f78566
commit 5167eb47ae
6 changed files with 39 additions and 4 deletions

View File

@@ -128,7 +128,7 @@ QByteArray Settings::serialize() const {
+ Serialize::bytearraySize(_photoEditorBrush)
+ sizeof(qint32) * 3
+ Serialize::stringSize(_customDeviceModel.current())
+ sizeof(qint32) * 2;
+ sizeof(qint32) * 4;
auto result = QByteArray();
result.reserve(size);
@@ -236,6 +236,9 @@ QByteArray Settings::serialize() const {
for (const auto &id : _accountsOrder) {
stream << quint64(id);
}
stream
<< qint32(_hardwareAcceleratedVideo ? 1 : 0);
}
return result;
}
@@ -325,6 +328,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 macWarnBeforeQuit = _macWarnBeforeQuit ? 1 : 0;
qint32 accountsOrderCount = 0;
std::vector<uint64> accountsOrder;
qint32 hardwareAcceleratedVideo = _hardwareAcceleratedVideo ? 1 : 0;
stream >> themesAccentColors;
if (!stream.atEnd()) {
@@ -506,6 +510,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
}
}
}
if (!stream.atEnd()) {
stream >> hardwareAcceleratedVideo;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()"));
@@ -661,7 +668,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
case Media::Player::OrderMode::Reverse:
case Media::Player::OrderMode::Shuffle: _playerOrderMode = uncheckedPlayerOrderMode; break;
}
_macWarnBeforeQuit = macWarnBeforeQuit ? 1 : 0;
_macWarnBeforeQuit = (macWarnBeforeQuit == 1);
_hardwareAcceleratedVideo = (hardwareAcceleratedVideo == 1);
}
QString Settings::getSoundPath(const QString &key) const {

View File

@@ -663,6 +663,13 @@ public:
_accountsOrder = order;
}
[[nodiscard]] bool hardwareAcceleratedVideo() const {
return _hardwareAcceleratedVideo;
}
void setHardwareAcceleratedVideo(bool value) {
_hardwareAcceleratedVideo = value;
}
void setMacWarnBeforeQuit(bool value) {
_macWarnBeforeQuit = value;
}
@@ -775,6 +782,7 @@ private:
rpl::variable<Media::Player::OrderMode> _playerOrderMode;
bool _macWarnBeforeQuit = true;
std::vector<uint64> _accountsOrder;
bool _hardwareAcceleratedVideo = true;
bool _tabbedReplacedWithInfo = false; // per-window
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window