more reviews addressed

This commit is contained in:
B3N30 2018-12-17 19:35:34 +01:00
parent 958b4167cf
commit 42c03032b8
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)); std::memcpy(&response, &request, sizeof(response));
response.unknown1 = 0x0; response.unknown1 = 0x0;
return response; return response;
break;
case DecoderCommand::Decode: case DecoderCommand::Decode:
response.codec = request.codec; response.codec = request.codec;
response.cmd = DecoderCommand::Decode; response.cmd = DecoderCommand::Decode;
@ -28,11 +27,9 @@ std::optional<BinaryResponse> NullDecoder::ProcessRequest(const BinaryRequest& r
response.size = request.size; response.size = request.size;
response.num_samples = 1024; // Just assume 1024 here response.num_samples = 1024; // Just assume 1024 here
return response; return response;
break;
default: default:
LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd)); LOG_ERROR(Audio_DSP, "Got unknown binary request: {}", static_cast<u16>(request.cmd));
return {}; return {};
break;
} }
}; };
} // namespace AudioCore::HLE } // namespace AudioCore::HLE

View File

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

View File

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