Merge branch 'v0.21.x'
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "lib/xiph/XiphTags.hxx"
|
||||
#include "tag/Handler.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "ReplayGainInfo.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
@@ -44,7 +45,7 @@ ScanOneOpusTag(StringView name, StringView value,
|
||||
ReplayGainInfo *rgi,
|
||||
TagHandler &handler) noexcept
|
||||
{
|
||||
if (rgi != nullptr && name.Equals("R128_TRACK_GAIN")) {
|
||||
if (rgi != nullptr && name.EqualsIgnoreCase("R128_TRACK_GAIN")) {
|
||||
/* R128_TRACK_GAIN is a Q7.8 fixed point number in
|
||||
dB */
|
||||
|
||||
@@ -52,7 +53,8 @@ ScanOneOpusTag(StringView name, StringView value,
|
||||
const auto l = ParseInt64(value, &endptr, 10);
|
||||
if (endptr > value.begin() && endptr == value.end())
|
||||
rgi->track.gain = double(l) / 256.;
|
||||
} else if (rgi != nullptr && name.Equals("R128_ALBUM_GAIN")) {
|
||||
} else if (rgi != nullptr &&
|
||||
name.EqualsIgnoreCase("R128_ALBUM_GAIN")) {
|
||||
/* R128_ALBUM_GAIN is a Q7.8 fixed point number in
|
||||
dB */
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#include "util/UriUtil.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
@@ -66,6 +69,22 @@ playlist_check_translate_song(DetachedSong &song, const char *base_uri,
|
||||
base_uri = nullptr;
|
||||
|
||||
const char *uri = song.GetURI();
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!PathTraitsUTF8::IsAbsolute(uri) && strchr(uri, '\\') != nullptr) {
|
||||
/* Windows uses the backslash as path separator, but
|
||||
the MPD protocol uses the (forward) slash by
|
||||
definition; to allow backslashes in relative URIs
|
||||
loaded from playlist files, this step converts all
|
||||
backslashes to (forward) slashes */
|
||||
|
||||
std::string new_uri(uri);
|
||||
std::replace(new_uri.begin(), new_uri.end(), '\\', '/');
|
||||
song.SetURI(std::move(new_uri));
|
||||
uri = song.GetURI();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (base_uri != nullptr && !uri_has_scheme(uri) &&
|
||||
!PathTraitsUTF8::IsAbsolute(uri))
|
||||
song.SetURI(PathTraitsUTF8::Build(base_uri, uri));
|
||||
|
||||
Reference in New Issue
Block a user