audio_core: Replace AAC decoders with single FAAD2-based decoder. (#7098)
This commit is contained in:
parent
1570aeffcb
commit
27bad3a699
28 changed files with 304 additions and 2403 deletions
|
@ -76,8 +76,6 @@ add_library(citra_common STATIC
|
|||
construct.h
|
||||
dynamic_library/dynamic_library.cpp
|
||||
dynamic_library/dynamic_library.h
|
||||
dynamic_library/fdk-aac.cpp
|
||||
dynamic_library/fdk-aac.h
|
||||
dynamic_library/ffmpeg.cpp
|
||||
dynamic_library/ffmpeg.h
|
||||
error.cpp
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "common/dynamic_library/dynamic_library.h"
|
||||
#include "common/dynamic_library/fdk-aac.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace DynamicLibrary::FdkAac {
|
||||
|
||||
aacDecoder_GetLibInfo_func aacDecoder_GetLibInfo;
|
||||
aacDecoder_Open_func aacDecoder_Open;
|
||||
aacDecoder_Close_func aacDecoder_Close;
|
||||
aacDecoder_SetParam_func aacDecoder_SetParam;
|
||||
aacDecoder_GetStreamInfo_func aacDecoder_GetStreamInfo;
|
||||
aacDecoder_DecodeFrame_func aacDecoder_DecodeFrame;
|
||||
aacDecoder_Fill_func aacDecoder_Fill;
|
||||
|
||||
static std::unique_ptr<Common::DynamicLibrary> fdk_aac;
|
||||
|
||||
#define LOAD_SYMBOL(library, name) \
|
||||
any_failed = any_failed || (name = library->GetSymbol<name##_func>(#name)) == nullptr
|
||||
|
||||
bool LoadFdkAac() {
|
||||
if (fdk_aac) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fdk_aac = std::make_unique<Common::DynamicLibrary>("fdk-aac", 2);
|
||||
if (!fdk_aac->IsLoaded()) {
|
||||
LOG_WARNING(Common, "Could not dynamically load libfdk-aac: {}", fdk_aac->GetLoadError());
|
||||
fdk_aac.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
auto any_failed = false;
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_GetLibInfo);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_Open);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_Close);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_SetParam);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_GetStreamInfo);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_DecodeFrame);
|
||||
LOAD_SYMBOL(fdk_aac, aacDecoder_Fill);
|
||||
|
||||
if (any_failed) {
|
||||
LOG_WARNING(Common, "Could not find all required functions in libfdk-aac.");
|
||||
fdk_aac.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO(Common, "Successfully loaded libfdk-aac.");
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace DynamicLibrary::FdkAac
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C" {
|
||||
#include <fdk-aac/aacdecoder_lib.h>
|
||||
}
|
||||
|
||||
namespace DynamicLibrary::FdkAac {
|
||||
|
||||
typedef INT (*aacDecoder_GetLibInfo_func)(LIB_INFO* info);
|
||||
typedef HANDLE_AACDECODER (*aacDecoder_Open_func)(TRANSPORT_TYPE transportFmt, UINT nrOfLayers);
|
||||
typedef void (*aacDecoder_Close_func)(HANDLE_AACDECODER self);
|
||||
typedef AAC_DECODER_ERROR (*aacDecoder_SetParam_func)(const HANDLE_AACDECODER self,
|
||||
const AACDEC_PARAM param, const INT value);
|
||||
typedef CStreamInfo* (*aacDecoder_GetStreamInfo_func)(HANDLE_AACDECODER self);
|
||||
typedef AAC_DECODER_ERROR (*aacDecoder_DecodeFrame_func)(HANDLE_AACDECODER self, INT_PCM* pTimeData,
|
||||
const INT timeDataSize, const UINT flags);
|
||||
typedef AAC_DECODER_ERROR (*aacDecoder_Fill_func)(HANDLE_AACDECODER self, UCHAR* pBuffer[],
|
||||
const UINT bufferSize[], UINT* bytesValid);
|
||||
|
||||
extern aacDecoder_GetLibInfo_func aacDecoder_GetLibInfo;
|
||||
extern aacDecoder_Open_func aacDecoder_Open;
|
||||
extern aacDecoder_Close_func aacDecoder_Close;
|
||||
extern aacDecoder_SetParam_func aacDecoder_SetParam;
|
||||
extern aacDecoder_GetStreamInfo_func aacDecoder_GetStreamInfo;
|
||||
extern aacDecoder_DecodeFrame_func aacDecoder_DecodeFrame;
|
||||
extern aacDecoder_Fill_func aacDecoder_Fill;
|
||||
|
||||
bool LoadFdkAac();
|
||||
|
||||
} // namespace DynamicLibrary::FdkAac
|
Loading…
Add table
Add a link
Reference in a new issue