From 42c03032b8d54ad00cd4b531d258a5e78f6a4c04 Mon Sep 17 00:00:00 2001 From: B3N30 Date: Mon, 17 Dec 2018 19:35:34 +0100 Subject: [PATCH] more reviews addressed --- src/audio_core/hle/decoder.cpp | 3 --- src/audio_core/hle/ffmpeg_dl.cpp | 11 ++++++++--- src/audio_core/hle/ffmpeg_dl.h | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/audio_core/hle/decoder.cpp b/src/audio_core/hle/decoder.cpp index e181e3cde..6569a6f45 100644 --- a/src/audio_core/hle/decoder.cpp +++ b/src/audio_core/hle/decoder.cpp @@ -20,7 +20,6 @@ std::optional 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 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(request.cmd)); return {}; - break; } }; } // namespace AudioCore::HLE diff --git a/src/audio_core/hle/ffmpeg_dl.cpp b/src/audio_core/hle/ffmpeg_dl.cpp index 0a3b2148c..073d0aedd 100644 --- a/src/audio_core/hle/ffmpeg_dl.cpp +++ b/src/audio_core/hle/ffmpeg_dl.cpp @@ -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 dll_util{nullptr}; std::unique_ptr dll_codec{nullptr}; +} // namespace + FuncDL av_get_bytes_per_sample_dl; FuncDL av_frame_alloc_dl; FuncDL av_frame_free_dl; @@ -40,7 +45,7 @@ FuncDL 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")); diff --git a/src/audio_core/hle/ffmpeg_dl.h b/src/audio_core/hle/ffmpeg_dl.h index a882e4f7b..6ca2066fc 100644 --- a/src/audio_core/hle/ffmpeg_dl.h +++ b/src/audio_core/hle/ffmpeg_dl.h @@ -17,9 +17,9 @@ extern "C" { template struct FuncDL { FuncDL() = default; - FuncDL(void* dll, const char* name) { + FuncDL(HMODULE dll, const char* name) { if (dll) { - ptr_function = reinterpret_cast(GetProcAddress((HMODULE)dll, name)); + ptr_function = reinterpret_cast(GetProcAddress(dll, name)); } }