Fix packaged conditions in lib_ffmpeg and Packer

This commit is contained in:
Ilya Fedin 2025-06-01 06:29:08 +00:00 committed by John Preston
parent ecf1fa2bbd
commit 7e418a16ae
5 changed files with 17 additions and 9 deletions

View file

@ -1989,6 +1989,10 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins
desktop-app::external_openssl desktop-app::external_openssl
) )
if (DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(Packer PRIVATE PACKER_USE_PACKAGED)
endif()
set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
endif() endif()
elseif (build_winstore) elseif (build_winstore)

View file

@ -283,7 +283,7 @@ int main(int argc, char *argv[])
cout << "Compression start, size: " << resultSize << "\n"; cout << "Compression start, size: " << resultSize << "\n";
QByteArray compressed, resultCheck; QByteArray compressed, resultCheck;
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win #if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size

View file

@ -27,7 +27,7 @@ extern "C" {
#include <openssl/evp.h> #include <openssl/evp.h>
} // extern "C" } // extern "C"
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win #if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
#include <LzmaLib.h> #include <LzmaLib.h>
#else #else
#include <lzma.h> #include <lzma.h>

View file

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

View file

@ -29,6 +29,10 @@ PUBLIC
desktop-app::external_ffmpeg desktop-app::external_ffmpeg
) )
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(lib_ffmpeg PRIVATE LIB_FFMPEG_USE_IMPLIB)
endif()
if (DESKTOP_APP_SPECIAL_TARGET) if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_definitions(lib_ffmpeg PRIVATE LIB_FFMPEG_USE_QT_PRIVATE_API) target_compile_definitions(lib_ffmpeg PRIVATE LIB_FFMPEG_USE_QT_PRIVATE_API)
endif() endif()