mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Re-use base_linux_library
This commit is contained in:
parent
d0eb7ec522
commit
48206bcf95
1 changed files with 9 additions and 22 deletions
|
@ -10,19 +10,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/algorithm.h"
|
#include "base/algorithm.h"
|
||||||
#include "logs.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>
|
#include <QImage>
|
||||||
|
|
||||||
#ifdef LIB_FFMPEG_USE_QT_PRIVATE_API
|
#ifdef LIB_FFMPEG_USE_QT_PRIVATE_API
|
||||||
#include <private/qdrawhelper_p.h>
|
#include <private/qdrawhelper_p.h>
|
||||||
#endif // LIB_FFMPEG_USE_QT_PRIVATE_API
|
#endif // LIB_FFMPEG_USE_QT_PRIVATE_API
|
||||||
|
|
||||||
#include <deque>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavutil/opt.h>
|
#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"
|
} // extern "C"
|
||||||
|
|
||||||
namespace FFmpeg {
|
namespace FFmpeg {
|
||||||
|
@ -95,19 +95,10 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
|
||||||
auto list = std::deque{
|
auto list = std::deque{
|
||||||
AV_PIX_FMT_CUDA,
|
AV_PIX_FMT_CUDA,
|
||||||
};
|
};
|
||||||
const auto vdpau = [&] {
|
if (base::Platform::LoadLibrary("libvdpau.so.1")) {
|
||||||
if (const auto handle = dlopen("libvdpau.so.1", RTLD_LAZY)) {
|
|
||||||
dlclose(handle);
|
|
||||||
}
|
|
||||||
if (dlerror()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}();
|
|
||||||
if (vdpau) {
|
|
||||||
list.push_front(AV_PIX_FMT_VDPAU);
|
list.push_front(AV_PIX_FMT_VDPAU);
|
||||||
}
|
}
|
||||||
const auto va = [&] {
|
if ([&] {
|
||||||
const auto list = std::array{
|
const auto list = std::array{
|
||||||
"libva-drm.so.1",
|
"libva-drm.so.1",
|
||||||
"libva-x11.so.1",
|
"libva-x11.so.1",
|
||||||
|
@ -115,16 +106,12 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
|
||||||
"libdrm.so.2",
|
"libdrm.so.2",
|
||||||
};
|
};
|
||||||
for (const auto lib : list) {
|
for (const auto lib : list) {
|
||||||
if (const auto handle = dlopen(lib, RTLD_LAZY)) {
|
if (!base::Platform::LoadLibrary(lib)) {
|
||||||
dlclose(handle);
|
|
||||||
}
|
|
||||||
if (dlerror()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}();
|
}()) {
|
||||||
if (va) {
|
|
||||||
list.push_front(AV_PIX_FMT_VAAPI);
|
list.push_front(AV_PIX_FMT_VAAPI);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
Loading…
Add table
Reference in a new issue