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

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