audio_core: hle: fix compile
This commit is contained in:
parent
80b4dd21d2
commit
11e277149c
|
@ -29,6 +29,7 @@ add_library(audio_core STATIC
|
||||||
|
|
||||||
$<$<BOOL:${SDL2_FOUND}>:sdl2_sink.cpp sdl2_sink.h>
|
$<$<BOOL:${SDL2_FOUND}>:sdl2_sink.cpp sdl2_sink.h>
|
||||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_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>
|
$<$<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 PUBLIC common core)
|
||||||
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
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)
|
if(ENABLE_MF)
|
||||||
target_link_libraries(audio_core PRIVATE mf.lib mfplat.lib mfuuid.lib)
|
target_link_libraries(audio_core PRIVATE mf.lib mfplat.lib mfuuid.lib)
|
||||||
target_compile_definitions(audio_core PUBLIC HAVE_MF)
|
target_compile_definitions(audio_core PUBLIC HAVE_MF)
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// 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"
|
#include "audio_core/hle/ffmpeg_dl.h"
|
||||||
|
|
||||||
namespace AudioCore::HLE {
|
namespace AudioCore::HLE {
|
||||||
|
|
||||||
class AACDecoder::Impl {
|
class FFMPEGDecoder::Impl {
|
||||||
public:
|
public:
|
||||||
explicit Impl(Memory::MemorySystem& memory);
|
explicit Impl(Memory::MemorySystem& memory);
|
||||||
~Impl();
|
~Impl();
|
||||||
|
@ -56,13 +56,13 @@ private:
|
||||||
std::unique_ptr<AVFrame, AVFrameDeleter> decoded_frame;
|
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();
|
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) {
|
if (request.codec != DecoderCodec::AAC) {
|
||||||
LOG_ERROR(Audio_DSP, "Got wrong codec {}", static_cast<u16>(request.codec));
|
LOG_ERROR(Audio_DSP, "Got wrong codec {}", static_cast<u16>(request.codec));
|
||||||
return {};
|
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) {
|
if (initalized) {
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ std::optional<BinaryResponse> AACDecoder::Impl::Initalize(const BinaryRequest& r
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AACDecoder::Impl::Clear() {
|
void FFMPEGDecoder::Impl::Clear() {
|
||||||
if (!have_ffmpeg_dl) {
|
if (!have_ffmpeg_dl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ void AACDecoder::Impl::Clear() {
|
||||||
av_packet.reset();
|
av_packet.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<BinaryResponse> AACDecoder::Impl::Decode(const BinaryRequest& request) {
|
std::optional<BinaryResponse> FFMPEGDecoder::Impl::Decode(const BinaryRequest& request) {
|
||||||
BinaryResponse response;
|
BinaryResponse response;
|
||||||
response.codec = request.codec;
|
response.codec = request.codec;
|
||||||
response.cmd = request.cmd;
|
response.cmd = request.cmd;
|
||||||
|
@ -252,11 +252,11 @@ std::optional<BinaryResponse> AACDecoder::Impl::Decode(const BinaryRequest& requ
|
||||||
return response;
|
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);
|
return impl->ProcessRequest(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
namespace AudioCore::HLE {
|
namespace AudioCore::HLE {
|
||||||
|
|
||||||
class AACDecoder final : public DecoderBase {
|
class FFMPEGDecoder final : public DecoderBase {
|
||||||
public:
|
public:
|
||||||
explicit AACDecoder(Memory::MemorySystem& memory);
|
explicit FFMPEGDecoder(Memory::MemorySystem& memory);
|
||||||
~AACDecoder() override;
|
~FFMPEGDecoder() override;
|
||||||
std::optional<BinaryResponse> ProcessRequest(const BinaryRequest& request) override;
|
std::optional<BinaryResponse> ProcessRequest(const BinaryRequest& request) override;
|
||||||
|
|
||||||
private:
|
private:
|
|
@ -5,6 +5,8 @@
|
||||||
#include "audio_core/audio_types.h"
|
#include "audio_core/audio_types.h"
|
||||||
#ifdef HAVE_MF
|
#ifdef HAVE_MF
|
||||||
#include "audio_core/hle/wmf_decoder.h"
|
#include "audio_core/hle/wmf_decoder.h"
|
||||||
|
#elif HAVE_FFMPEG
|
||||||
|
#include "audio_core/hle/ffmpeg_decoder.h"
|
||||||
#endif
|
#endif
|
||||||
#include "audio_core/hle/common.h"
|
#include "audio_core/hle/common.h"
|
||||||
#include "audio_core/hle/decoder.h"
|
#include "audio_core/hle/decoder.h"
|
||||||
|
@ -87,8 +89,10 @@ DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory) : parent(paren
|
||||||
|
|
||||||
#ifdef HAVE_MF
|
#ifdef HAVE_MF
|
||||||
decoder = std::make_unique<HLE::WMFDecoder>(memory);
|
decoder = std::make_unique<HLE::WMFDecoder>(memory);
|
||||||
|
#elif HAVE_FFMPEG
|
||||||
|
decoder = std::make_unique<HLE::FFMPEGDecoder>(memory);
|
||||||
#else
|
#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>();
|
decoder = std::make_unique<HLE::NullDecoder>();
|
||||||
#endif // HAVE_MF
|
#endif // HAVE_MF
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2017 Citra Emulator Project
|
// Copyright 2017 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
#ifdef HAVE_MF
|
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -12,7 +12,11 @@
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
#include "audio_core/hle/decoder.h"
|
#include "audio_core/hle/decoder.h"
|
||||||
|
#ifdef HAVE_MF
|
||||||
#include "audio_core/hle/wmf_decoder.h"
|
#include "audio_core/hle/wmf_decoder.h"
|
||||||
|
#elif HAVE_FFMPEG
|
||||||
|
#include "audio_core/hle/ffmpeg_decoder.h"
|
||||||
|
#endif
|
||||||
#include "audio_fixures.h"
|
#include "audio_fixures.h"
|
||||||
|
|
||||||
TEST_CASE("DSP HLE Audio Decoder", "[audio_core]") {
|
TEST_CASE("DSP HLE Audio Decoder", "[audio_core]") {
|
||||||
|
@ -23,7 +27,11 @@ TEST_CASE("DSP HLE Audio Decoder", "[audio_core]") {
|
||||||
SECTION("decoder should produce correct samples") {
|
SECTION("decoder should produce correct samples") {
|
||||||
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
||||||
auto decoder =
|
auto decoder =
|
||||||
|
#ifdef HAVE_MF
|
||||||
std::make_unique<AudioCore::HLE::WMFDecoder>(*Core::System::GetInstance().memory);
|
std::make_unique<AudioCore::HLE::WMFDecoder>(*Core::System::GetInstance().memory);
|
||||||
|
#elif HAVE_FFMPEG
|
||||||
|
std::make_unique<AudioCore::HLE::FFMPEGDecoder>(*Core::System::GetInstance().memory);
|
||||||
|
#endif
|
||||||
AudioCore::HLE::BinaryRequest request;
|
AudioCore::HLE::BinaryRequest request;
|
||||||
|
|
||||||
request.codec = AudioCore::HLE::DecoderCodec::AAC;
|
request.codec = AudioCore::HLE::DecoderCodec::AAC;
|
||||||
|
|
Reference in New Issue