Merge branch 'v0.23.x'

This commit is contained in:
Max Kellermann 2023-06-02 14:36:02 +02:00
commit 9c19368fc7
11 changed files with 59 additions and 15 deletions

9
NEWS
View File

@ -46,6 +46,15 @@ ver 0.24 (not yet released)
* remove Boost dependency
* require libfmt 7 or later
ver 0.23.14 (not yet released)
* decoder
- flac: fix scanning files with non-ASCII names on Windows
- mad: fix calculation of LAME peak values
* mixer
- wasapi: fix problem setting volume
* more libfmt 10 fixes
* fix auto-detected systemd unit directory
ver 0.23.13 (2023/05/22)
* input
- curl: fix busy loop after connection failed

View File

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.musicpd"
android:installLocation="auto"
android:versionCode="71"
android:versionName="0.23.12">
android:versionCode="72"
android:versionName="0.23.14">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>

View File

@ -314,6 +314,7 @@ input {
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
# or
## device "0" # optional
## mixer_type "hardware" # optional
## Exclusive mode blocks all other audio source, and get best audio quality without resampling.
## exclusive "no" # optional
## Enumerate all devices in log.

View File

@ -725,9 +725,11 @@ MPD enables MixRamp if:
- Cross-fade is enabled
- :ref:`mixrampdelay <command_mixrampdelay>` is set to a positive
value, e.g.::
mpc mixrampdelay 1
- :ref:`mixrampdb <command_mixrampdb>` is set to a reasonable value,
e.g.::
mpc mixrampdb -17
- both songs have MixRamp tags (or ``mixramp_analyzer`` is enabled)
- both songs have the same audio format (or :ref:`audio_output_format`

View File

@ -158,7 +158,7 @@ gme = CmakeProject(
'-DBUILD_SHARED_LIBS=OFF',
'-DENABLE_UBSAN=OFF',
'-DZLIB_INCLUDE_DIR=OFF',
'-DSDL2_DIR=OFF',
'-DCMAKE_DISABLE_FIND_PACKAGE_SDL2=ON',
],
)

View File

@ -8,6 +8,7 @@
#include "lib/xiph/FlacMetadataChain.hxx"
#include "OggCodec.hxx"
#include "input/InputStream.hxx"
#include "input/LocalOpen.hxx"
#include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "Log.hxx"
@ -54,13 +55,30 @@ static bool
flac_scan_file(Path path_fs, TagHandler &handler) noexcept
{
FlacMetadataChain chain;
if (!chain.Read(NarrowPath(path_fs))) {
const bool succeed = [&chain, &path_fs]() noexcept {
// read by NarrowPath
if (chain.Read(NarrowPath(path_fs))) {
return true;
}
if (std::is_same_v<Path::value_type, char> ||
chain.GetStatus() != FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE) {
return false;
}
// read by InputStream
Mutex mutex;
auto is = OpenLocalInputStream(path_fs, mutex);
if (is && chain.Read(*is)) {
return true;
}
return false;
}();
if (!succeed) {
FmtDebug(flac_domain,
"Failed to read FLAC tags: {}",
chain.GetStatusString());
return false;
}
chain.Scan(handler);
return true;
}

View File

@ -546,7 +546,21 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
mad_bit_skip(ptr, 16);
lame->peak = MAD_F(mad_bit_read(ptr, 32) << 5); /* peak */
/* The lame peak value is a float multiplied by 2^23 and stored as an
* unsigned integer (it is always positive). MAD's fixed-point format uses
* 28 bits for the fractional part, so shift the 23 bit fraction up before
* converting to a float.
*/
unsigned long peak_int = mad_bit_read(ptr, 32);
#define LAME_PEAK_FRACBITS 23
#if MAD_F_FRACBITS > LAME_PEAK_FRACBITS
peak_int <<= (MAD_F_FRACBITS - LAME_PEAK_FRACBITS);
#elif LAME_PEAK_FRACBITS > MAD_F_FRACBITS
peak_int >>= (LAME_PEAK_FRACBITS - MAD_F_FRACBITS);
#endif
lame->peak = mad_f_todouble(peak_int); /* peak */
FmtDebug(mad_domain, "LAME peak found: {}", lame->peak);
lame->track_gain = 0;

View File

@ -1007,7 +1007,7 @@ WasapiOutput::EnumerateDevices(IMMDeviceEnumerator &enumerator)
continue;
FmtNotice(wasapi_output_domain,
"Device \"{}\" \"{}\"", i, name);
"Device \"{}\" \"{}\"", i, name.c_str());
}
}

View File

@ -114,7 +114,7 @@ public:
void set_value(const T &value) {
std::unique_lock<CriticalSection> lock(mutex);
if (!std::holds_alternative<std::monostate>(&result)) {
if (!std::holds_alternative<std::monostate>(result)) {
throw WinFutureError(WinFutureErrc::promise_already_satisfied);
}
result.template emplace<T>(value);

View File

@ -40,17 +40,17 @@ public:
using R = std::invoke_result_t<std::decay_t<Function>>;
auto promise = std::make_shared<Promise<R>>();
auto future = promise->get_future();
Push([function = std::forward<Function>(function),
promise = std::move(promise)]() mutable {
Push([func = std::forward<Function>(function),
prom = std::move(promise)]() mutable {
try {
if constexpr (std::is_void_v<R>) {
std::invoke(std::forward<Function>(function));
promise->set_value();
std::invoke(std::forward<Function>(func));
prom->set_value();
} else {
promise->set_value(std::invoke(std::forward<Function>(function)));
prom->set_value(std::invoke(std::forward<Function>(func)));
}
} catch (...) {
promise->set_exception(std::current_exception());
prom->set_exception(std::current_exception());
}
});
return future;

View File

@ -4,7 +4,7 @@ if systemd_system_unit_dir == ''
if systemd.found()
systemd_system_unit_dir = systemd.get_variable(
pkgconfig: 'systemdsystemunitdir',
pkgconfig_define: ['prefix', get_option('prefix')],
pkgconfig_define: ['rootprefix', get_option('prefix')],
)
endif
endif