release v0.22.7
-----BEGIN PGP SIGNATURE----- iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmClOSYQHG1heEBtdXNp Y3BkLm9yZwAKCRAjbopYxttFEkODD/49e950HLmZE8x3rmyeEEsgdvHkOVpPlKHo +wsmSsi+N0sQKgEOffSYyL0MRWaQqzRMnl1EcEVErCfQl5f1mOw9+TL4f5ZEjVNw CQFMy1awHtCfktgF5zq6NzXD3nor9mkjiP733x/kGcsxwfk/Y4radqUBKJ5Y4a2B YSg35a/YTOfLCmb9WBquwAi22x7AkyBzyrY3ToCzynVuaNcT3gvLsAAMFzRUKpqD QEoCtUxJ4CQayjWjtG/bBCs2TVSmJvovhM2xB4Jnm+MeZz+bKI0y+ALW2Wk0Agnd qxDqyCEnvHi5pf8i9usl4/A63VDC7HHj9kDSLtPLGTijv+7Wvvr4kNpwm2DuJ4q1 1pOEgT480ryK1FPyO6XnYCk616NqjgMbplr6SQ1DuVpIddWdiGARoge/WiNvsbT9 pnEp0q9V3cQmuJ30LlskMJHAPyrE3KSrO1s+4P2zUeirwnMnOCPdq+gT+lRw4GNG OqLFEDHaELgSaZxInCN8RCXdLMrpuvKm+FQQApU1KwbYPXIassR14yt6BPpjxqea vkvFLtpwFWthNPLkujak5rDqAPvbHzAeOfaOiZelzd21nl/1omiMXSXRcJkEjONi JC5VWJpi1PHMXocq6AcOQT/9XhIH4uDA+Xghn7CURBTB6WoB954TSmuVIjXTfgAv XQYqRR+7Yw== =Gtzo -----END PGP SIGNATURE----- Merge tag 'v0.22.7' release v0.22.7
This commit is contained in:
commit
96707c0426
2
NEWS
2
NEWS
|
@ -13,7 +13,7 @@ ver 0.23 (not yet released)
|
||||||
* tags
|
* tags
|
||||||
- new tags "ComposerSort", "Ensemble", "Movement", "MovementNumber", and "Location"
|
- new tags "ComposerSort", "Ensemble", "Movement", "MovementNumber", and "Location"
|
||||||
|
|
||||||
ver 0.22.7 (not yet released)
|
ver 0.22.7 (2021/05/19)
|
||||||
* protocol
|
* protocol
|
||||||
- don't use glibc extension to parse time stamps
|
- don't use glibc extension to parse time stamps
|
||||||
- optimize the "albumart" command
|
- optimize the "albumart" command
|
||||||
|
|
23
meson.build
23
meson.build
|
@ -140,10 +140,29 @@ endif
|
||||||
|
|
||||||
if is_windows
|
if is_windows
|
||||||
common_cppflags += [
|
common_cppflags += [
|
||||||
'-DWIN32_LEAN_AND_MEAN',
|
# enable Windows Vista APIs
|
||||||
'-DWINVER=0x0600', '-D_WIN32_WINNT=0x0600',
|
'-DWINVER=0x0600', '-D_WIN32_WINNT=0x0600',
|
||||||
'-DSTRICT',
|
|
||||||
|
# enable Unicode support (TCHAR=wchar_t) in the Windows API (macro
|
||||||
|
# "UNICODE) and the C library (macro "_UNICODE")
|
||||||
'-DUNICODE', '-D_UNICODE',
|
'-DUNICODE', '-D_UNICODE',
|
||||||
|
|
||||||
|
# enable strict type checking in the Windows API headers
|
||||||
|
'-DSTRICT',
|
||||||
|
|
||||||
|
# reduce header bloat by disabling obscure and obsolete Windows
|
||||||
|
# APIs
|
||||||
|
'-DWIN32_LEAN_AND_MEAN',
|
||||||
|
|
||||||
|
# disable more Windows APIs which are not used by MPD
|
||||||
|
'-DNOGDI', '-DNOBITMAP', '-DNOCOMM',
|
||||||
|
'-DNOUSER',
|
||||||
|
|
||||||
|
# reduce COM header bloat
|
||||||
|
'-DCOM_NO_WINDOWS_H',
|
||||||
|
|
||||||
|
# disable Internet Explorer specific APIs
|
||||||
|
'-D_WIN32_IE=0',
|
||||||
]
|
]
|
||||||
|
|
||||||
subdir('win32')
|
subdir('win32')
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void version()
|
||||||
printf("Music Player Daemon " VERSION " (%s)"
|
printf("Music Player Daemon " VERSION " (%s)"
|
||||||
"\n"
|
"\n"
|
||||||
"Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>\n"
|
"Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>\n"
|
||||||
"Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>\n"
|
"Copyright 2008-2021 Max Kellermann <max.kellermann@gmail.com>\n"
|
||||||
"This is free software; see the source for copying conditions. There is NO\n"
|
"This is free software; see the source for copying conditions. There is NO\n"
|
||||||
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
|
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
|
||||||
GIT_VERSION);
|
GIT_VERSION);
|
||||||
|
|
|
@ -61,7 +61,12 @@ Response::WriteBinary(ConstBuffer<void> payload) noexcept
|
||||||
{
|
{
|
||||||
assert(payload.size <= client.binary_limit);
|
assert(payload.size <= client.binary_limit);
|
||||||
|
|
||||||
return Format("binary: %zu\n", payload.size) &&
|
return
|
||||||
|
#ifdef _WIN32
|
||||||
|
Format("binary: %lu\n", (unsigned long)payload.size) &&
|
||||||
|
#else
|
||||||
|
Format("binary: %zu\n", payload.size) &&
|
||||||
|
#endif
|
||||||
Write(payload.data, payload.size) &&
|
Write(payload.data, payload.size) &&
|
||||||
Write("\n");
|
Write("\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,12 @@ read_stream_art(Response &r, const char *uri, size_t offset)
|
||||||
read_size = is->Read(lock, buffer.get(), buffer_size);
|
read_size = is->Read(lock, buffer.get(), buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
r.Format("size: %lu\n", (unsigned long)art_file_size);
|
||||||
|
#else
|
||||||
r.Format("size: %" PRIoffset "\n", art_file_size);
|
r.Format("size: %" PRIoffset "\n", art_file_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.WriteBinary({buffer.get(), read_size});
|
r.WriteBinary({buffer.get(), read_size});
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
|
@ -310,7 +315,11 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
response.Format("size: %lu\n", (unsigned long)buffer.size);
|
||||||
|
#else
|
||||||
response.Format("size: %zu\n", buffer.size);
|
response.Format("size: %zu\n", buffer.size);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mime_type != nullptr)
|
if (mime_type != nullptr)
|
||||||
response.Format("type: %s\n", mime_type);
|
response.Format("type: %s\n", mime_type);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <fileapi.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2003-2021 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// COM needs the "MSG" typedef, and shlwapi.h includes COM headers
|
||||||
|
#undef NOUSER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Glob.hxx"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
|
bool
|
||||||
|
Glob::Check(const char *name_fs) const noexcept
|
||||||
|
{
|
||||||
|
return PathMatchSpecA(name_fs, pattern.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -24,45 +24,44 @@
|
||||||
|
|
||||||
#ifdef HAVE_FNMATCH
|
#ifdef HAVE_FNMATCH
|
||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <string>
|
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <string>
|
|
||||||
#include <shlwapi.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CLASS_GLOB
|
#ifdef HAVE_CLASS_GLOB
|
||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pattern that matches file names. It may contain shell wildcards
|
* A pattern that matches file names. It may contain shell wildcards
|
||||||
* (asterisk and question mark).
|
* (asterisk and question mark).
|
||||||
*/
|
*/
|
||||||
class Glob {
|
class Glob {
|
||||||
#if defined(HAVE_FNMATCH) || defined(_WIN32)
|
|
||||||
std::string pattern;
|
std::string pattern;
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if defined(HAVE_FNMATCH) || defined(_WIN32)
|
|
||||||
explicit Glob(const char *_pattern)
|
explicit Glob(const char *_pattern)
|
||||||
:pattern(_pattern) {}
|
:pattern(_pattern) {}
|
||||||
|
|
||||||
Glob(Glob &&other)
|
Glob(Glob &&other) noexcept = default;
|
||||||
:pattern(std::move(other.pattern)) {}
|
Glob &operator=(Glob &&other) noexcept = default;
|
||||||
#endif
|
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool Check(const char *name_fs) const noexcept {
|
bool Check(const char *name_fs) const noexcept;
|
||||||
#ifdef HAVE_FNMATCH
|
|
||||||
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
return PathMatchSpecA(name_fs, pattern.c_str());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#ifdef HAVE_FNMATCH
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
Glob::Check(const char *name_fs) const noexcept
|
||||||
|
{
|
||||||
|
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* HAVE_CLASS_GLOB */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#undef NOUSER // COM needs the "MSG" typedef, and shlobj.h includes COM headers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "StandardDirectory.hxx"
|
#include "StandardDirectory.hxx"
|
||||||
#include "FileSystem.hxx"
|
#include "FileSystem.hxx"
|
||||||
#include "XDG.hxx"
|
#include "XDG.hxx"
|
||||||
|
|
|
@ -42,7 +42,10 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <fileapi.h>
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <handleapi.h> // for INVALID_HANDLE_VALUE
|
||||||
|
#include <winbase.h> // for FILE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) && !defined(ANDROID)
|
#if defined(__linux__) && !defined(ANDROID)
|
||||||
|
|
|
@ -35,7 +35,10 @@
|
||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <fileapi.h>
|
||||||
|
#include <handleapi.h> // for INVALID_HANDLE_VALUE
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <winbase.h> // for FILE_CURRENT
|
||||||
#else
|
#else
|
||||||
#include "io/UniqueFileDescriptor.hxx"
|
#include "io/UniqueFileDescriptor.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,7 @@ fs_sources = [
|
||||||
'Traits.cxx',
|
'Traits.cxx',
|
||||||
'Config.cxx',
|
'Config.cxx',
|
||||||
'Charset.cxx',
|
'Charset.cxx',
|
||||||
|
'Glob.cxx',
|
||||||
'Path.cxx',
|
'Path.cxx',
|
||||||
'Path2.cxx',
|
'Path2.cxx',
|
||||||
'AllocatedPath.cxx',
|
'AllocatedPath.cxx',
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#undef NOUSER // COM needs the "MSG" typedef
|
||||||
|
|
||||||
#include "output/plugins/wasapi/ForMixer.hxx"
|
#include "output/plugins/wasapi/ForMixer.hxx"
|
||||||
#include "output/plugins/wasapi/AudioClient.hxx"
|
#include "output/plugins/wasapi/AudioClient.hxx"
|
||||||
#include "output/plugins/wasapi/Device.hxx"
|
#include "output/plugins/wasapi/Device.hxx"
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
#include <handleapi.h>
|
||||||
|
#include <synchapi.h>
|
||||||
|
#include <winbase.h> // for INFINITE
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windef.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
||||||
struct WinmmOutput;
|
struct WinmmOutput;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#undef NOUSER // COM needs the "MSG" typedef
|
||||||
|
|
||||||
#include "WasapiOutputPlugin.hxx"
|
#include "WasapiOutputPlugin.hxx"
|
||||||
#include "ForMixer.hxx"
|
#include "ForMixer.hxx"
|
||||||
#include "AudioClient.hxx"
|
#include "AudioClient.hxx"
|
||||||
|
@ -607,10 +609,10 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
|
||||||
throw MakeHResultError(result, "Unable to get device period");
|
throw MakeHResultError(result, "Unable to get device period");
|
||||||
}
|
}
|
||||||
FormatDebug(wasapi_output_domain,
|
FormatDebug(wasapi_output_domain,
|
||||||
"Default device period: %I64u ns, Minimum device period: "
|
"Default device period: %lu ns, Minimum device period: "
|
||||||
"%I64u ns",
|
"%lu ns",
|
||||||
ns(hundred_ns(default_device_period)).count(),
|
(unsigned long)ns(hundred_ns(default_device_period)).count(),
|
||||||
ns(hundred_ns(min_device_period)).count());
|
(unsigned long)ns(hundred_ns(min_device_period)).count());
|
||||||
|
|
||||||
REFERENCE_TIME buffer_duration;
|
REFERENCE_TIME buffer_duration;
|
||||||
if (Exclusive()) {
|
if (Exclusive()) {
|
||||||
|
@ -619,8 +621,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
|
||||||
const REFERENCE_TIME align = hundred_ns(ms(50)).count();
|
const REFERENCE_TIME align = hundred_ns(ms(50)).count();
|
||||||
buffer_duration = (align / default_device_period) * default_device_period;
|
buffer_duration = (align / default_device_period) * default_device_period;
|
||||||
}
|
}
|
||||||
FormatDebug(wasapi_output_domain, "Buffer duration: %I64u ns",
|
FormatDebug(wasapi_output_domain, "Buffer duration: %lu ns",
|
||||||
size_t(ns(hundred_ns(buffer_duration)).count()));
|
(unsigned long)ns(hundred_ns(buffer_duration)).count());
|
||||||
|
|
||||||
if (Exclusive()) {
|
if (Exclusive()) {
|
||||||
if (HRESULT result = client->Initialize(
|
if (HRESULT result = client->Initialize(
|
||||||
|
@ -639,8 +641,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
|
||||||
SampleRate());
|
SampleRate());
|
||||||
FormatDebug(
|
FormatDebug(
|
||||||
wasapi_output_domain,
|
wasapi_output_domain,
|
||||||
"Aligned buffer duration: %I64u ns",
|
"Aligned buffer duration: %lu ns",
|
||||||
size_t(ns(hundred_ns(buffer_duration)).count()));
|
(unsigned long)ns(hundred_ns(buffer_duration)).count());
|
||||||
client.reset();
|
client.reset();
|
||||||
client = Activate<IAudioClient>(*device);
|
client = Activate<IAudioClient>(*device);
|
||||||
result = client->Initialize(
|
result = client->Initialize(
|
||||||
|
|
|
@ -47,7 +47,9 @@ FormatSystemError(std::error_code code, const char *fmt,
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <errhandlingapi.h> // for GetLastError()
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <winbase.h> // for FormatMessageA()
|
||||||
|
|
||||||
static inline std::system_error
|
static inline std::system_error
|
||||||
MakeLastError(DWORD code, const char *msg) noexcept
|
MakeLastError(DWORD code, const char *msg) noexcept
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <errhandlingapi.h> // for GetLastError()
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <winbase.h> // for FormatMessageA()
|
||||||
#else
|
#else
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#ifndef THREAD_CRITICAL_SECTION_HXX
|
#ifndef THREAD_CRITICAL_SECTION_HXX
|
||||||
#define THREAD_CRITICAL_SECTION_HXX
|
#define THREAD_CRITICAL_SECTION_HXX
|
||||||
|
|
||||||
#include <windows.h>
|
#include <synchapi.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for a CRITICAL_SECTION, backend for the Mutex class.
|
* Wrapper for a CRITICAL_SECTION, backend for the Mutex class.
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <processthreadsapi.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <processthreadsapi.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
|
|
||||||
#include "CriticalSection.hxx"
|
#include "CriticalSection.hxx"
|
||||||
|
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <winbase.h> // for INFINITE
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ void
|
||||||
HugeDiscard(void *p, size_t size) noexcept;
|
HugeDiscard(void *p, size_t size) noexcept;
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <memoryapi.h>
|
||||||
|
|
||||||
WritableBuffer<void>
|
WritableBuffer<void>
|
||||||
HugeAllocate(size_t size);
|
HugeAllocate(size_t size);
|
||||||
|
|
|
@ -35,6 +35,12 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
// TODO: fix this warning properly
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
static inline std::runtime_error
|
static inline std::runtime_error
|
||||||
FormatRuntimeError(const char *fmt, Args&&... args) noexcept
|
FormatRuntimeError(const char *fmt, Args&&... args) noexcept
|
||||||
|
@ -53,4 +59,8 @@ FormatInvalidArgument(const char *fmt, Args&&... args) noexcept
|
||||||
return std::invalid_argument(buffer);
|
return std::invalid_argument(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
#define MPD_WIN32_COM_HXX
|
#define MPD_WIN32_COM_HXX
|
||||||
|
|
||||||
#include "HResult.hxx"
|
#include "HResult.hxx"
|
||||||
#include <objbase.h>
|
|
||||||
#include <windows.h>
|
#include <combaseapi.h>
|
||||||
|
#include <objbase.h> // for COINIT_APARTMENTTHREADED
|
||||||
|
|
||||||
// RAII for Microsoft Component Object Model(COM)
|
// RAII for Microsoft Component Object Model(COM)
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/_com/
|
// https://docs.microsoft.com/en-us/windows/win32/api/_com/
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <windows.h>
|
|
||||||
|
#include <combaseapi.h>
|
||||||
|
|
||||||
// RAII for CoTaskMemAlloc and CoTaskMemFree
|
// RAII for CoTaskMemAlloc and CoTaskMemFree
|
||||||
// https://docs.microsoft.com/zh-tw/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemalloc
|
// https://docs.microsoft.com/zh-tw/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemalloc
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
#define MPD_WIN32_COMPTR_HXX
|
#define MPD_WIN32_COMPTR_HXX
|
||||||
|
|
||||||
#include "win32/HResult.hxx"
|
#include "win32/HResult.hxx"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <windows.h>
|
|
||||||
|
#include <combaseapi.h>
|
||||||
|
|
||||||
// RAII for Object in Microsoft Component Object Model(COM)
|
// RAII for Object in Microsoft Component Object Model(COM)
|
||||||
// https://docs.microsoft.com/zh-tw/windows/win32/api/_com/
|
// https://docs.microsoft.com/zh-tw/windows/win32/api/_com/
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#undef NOUSER // COM needs the "MSG" typedef
|
||||||
|
|
||||||
#include "ComWorker.hxx"
|
#include "ComWorker.hxx"
|
||||||
#include "Com.hxx"
|
#include "Com.hxx"
|
||||||
#include "thread/Name.hxx"
|
#include "thread/Name.hxx"
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
|
|
||||||
#include <boost/lockfree/spsc_queue.hpp>
|
#include <boost/lockfree/spsc_queue.hpp>
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
// Worker thread for all COM operation
|
// Worker thread for all COM operation
|
||||||
class COMWorker {
|
class COMWorker {
|
||||||
Thread thread{BIND_THIS_METHOD(Work)};
|
Thread thread{BIND_THIS_METHOD(Work)};
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// COM needs the "MSG" typedef, and audiopolicy.h includes COM headers
|
||||||
|
#undef NOUSER
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HResult.hxx"
|
#include "HResult.hxx"
|
||||||
#include "system/Error.hxx"
|
#include "system/Error.hxx"
|
||||||
|
|
||||||
|
@ -25,6 +30,46 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <combaseapi.h> // needed by audiopolicy.h if COM_NO_WINDOWS_H is defined
|
||||||
|
#include <audiopolicy.h>
|
||||||
|
|
||||||
|
std::string_view
|
||||||
|
HRESULTToString(HRESULT result) noexcept
|
||||||
|
{
|
||||||
|
using namespace std::literals;
|
||||||
|
switch (result) {
|
||||||
|
#define C(x) \
|
||||||
|
case x: \
|
||||||
|
return #x##sv
|
||||||
|
C(AUDCLNT_E_ALREADY_INITIALIZED);
|
||||||
|
C(AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL);
|
||||||
|
C(AUDCLNT_E_BUFFER_ERROR);
|
||||||
|
C(AUDCLNT_E_BUFFER_OPERATION_PENDING);
|
||||||
|
C(AUDCLNT_E_BUFFER_SIZE_ERROR);
|
||||||
|
C(AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED);
|
||||||
|
C(AUDCLNT_E_BUFFER_TOO_LARGE);
|
||||||
|
C(AUDCLNT_E_CPUUSAGE_EXCEEDED);
|
||||||
|
C(AUDCLNT_E_DEVICE_INVALIDATED);
|
||||||
|
C(AUDCLNT_E_DEVICE_IN_USE);
|
||||||
|
C(AUDCLNT_E_ENDPOINT_CREATE_FAILED);
|
||||||
|
C(AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED);
|
||||||
|
C(AUDCLNT_E_INVALID_DEVICE_PERIOD);
|
||||||
|
C(AUDCLNT_E_OUT_OF_ORDER);
|
||||||
|
C(AUDCLNT_E_SERVICE_NOT_RUNNING);
|
||||||
|
C(AUDCLNT_E_UNSUPPORTED_FORMAT);
|
||||||
|
C(AUDCLNT_E_WRONG_ENDPOINT_TYPE);
|
||||||
|
C(AUDCLNT_E_NOT_INITIALIZED);
|
||||||
|
C(AUDCLNT_E_NOT_STOPPED);
|
||||||
|
C(CO_E_NOTINITIALIZED);
|
||||||
|
C(E_INVALIDARG);
|
||||||
|
C(E_OUTOFMEMORY);
|
||||||
|
C(E_POINTER);
|
||||||
|
C(NO_ERROR);
|
||||||
|
#undef C
|
||||||
|
}
|
||||||
|
return std::string_view();
|
||||||
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
HResultCategory::message(int Errcode) const
|
HResultCategory::message(int Errcode) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,42 +25,11 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
#include <audiopolicy.h>
|
#include <windef.h>
|
||||||
|
|
||||||
constexpr std::string_view HRESULTToString(HRESULT result) {
|
gcc_const
|
||||||
using namespace std::literals;
|
std::string_view
|
||||||
switch (result) {
|
HRESULTToString(HRESULT result) noexcept;
|
||||||
#define C(x) \
|
|
||||||
case x: \
|
|
||||||
return #x##sv
|
|
||||||
C(AUDCLNT_E_ALREADY_INITIALIZED);
|
|
||||||
C(AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL);
|
|
||||||
C(AUDCLNT_E_BUFFER_ERROR);
|
|
||||||
C(AUDCLNT_E_BUFFER_OPERATION_PENDING);
|
|
||||||
C(AUDCLNT_E_BUFFER_SIZE_ERROR);
|
|
||||||
C(AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED);
|
|
||||||
C(AUDCLNT_E_BUFFER_TOO_LARGE);
|
|
||||||
C(AUDCLNT_E_CPUUSAGE_EXCEEDED);
|
|
||||||
C(AUDCLNT_E_DEVICE_INVALIDATED);
|
|
||||||
C(AUDCLNT_E_DEVICE_IN_USE);
|
|
||||||
C(AUDCLNT_E_ENDPOINT_CREATE_FAILED);
|
|
||||||
C(AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED);
|
|
||||||
C(AUDCLNT_E_INVALID_DEVICE_PERIOD);
|
|
||||||
C(AUDCLNT_E_OUT_OF_ORDER);
|
|
||||||
C(AUDCLNT_E_SERVICE_NOT_RUNNING);
|
|
||||||
C(AUDCLNT_E_UNSUPPORTED_FORMAT);
|
|
||||||
C(AUDCLNT_E_WRONG_ENDPOINT_TYPE);
|
|
||||||
C(AUDCLNT_E_NOT_INITIALIZED);
|
|
||||||
C(AUDCLNT_E_NOT_STOPPED);
|
|
||||||
C(CO_E_NOTINITIALIZED);
|
|
||||||
C(E_INVALIDARG);
|
|
||||||
C(E_OUTOFMEMORY);
|
|
||||||
C(E_POINTER);
|
|
||||||
C(NO_ERROR);
|
|
||||||
#undef C
|
|
||||||
}
|
|
||||||
return std::string_view();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const std::error_category &hresult_category() noexcept;
|
static inline const std::error_category &hresult_category() noexcept;
|
||||||
class HResultCategory : public std::error_category {
|
class HResultCategory : public std::error_category {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef MPD_WIN32_PROPVARIANT_HXX
|
#ifndef MPD_WIN32_PROPVARIANT_HXX
|
||||||
#define MPD_WIN32_PROPVARIANT_HXX
|
#define MPD_WIN32_PROPVARIANT_HXX
|
||||||
|
|
||||||
|
#include <combaseapi.h> // needed by propidl.h if COM_NO_WINDOWS_H is defined
|
||||||
#include <propidl.h>
|
#include <propidl.h>
|
||||||
|
|
||||||
class AllocatedString;
|
class AllocatedString;
|
||||||
|
|
|
@ -20,7 +20,10 @@
|
||||||
#ifndef MPD_WIN32_WINEVENT_HXX
|
#ifndef MPD_WIN32_WINEVENT_HXX
|
||||||
#define MPD_WIN32_WINEVENT_HXX
|
#define MPD_WIN32_WINEVENT_HXX
|
||||||
|
|
||||||
#include <windows.h>
|
#include <handleapi.h>
|
||||||
|
#include <synchapi.h>
|
||||||
|
#include <windef.h> // for HWND (needed by winbase.h)
|
||||||
|
#include <winbase.h> // for INFINITE
|
||||||
|
|
||||||
// RAII for Windows unnamed event object
|
// RAII for Windows unnamed event object
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw
|
// https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw
|
||||||
|
|
Loading…
Reference in New Issue