2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Minimize amount of code to rebuild when switching options

This commit is contained in:
Ilya Fedin
2023-09-22 04:24:11 +04:00
committed by John Preston
parent 3db0b11a6b
commit 1bde096417
16 changed files with 82 additions and 51 deletions

View File

@@ -10,10 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/algorithm.h"
#include "logs.h"
#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#include "base/platform/linux/base_linux_library.h"
#include <deque>
#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#include <QImage>
@@ -90,7 +90,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
#endif // LIB_FFMPEG_USE_QT_PRIVATE_API
}
#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
[[nodiscard]] auto CheckHwLibs() {
auto list = std::deque{
AV_PIX_FMT_CUDA,
@@ -116,7 +116,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
}
return list;
}
#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
[[nodiscard]] bool InitHw(AVCodecContext *context, AVHWDeviceType type) {
AVCodecContext *parent = static_cast<AVCodecContext*>(context->opaque);
@@ -158,9 +158,9 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
}
return false;
};
#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
static const auto list = CheckHwLibs();
#else // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#else // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
const auto list = std::array{
#ifdef Q_OS_WIN
AV_PIX_FMT_D3D11,
@@ -174,7 +174,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
AV_PIX_FMT_CUDA,
#endif // Q_OS_WIN || Q_OS_MAC
};
#endif // DESKTOP_APP_USE_PACKAGED || Q_OS_WIN || Q_OS_MAC
#endif // TDESKTOP_USE_PACKAGED || Q_OS_WIN || Q_OS_MAC
for (const auto format : list) {
if (!has(format)) {
continue;