Re-use base_linux_library

This commit is contained in:
Ilya Fedin 2023-08-27 00:08:29 +04:00 committed by John Preston
parent d0eb7ec522
commit 48206bcf95
1 changed files with 9 additions and 22 deletions

View File

@ -10,19 +10,19 @@ 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
#include "base/platform/linux/base_linux_library.h"
#include <deque>
#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#include <QImage>
#ifdef LIB_FFMPEG_USE_QT_PRIVATE_API
#include <private/qdrawhelper_p.h>
#endif // LIB_FFMPEG_USE_QT_PRIVATE_API
#include <deque>
extern "C" {
#include <libavutil/opt.h>
#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#include <dlfcn.h>
#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
} // extern "C"
namespace FFmpeg {
@ -95,19 +95,10 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
auto list = std::deque{
AV_PIX_FMT_CUDA,
};
const auto vdpau = [&] {
if (const auto handle = dlopen("libvdpau.so.1", RTLD_LAZY)) {
dlclose(handle);
}
if (dlerror()) {
return false;
}
return true;
}();
if (vdpau) {
if (base::Platform::LoadLibrary("libvdpau.so.1")) {
list.push_front(AV_PIX_FMT_VDPAU);
}
const auto va = [&] {
if ([&] {
const auto list = std::array{
"libva-drm.so.1",
"libva-x11.so.1",
@ -115,16 +106,12 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
"libdrm.so.2",
};
for (const auto lib : list) {
if (const auto handle = dlopen(lib, RTLD_LAZY)) {
dlclose(handle);
}
if (dlerror()) {
if (!base::Platform::LoadLibrary(lib)) {
return false;
}
}
return true;
}();
if (va) {
}()) {
list.push_front(AV_PIX_FMT_VAAPI);
}
return list;