more reviews addressed

This commit is contained in:
B3N30 2018-12-17 19:35:34 +01:00
parent 8fe3e37df5
commit 1581dea6de
3 changed files with 10 additions and 8 deletions

View file

@ -20,7 +20,6 @@ std::optional<BinaryResponse> NullDecoder::ProcessRequest(const BinaryRequest& r
std::memcpy(&response, &request, sizeof(response));
response.unknown1 = 0x0;
return response;
break;
case DecoderCommand::Decode:
response.codec = request.codec;
response.cmd = DecoderCommand::Decode;
@ -28,11 +27,9 @@ std::optional<BinaryResponse> NullDecoder::ProcessRequest(const BinaryRequest& r
response.size = request.size;
response.num_samples = 1024; // Just assume 1024 here
return response;
break;
default:
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
return {};
break;
}
};
} // namespace AudioCore::HLE

View file

@ -8,10 +8,13 @@
#include "audio_core/hle/ffmpeg_dl.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
namespace {
struct LibraryDeleter {
typedef HMODULE pointer;
void operator()(HMODULE h) {
using pointer = HMODULE;
void operator()(HMODULE h) const {
if (h != nullptr)
FreeLibrary(h);
}
@ -20,6 +23,8 @@ struct LibraryDeleter {
std::unique_ptr<HMODULE, LibraryDeleter> dll_util{nullptr};
std::unique_ptr<HMODULE, LibraryDeleter> dll_codec{nullptr};
} // namespace
FuncDL<int(AVSampleFormat)> av_get_bytes_per_sample_dl;
FuncDL<AVFrame*(void)> av_frame_alloc_dl;
FuncDL<void(AVFrame**)> av_frame_free_dl;
@ -40,7 +45,7 @@ FuncDL<void(AVCodecParserContext*)> av_parser_close_dl;
bool InitFFmpegDL() {
std::string dll_path = FileUtil::GetUserPath(FileUtil::UserPath::DLLDir);
FileUtil::CreateDir(dll_path);
std::wstring w_dll_path = std::wstring(dll_path.begin(), dll_path.end());
std::wstring w_dll_path = Common::UTF8ToUTF16W(dll_path);
SetDllDirectoryW(w_dll_path.c_str());
dll_util.reset(LoadLibrary("avutil-56.dll"));

View file

@ -17,9 +17,9 @@ extern "C" {
template <typename T>
struct FuncDL {
FuncDL() = default;
FuncDL(void* dll, const char* name) {
FuncDL(HMODULE dll, const char* name) {
if (dll) {
ptr_function = reinterpret_cast<T*>(GetProcAddress((HMODULE)dll, name));
ptr_function = reinterpret_cast<T*>(GetProcAddress(dll, name));
}
}