audio_core: hle: fix compile

This commit is contained in:
liushuyu
2019-01-04 17:06:12 -07:00
committed by B3N30
parent 80b4dd21d2
commit 11e277149c
5 changed files with 38 additions and 16 deletions

View File

@@ -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);
}

View File

@@ -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:

View File

@@ -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