mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Fix MacOS compile error
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
#include "video_decoder_factory.h"
|
||||
|
||||
#if __APPLE__
|
||||
#include "ffmpeg/ffmpeg_video_decoder.h"
|
||||
#else
|
||||
#include "ffmpeg/ffmpeg_video_decoder.h"
|
||||
#include "log.h"
|
||||
#include "nvcodec/nvidia_video_decoder.h"
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
VideoDecoderFactory::VideoDecoderFactory() {}
|
||||
|
||||
@@ -10,6 +15,9 @@ VideoDecoderFactory::~VideoDecoderFactory() {}
|
||||
|
||||
std::unique_ptr<VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
|
||||
bool hardware_acceleration) {
|
||||
#if __APPLE__
|
||||
return std::make_unique<FfmpegVideoDecoder>(FfmpegVideoDecoder());
|
||||
#else
|
||||
if (hardware_acceleration) {
|
||||
if (CheckIsHardwareAccerlerationSupported()) {
|
||||
return std::make_unique<NvidiaVideoDecoder>(NvidiaVideoDecoder());
|
||||
@@ -19,9 +27,13 @@ std::unique_ptr<VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
|
||||
} else {
|
||||
return std::make_unique<FfmpegVideoDecoder>(FfmpegVideoDecoder());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoDecoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
#if __APPLE__
|
||||
return false;
|
||||
#else
|
||||
CUresult cuResult;
|
||||
|
||||
CUvideoctxlock cudaCtxLock;
|
||||
@@ -34,4 +46,5 @@ bool VideoDecoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user