audio_core: hle: fix compile
This commit is contained in:
parent
80b4dd21d2
commit
11e277149c
5 changed files with 38 additions and 16 deletions
|
@ -29,6 +29,7 @@ add_library(audio_core STATIC
|
|||
|
||||
$<$<BOOL:${SDL2_FOUND}>:sdl2_sink.cpp sdl2_sink.h>
|
||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h>
|
||||
$<$<BOOL:${FFMPEG_FOUND}>:hle/ffmpeg_decoder.cpp hle/ffmpeg_decoder.h hle/ffmpeg_dl.cpp hle/ffmpeg_dl.h>
|
||||
$<$<BOOL:${ENABLE_MF}>:hle/wmf_decoder.cpp hle/wmf_decoder.h hle/wmf_decoder_utils.cpp hle/wmf_decoder_utils.h hle/adts_reader.c>
|
||||
)
|
||||
|
||||
|
@ -37,6 +38,15 @@ create_target_directory_groups(audio_core)
|
|||
target_link_libraries(audio_core PUBLIC common core)
|
||||
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
if(UNIX)
|
||||
target_link_libraries(audio_core PRIVATE FFmpeg::avcodec)
|
||||
else()
|
||||
target_include_directories(audio_core PRIVATE ${FFMPEG_DIR}/include)
|
||||
endif()
|
||||
target_compile_definitions(audio_core PUBLIC HAVE_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MF)
|
||||
target_link_libraries(audio_core PRIVATE mf.lib mfplat.lib mfuuid.lib)
|
||||
target_compile_definitions(audio_core PUBLIC HAVE_MF)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/hle/aac_decoder.h"
|
||||
#include "audio_core/hle/ffmpeg_decoder.h"
|
||||
#include "audio_core/hle/ffmpeg_dl.h"
|
||||
|
||||
namespace AudioCore::HLE {
|
||||
|
||||
class AACDecoder::Impl {
|
||||
class FFMPEGDecoder::Impl {
|
||||
public:
|
||||
explicit Impl(Memory::MemorySystem& memory);
|
||||
~Impl();
|
||||
|
@ -56,13 +56,13 @@ private:
|
|||
std::unique_ptr<AVFrame, AVFrameDeleter> decoded_frame;
|
||||
};
|
||||
|
||||
AACDecoder::Impl::Impl(Memory::MemorySystem& memory) : memory(memory) {
|
||||
FFMPEGDecoder::Impl::Impl(Memory::MemorySystem& memory) : memory(memory) {
|
||||
have_ffmpeg_dl = InitFFmpegDL();
|
||||
}
|
||||
|
||||
AACDecoder::Impl::~Impl() = default;
|
||||
FFMPEGDecoder::Impl::~Impl() = default;
|
||||
|
||||
std::optional<BinaryResponse> AACDecoder::Impl::ProcessRequest(const BinaryRequest& request) {
|
||||
std::optional<BinaryResponse> FFMPEGDecoder::Impl::ProcessRequest(const BinaryRequest& request) {
|
||||
if (request.codec != DecoderCodec::AAC) {
|
||||
LOG_ERROR(Audio_DSP, "Got wrong codec {}", static_cast<u16>(request.codec));
|
||||
return {};
|
||||
|
@ -87,7 +87,7 @@ std::optional<BinaryResponse> AACDecoder::Impl::ProcessRequest(const BinaryReque
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<BinaryResponse> AACDecoder::Impl::Initalize(const BinaryRequest& request) {
|
||||
std::optional<BinaryResponse> FFMPEGDecoder::Impl::Initalize(const BinaryRequest& request) {
|
||||
if (initalized) {
|
||||
Clear();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ std::optional<BinaryResponse> AACDecoder::Impl::Initalize(const BinaryRequest& r
|
|||
return response;
|
||||
}
|
||||
|
||||
void AACDecoder::Impl::Clear() {
|
||||
void FFMPEGDecoder::Impl::Clear() {
|
||||
if (!have_ffmpeg_dl) {
|
||||
return;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void AACDecoder::Impl::Clear() {
|
|||
av_packet.reset();
|
||||
}
|
||||
|
||||
std::optional<BinaryResponse> AACDecoder::Impl::Decode(const BinaryRequest& request) {
|
||||
std::optional<BinaryResponse> FFMPEGDecoder::Impl::Decode(const BinaryRequest& request) {
|
||||
BinaryResponse response;
|
||||
response.codec = request.codec;
|
||||
response.cmd = request.cmd;
|
||||
|
@ -252,11 +252,11 @@ std::optional<BinaryResponse> AACDecoder::Impl::Decode(const BinaryRequest& requ
|
|||
return response;
|
||||
}
|
||||
|
||||
AACDecoder::AACDecoder(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(memory)) {}
|
||||
FFMPEGDecoder::FFMPEGDecoder(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(memory)) {}
|
||||
|
||||
AACDecoder::~AACDecoder() = default;
|
||||
FFMPEGDecoder::~FFMPEGDecoder() = default;
|
||||
|
||||
std::optional<BinaryResponse> AACDecoder::ProcessRequest(const BinaryRequest& request) {
|
||||
std::optional<BinaryResponse> FFMPEGDecoder::ProcessRequest(const BinaryRequest& request) {
|
||||
return impl->ProcessRequest(request);
|
||||
}
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
namespace AudioCore::HLE {
|
||||
|
||||
class AACDecoder final : public DecoderBase {
|
||||
class FFMPEGDecoder final : public DecoderBase {
|
||||
public:
|
||||
explicit AACDecoder(Memory::MemorySystem& memory);
|
||||
~AACDecoder() override;
|
||||
explicit FFMPEGDecoder(Memory::MemorySystem& memory);
|
||||
~FFMPEGDecoder() override;
|
||||
std::optional<BinaryResponse> ProcessRequest(const BinaryRequest& request) override;
|
||||
|
||||
private:
|
|
@ -5,6 +5,8 @@
|
|||
#include "audio_core/audio_types.h"
|
||||
#ifdef HAVE_MF
|
||||
#include "audio_core/hle/wmf_decoder.h"
|
||||
#elif HAVE_FFMPEG
|
||||
#include "audio_core/hle/ffmpeg_decoder.h"
|
||||
#endif
|
||||
#include "audio_core/hle/common.h"
|
||||
#include "audio_core/hle/decoder.h"
|
||||
|
@ -87,8 +89,10 @@ DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory) : parent(paren
|
|||
|
||||
#ifdef HAVE_MF
|
||||
decoder = std::make_unique<HLE::WMFDecoder>(memory);
|
||||
#elif HAVE_FFMPEG
|
||||
decoder = std::make_unique<HLE::FFMPEGDecoder>(memory);
|
||||
#else
|
||||
LOG_WARNING(Audio_DSP, "FFmpeg missing, this could lead to missing audio");
|
||||
LOG_WARNING(Audio_DSP, "No decoder found, this could lead to missing audio");
|
||||
decoder = std::make_unique<HLE::NullDecoder>();
|
||||
#endif // HAVE_MF
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue