Compare commits
548 Commits
Author | SHA1 | Date | |
---|---|---|---|
feac1a3f56 | |||
f3c37e484e | |||
49130c2018 | |||
94af199c49 | |||
2d25f6f57f | |||
cf179ec294 | |||
4d6f220a2f | |||
0ffbe5b5ea | |||
5b83c834ac | |||
da7f32bddb | |||
9a5eac4ea9 | |||
6571b5d118 | |||
12dff8e382 | |||
c4da87a0cb | |||
446f8f29d3 | |||
48cc76f114 | |||
a0892b852e | |||
485c7805eb | |||
23802f4489 | |||
3fedd978a2 | |||
a9f1bed922 | |||
eb23788fec | |||
f6d73555a6 | |||
a56a709406 | |||
5f253e66f6 | |||
4669f7e2b9 | |||
4c90f88704 | |||
a7213b78d6 | |||
719333e16e | |||
100e471b49 | |||
3f2016e552 | |||
dd89ea4505 | |||
101e12cf9a | |||
f382808450 | |||
0cbe3c2a93 | |||
4f0ae28359 | |||
6a4250f485 | |||
3322b29e6a | |||
33ac472601 | |||
561d6fd478 | |||
42a01822bf | |||
38f1237d49 | |||
8df77122e5 | |||
fef6b9df80 | |||
d52eac66db | |||
70879f0abc | |||
bcb393628e | |||
18d3a5c12b | |||
6ee3d0102b | |||
fc9626e2f4 | |||
3bedd94fc8 | |||
8842650c33 | |||
d5bf128cee | |||
5cd86e272f | |||
740cbe9e02 | |||
ed890a273a | |||
068cd559e1 | |||
dc127f39a7 | |||
7a99a7008c | |||
70b451db7b | |||
2ab03a0914 | |||
2fa8c7d2db | |||
7c759ba8b0 | |||
6d9b452fde | |||
f7eb1c9a83 | |||
2d22e6dee4 | |||
4587bf759d | |||
e1e37cfe3c | |||
381934985a | |||
a8042885ac | |||
a71e68db50 | |||
1417578b3d | |||
96befa138c | |||
16a99804de | |||
75a39ed279 | |||
4d357ab77c | |||
d4f3dd49b4 | |||
4ec6d0555a | |||
a6a1182c4c | |||
a59c9c602b | |||
0c4d824d64 | |||
a5281856c9 | |||
0206a46d39 | |||
9475ef2202 | |||
edae00e719 | |||
fb695bc55f | |||
23a5b8fd3c | |||
273a93cfcf | |||
d105985d78 | |||
f8cfeb39e9 | |||
d5d3982d3c | |||
47341107ea | |||
90eaa87a4d | |||
b09a54b2c2 | |||
10aec174d5 | |||
d32ed194e8 | |||
70d0fbd715 | |||
302432e157 | |||
4ab8a677dc | |||
52e4a4c904 | |||
a0f6932ebe | |||
6e700dab69 | |||
35eaed7206 | |||
e7c963f2ce | |||
949d72e368 | |||
8d2a184658 | |||
c877a32d97 | |||
541468f0ca | |||
d2797effa3 | |||
1170fb1e1e | |||
65b9b3195c | |||
258830e913 | |||
d91da96798 | |||
b3897df682 | |||
3cacb56bb7 | |||
15a1973e28 | |||
ad7d47a8ba | |||
0948c607b6 | |||
60d04052c5 | |||
c1780ac657 | |||
e49cf0ec38 | |||
e1d641f684 | |||
4efd0a9f77 | |||
f6f8751332 | |||
abb28593ce | |||
115693b046 | |||
e4b055eb6d | |||
9866adff95 | |||
a8b0c55818 | |||
cac88e8be5 | |||
e9f6a3482c | |||
5d2e80f188 | |||
cfd4d5b13e | |||
06514aec63 | |||
4ded1ae67b | |||
1da974e3fa | |||
94f06f0946 | |||
d9eec8a455 | |||
eaecbcafb2 | |||
73b5d0a9b9 | |||
c2d0f35e7a | |||
ab99a57997 | |||
c8ebaf3521 | |||
52d00f7e30 | |||
309491a6d8 | |||
e7bfd32ccc | |||
6f283b52ab | |||
32bddfabea | |||
1944c826bc | |||
619bb60b26 | |||
c549e16ed1 | |||
01c9c4507f | |||
8c9d7bf07e | |||
44ef34db88 | |||
5781f223f6 | |||
e4c8ebe056 | |||
76b25a1377 | |||
ccc3ee663b | |||
0626661764 | |||
31db04a3ca | |||
0c7163b9db | |||
7d78cad8af | |||
912530ed20 | |||
d3f37199b9 | |||
a4748d84b0 | |||
8f847ec381 | |||
3a70f09dd3 | |||
568f63100b | |||
3e25916b37 | |||
5f9438dae6 | |||
99e65c58ce | |||
df71b07e9d | |||
2694195215 | |||
66450d1f3c | |||
76efea3aa7 | |||
7ab0dfc8ce | |||
15ff7c4cad | |||
9ab9b97f20 | |||
88d92aceab | |||
a2ce4352c8 | |||
84f43ccde8 | |||
38704c9cf3 | |||
910d0ec92b | |||
3b05c89765 | |||
e77b3fa46f | |||
12147f6d58 | |||
40bc60d6ae | |||
7778210269 | |||
6229210d51 | |||
5d0d5b5d97 | |||
1aa3c1e543 | |||
b90e32fe4e | |||
1f4df2a64d | |||
2efc1db6a9 | |||
e2d4654e20 | |||
2b8f1170a6 | |||
5c4743441e | |||
cb288439a4 | |||
69f741e8a6 | |||
4b4f47002b | |||
615c301961 | |||
dc07180e48 | |||
d3b235bab5 | |||
7c920ddebe | |||
bbc088ae4e | |||
fe195257d8 | |||
57d5df8118 | |||
59792cb0b8 | |||
cc557c4d60 | |||
956c5faebb | |||
cd0396c1f1 | |||
79f9b268bb | |||
b45f3c8deb | |||
f8a8de87e4 | |||
2183f0553c | |||
1f28790476 | |||
c8dae95eff | |||
547a084c7e | |||
493677ff81 | |||
6b430ba271 | |||
bc6924d303 | |||
02b00f9146 | |||
e807ed5870 | |||
f08944253b | |||
792d6584b9 | |||
7b45d01462 | |||
5c17b2966a | |||
0c54f29446 | |||
9c3cf39fdd | |||
d2fb229685 | |||
f55bc6682f | |||
6857286b42 | |||
c0d5bd2048 | |||
666e5d7904 | |||
3613407ac5 | |||
c32dceb4d4 | |||
5573e78364 | |||
807a19889f | |||
df7242de91 | |||
d62426f168 | |||
1714cf3417 | |||
1080c917be | |||
8eb3164878 | |||
915c5442d1 | |||
be0360d5e8 | |||
4d6ae6ffdd | |||
ecee6f415b | |||
47680f936b | |||
2d7181105d | |||
9bdc75524b | |||
2f6ceb4949 | |||
cd933aa35f | |||
138738075b | |||
2ee57f9b0d | |||
5a5655b790 | |||
b88d1e6820 | |||
19d2864c34 | |||
29e3a17f26 | |||
252e9f736f | |||
5d08988dda | |||
47ca4246aa | |||
f8338d4f00 | |||
5cf6032c90 | |||
8d8b77412d | |||
fd9114e7e2 | |||
a3fba2f8f7 | |||
e2b671f1b2 | |||
2a35fbe29e | |||
81cde72fd0 | |||
bf9ffba4f7 | |||
c975d8b943 | |||
2730f91872 | |||
97ca85e155 | |||
39bb4c5871 | |||
bdceb90c59 | |||
8bd1b5228c | |||
a009e95afd | |||
32aafb3572 | |||
b577783cf0 | |||
aa7b872a14 | |||
c6f7f57776 | |||
106ad08cd2 | |||
0341ca1b6a | |||
7581ea55db | |||
fc9cee38d8 | |||
b175e4128d | |||
97b07798b0 | |||
112fcd206d | |||
11d1f56062 | |||
bd840d4638 | |||
c3d393f214 | |||
f88fc0ca1a | |||
fb8d8242ab | |||
f2a3dfd700 | |||
85f9863e0a | |||
83572701f4 | |||
fa7d7e9187 | |||
f818cde32c | |||
9da93cd887 | |||
026e7ea32a | |||
9659d19718 | |||
50d35c9677 | |||
4260e78861 | |||
7342ae2e33 | |||
35dbc1a90c | |||
c7a4355153 | |||
33a84a8ca2 | |||
1d04490ed3 | |||
4a30c2d79c | |||
83072d6b9c | |||
c779fc37eb | |||
e08c13ad7e | |||
2c82a6b2e0 | |||
3929f17aef | |||
ee39af3419 | |||
3882a5a263 | |||
ac06088948 | |||
a757eebfbb | |||
2be4f89555 | |||
4a5c7d8261 | |||
f591193dda | |||
434869900e | |||
2aed7378cc | |||
71cd6e6248 | |||
c83294916a | |||
603bbe0afd | |||
c361e235eb | |||
8a59493d96 | |||
7ef86cbf9f | |||
c9530118a4 | |||
878d9abeb7 | |||
2d705efe1c | |||
aeaef85507 | |||
ebae25d175 | |||
5ad1a01d7a | |||
8f84e1befd | |||
9975905faf | |||
233184568c | |||
59da778009 | |||
108ce95b7c | |||
86e9ed5f3a | |||
fbecb05bf4 | |||
4983703375 | |||
3856224df9 | |||
6d4bedfc56 | |||
bea821f194 | |||
4e276256c0 | |||
d0f9062b56 | |||
b9cc036703 | |||
4e9b88559b | |||
3452682a42 | |||
9262b24504 | |||
a5fa43b526 | |||
8681a3d74c | |||
f9c4d88b12 | |||
799032505e | |||
c8f174ac92 | |||
047e169f3e | |||
687327c9e8 | |||
26dc37bd76 | |||
c693e4aa64 | |||
acab731fef | |||
7e4ba3cb72 | |||
172c4d9c7d | |||
bd5f6cbc7b | |||
6fcd1c734b | |||
eca097dbfb | |||
51ffafa011 | |||
8dca602346 | |||
0ed24f3a05 | |||
e25e0030e7 | |||
df4b6b92f2 | |||
1c69913eca | |||
cb5c6259fd | |||
bf287fefb5 | |||
20bf1d68e6 | |||
9bc4c168fd | |||
3415049d1c | |||
a45949b597 | |||
6009d4abab | |||
16fb843c9b | |||
36b333459b | |||
4d3320233e | |||
933a1a41e6 | |||
1ff8626716 | |||
c30466b84a | |||
868f1a4431 | |||
05f529fffd | |||
f01388559f | |||
27edd4a610 | |||
cc421b04cd | |||
3f2bc325a1 | |||
54686dfd79 | |||
f22cf02ed8 | |||
5b51d0f733 | |||
e03f82636a | |||
d53d85bd79 | |||
4682ae0898 | |||
fd5b195879 | |||
bb5df9839d | |||
be34d55291 | |||
c13911b171 | |||
6f83bdd6f3 | |||
9bcd425a85 | |||
ec917f70d2 | |||
40ce4eeb43 | |||
29ae84e199 | |||
250011f016 | |||
e08c85ae2d | |||
dcb5ca203c | |||
77df5a8f24 | |||
d6bebd2507 | |||
f74996c02f | |||
eea2d35d3a | |||
d94e8bd82d | |||
b0c92e1a34 | |||
ead5bcf048 | |||
bdd268a524 | |||
e783c2bd2c | |||
837fc98638 | |||
5deca66fdc | |||
cfe2dd4147 | |||
00f8d65a17 | |||
4e0e4c00bf | |||
a8c77a6fba | |||
31aa6d0c4f | |||
d051c4931d | |||
94b0baceb0 | |||
16feb261e2 | |||
f084bf7872 | |||
1112d3907a | |||
3464497880 | |||
651f57bced | |||
b4e72aba6c | |||
061dd2dfef | |||
5f4ec7de5b | |||
6f81bb4b09 | |||
4ed60a5711 | |||
c93195c94b | |||
f30adac4bb | |||
a4e4217204 | |||
8754d705a1 | |||
23d4a2d6a5 | |||
ce77b148d9 | |||
be3eca39e8 | |||
3413b1aeb4 | |||
356d13e9dd | |||
fa34bf0aaf | |||
5d0941476a | |||
5ff0bbd0f8 | |||
a3764e533c | |||
3e05cba30e | |||
14b3c0f0af | |||
67aff05051 | |||
19a101c3ac | |||
8da17a8211 | |||
2748929039 | |||
0c900a4bfa | |||
f1d5d70010 | |||
56ebc7637d | |||
996dd9fc8b | |||
056514d598 | |||
9a21bdfd6a | |||
03f99dd26e | |||
bfb1b641f9 | |||
72ba98c464 | |||
dcd19c0592 | |||
109159e0f7 | |||
409b877eea | |||
c5bf7948ff | |||
b9f7127691 | |||
1e6f5f012c | |||
225d85fd9b | |||
1bb22f118d | |||
552c30eae4 | |||
48e8a26813 | |||
ade847bc89 | |||
a6173e0eae | |||
4529bb4a83 | |||
258ecb764f | |||
6f595e9abb | |||
35c4c7e8bf | |||
293ed924d1 | |||
c8121176b3 | |||
ee270f9b00 | |||
bf1d77a4d8 | |||
a9344fafe9 | |||
b8890726f2 | |||
0f84332654 | |||
46c82259f7 | |||
2d03823283 | |||
bba144eca5 | |||
9af73dad93 | |||
f0d66bf6a6 | |||
5ad53a7554 | |||
7b2e3331f2 | |||
3cb44f6652 | |||
b7fdff46f2 | |||
e16109330d | |||
72621531e0 | |||
0a48146efc | |||
0c4bf12bfd | |||
b8e0855ef3 | |||
6467502b9d | |||
15b67f20e5 | |||
0825179f00 | |||
97211d0aad | |||
029c499bfa | |||
0ba867ec16 | |||
866d147122 | |||
32851d1bc7 | |||
78257408b4 | |||
f447b7615e | |||
1f780b7209 | |||
04bf8a6b1a | |||
c4c64854d4 | |||
17562dc90b | |||
7b24316734 | |||
5fab107fd3 | |||
f31920e092 | |||
eb111a10e7 | |||
80b09360c6 | |||
5ccf78855d | |||
fd5a3b5880 | |||
6120c1360c | |||
a8087dc12c | |||
070c03dbf7 | |||
0a9bec3754 | |||
fff25ac753 | |||
4f1e79b6b8 | |||
aa9933c0b5 | |||
0697d1f859 | |||
df033fa4aa | |||
b941a7df83 | |||
31151cec3c | |||
07e8c338df | |||
b22d7218aa | |||
d5be8c74b0 | |||
c112cb60da | |||
677fa4f9bc | |||
907af2ad02 | |||
6a2e7bbc02 | |||
771c46032f | |||
85611aa456 | |||
466b5cb08d | |||
3f2f3251cb | |||
8ae85f3991 | |||
781fe4ff28 |
.github
NEWSandroid
doc
meson.buildpython/build
autotools.pycmake.pydownload.pylibs.pymakeproject.pymeson.pyopenssl.pyproject.pyquilt.pytar.pytoolchain.pyverify.pyzlib.py
src
CommandLine.cxxCommandLine.hxxListen.cxxLocateUri.cxxLog.hxxLogBackend.cxxLogInit.cxxMain.cxxMapper.cxxMusicBuffer.cxxMusicBuffer.hxxMusicPipe.cxxMusicPipe.hxxPartition.cxxPartition.hxxPermission.cxxPermission.hxxPlaylistDatabase.cxxPlaylistDatabase.hxxPlaylistFile.cxxPlaylistFile.hxxPlaylistSave.cxxRemoteTagCache.cxxRemoteTagCache.hxxSingleMode.hxxSongPrint.cxxSongSave.cxxSongSave.hxxStateFile.cxxStateFileConfig.cxxTagAny.cxxTagPrint.cxxTagSave.cxxTimePrint.cxx
android
apple
archive
client
command
AllCommands.cxxClientCommands.cxxDatabaseCommands.cxxFileCommands.cxxFingerprintCommands.cxxOtherCommands.cxxOutputCommands.cxxPartitionCommands.cxxPlayerCommands.cxxPlaylistCommands.cxxPositionArg.cxxPositionArg.hxxQueueCommands.cxxStorageCommands.cxx
config
db
Configured.cxxDatabasePlaylist.cxxDatabasePlaylist.hxx
plugins
meson.build
simple
DatabaseSave.cxxDatabaseSave.hxxDirectory.cxxDirectory.hxxDirectorySave.cxxDirectorySave.hxxSimpleDatabasePlugin.cxx
upnp
update
decoder
encoder
event
filter
plugins
fs
AllocatedPath.cxxCharset.cxxFileSystem.hxxPath.cxxStandardDirectory.cxxStandardDirectory.hxx
io
meson.buildinput
AsyncInputStream.cxxBufferingInputStream.cxxIcyInputStream.cxxInit.cxxInputStream.cxxInputStream.hxxLastInputStream.cxxReader.hxxThreadInputStream.cxx
cache
plugins
AlsaInputPlugin.cxxCdioParanoiaInputPlugin.cxxCurlInputPlugin.cxxCurlInputPlugin.hxxFileInputPlugin.cxxNfsInputPlugin.cxxQobuzClient.cxxQobuzClient.hxxQobuzErrorParser.cxxQobuzErrorParser.hxxQobuzInputPlugin.cxxQobuzLoginRequest.cxxQobuzLoginRequest.hxxQobuzTagScanner.cxxQobuzTagScanner.hxxQobuzTrackRequest.cxxQobuzTrackRequest.hxxUringInputPlugin.cxxmeson.build
io
BufferedOutputStream.cxxBufferedOutputStream.hxxBufferedReader.cxxBufferedReader.hxxFileOutputStream.cxxFileOutputStream.hxxFileReader.cxxFileReader.hxxLineReader.hxxOutputStream.hxxPeekReader.cxxPeekReader.hxxReader.hxxStdioOutputStream.hxxmeson.build
uring
java
lib
alsa
crypto
curl
Adapter.cxxAdapter.hxxDelegate.cxxDelegate.hxxEasy.hxxEscape.cxxForm.cxxForm.hxxGlobal.cxxHandler.hxxHeaders.hxxInit.cxxRequest.cxxRequest.hxxSetup.cxxSetup.hxxSlist.hxxmeson.build
patches
dbus
ffmpeg
fmt
icu
modplug
patches
nfs
pcre
pipewire
smbclient
upnp
xiph
yajl
zlib
mixer
neighbor
net
output
Control.cxxControl.hxxFiltered.hxxMultipleOutputs.cxxMultipleOutputs.hxxOutputCommand.cxxOutputCommand.hxxState.cxxThread.cxx
plugins
pcm
player
playlist
protocol
queue
song
sticker
storage
system
tag
ApeLoader.cxxBuilder.cxxIcyMetaDataParser.cxxIcyMetaDataParser.hxxId3Load.cxxId3MixRamp.cxxId3MixRamp.hxxId3Picture.cxxMask.hxxMixRampInfo.hxxMixRampParser.cxxMixRampParser.hxxTag.cxxmeson.build
thread
time
unix
util
AllocatedArray.hxxAllocatedString.hxxBindMethod.hxxByteOrder.hxxIntrusiveList.hxxLazyRandomEngine.cxxLazyRandomEngine.hxxScopeExit.hxxStringAPI.hxxStringStrip.cxxStringStrip.hxxUTF8.cxxUTF8.hxxUriUtil.cxx
win32
zeroconf
subprojects
systemd
test
ContainerScan.cxxDumpOgg.cxxRunCurl.cxxWriteFile.cxxdump_playlist.cxxdump_text_file.cxxmeson.build
net
run_decoder.cxxrun_encoder.cxxrun_gunzip.cxxrun_gzip.cxxrun_input.cxxrun_normalize.cxxtag
test_icy_parser.cxxtest_translate_song.cxxtest_vorbis_encoder.cxxtime
util
win32
12
.github/FUNDING.yml
vendored
12
.github/FUNDING.yml
vendored
@ -1,12 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: MaxK
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -18,5 +18,9 @@ about: Create a bug report
|
||||
<!-- Paste the output of "mpd --version" here -->
|
||||
|
||||
|
||||
## Configuration
|
||||
<!-- Paste your MPD configuration here -->
|
||||
|
||||
|
||||
## Log
|
||||
<!-- Paste relevant portions of the log file here (--verbose) -->
|
||||
|
9
.github/ISSUE_TEMPLATE/question.md
vendored
9
.github/ISSUE_TEMPLATE/question.md
vendored
@ -1,9 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask a question about MPD
|
||||
---
|
||||
|
||||
<!-- Before you ask a question on GitHub, please read MPD's
|
||||
documentation. A copy is available at
|
||||
https://www.musicpd.org/doc/html/ -->
|
||||
## Question
|
155
.github/workflows/build.yml
vendored
Normal file
155
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
---
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'android/**'
|
||||
- 'build/**'
|
||||
- 'doc/**'
|
||||
- 'python/**'
|
||||
- 'subprojects/**'
|
||||
- 'systemd/**'
|
||||
- 'win32/**'
|
||||
branches:
|
||||
- master
|
||||
- v0.23.x
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'android/**'
|
||||
- 'build/**'
|
||||
- 'doc/**'
|
||||
- 'python/**'
|
||||
- 'subprojects/**'
|
||||
- 'systemd/**'
|
||||
- 'win32/**'
|
||||
branches:
|
||||
- master
|
||||
- v0.23.x
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: 'ccache gcc-10'
|
||||
CXX: 'ccache g++-10'
|
||||
steps:
|
||||
- id: checkout
|
||||
uses: actions/checkout@v2
|
||||
- id: cache-ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: linux
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
g++-10 libfmt-dev libboost-dev \
|
||||
libgtest-dev \
|
||||
libpcre2-dev \
|
||||
libsystemd-dev libdbus-1-dev \
|
||||
libicu-dev \
|
||||
libcurl4-gnutls-dev \
|
||||
libpcre2-dev \
|
||||
libavahi-client-dev \
|
||||
libmad0-dev libmpg123-dev libid3tag0-dev \
|
||||
libflac-dev libvorbis-dev libopus-dev libogg-dev \
|
||||
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
|
||||
libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev \
|
||||
libmpcdec-dev libwavpack-dev libwildmidi-dev \
|
||||
libsidplay2-dev libsidutils-dev libresid-builder-dev \
|
||||
libavcodec-dev libavformat-dev \
|
||||
libmp3lame-dev libtwolame-dev libshine-dev \
|
||||
libsamplerate0-dev libsoxr-dev \
|
||||
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
|
||||
libzzip-dev \
|
||||
libyajl-dev libexpat-dev \
|
||||
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
|
||||
libpulse-dev libshout3-dev \
|
||||
libsndio-dev \
|
||||
libmpdclient-dev \
|
||||
libnfs-dev \
|
||||
libupnp-dev \
|
||||
libsqlite3-dev \
|
||||
libchromaprint-dev \
|
||||
libgcrypt20-dev
|
||||
|
||||
- name: Full Build
|
||||
uses: BSFishy/meson-build@v1.0.3
|
||||
with:
|
||||
action: build
|
||||
directory: output/full
|
||||
setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled
|
||||
options: --verbose
|
||||
meson-version: 0.56.0
|
||||
|
||||
- name: Unit Tests
|
||||
uses: BSFishy/meson-build@v1.0.3
|
||||
with:
|
||||
action: test
|
||||
directory: output/full
|
||||
setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled
|
||||
options: --verbose
|
||||
meson-version: 0.56.0
|
||||
|
||||
- name: Mini Build
|
||||
uses: BSFishy/meson-build@v1.0.3
|
||||
with:
|
||||
action: build
|
||||
directory: output/mini
|
||||
setup-options: -Dbuildtype=minsize -Dauto_features=disabled -Dtest=true -Ddaemon=false -Dinotify=false -Depoll=false -Deventfd=false -Dsignalfd=false -Dtcp=false -Ddsd=false -Ddatabase=false -Dneighbor=false -Dcue=false -Dfifo=false -Dhttpd=false -Dpipe=false -Drecorder=false -Dsnapcast=false
|
||||
options: --verbose
|
||||
meson-version: 0.56.0
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- id: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- id: cache-ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: macos
|
||||
|
||||
- uses: actions/setup-python@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install \
|
||||
meson ninja \
|
||||
fmt \
|
||||
boost \
|
||||
googletest \
|
||||
icu4c \
|
||||
ffmpeg \
|
||||
libnfs \
|
||||
yajl \
|
||||
libupnp \
|
||||
libid3tag \
|
||||
chromaprint \
|
||||
libsamplerate \
|
||||
libsoxr \
|
||||
flac \
|
||||
opus \
|
||||
libvorbis \
|
||||
faad2 \
|
||||
wavpack \
|
||||
libmpdclient
|
||||
|
||||
- name: Build
|
||||
uses: BSFishy/meson-build@v1.0.3
|
||||
with:
|
||||
action: build
|
||||
directory: output
|
||||
setup-options: -Ddocumentation=disabled -Dtest=true
|
||||
options: --verbose
|
||||
meson-version: 0.56.0
|
||||
|
||||
- name: Unit Tests
|
||||
uses: BSFishy/meson-build@v1.0.3
|
||||
with:
|
||||
action: test
|
||||
directory: output
|
||||
setup-options: -Ddocumentation=disabled -Dtest=true
|
||||
options: --verbose
|
||||
meson-version: 0.56.0
|
186
NEWS
186
NEWS
@ -1,3 +1,189 @@
|
||||
ver 0.23.14 (2023/10/08)
|
||||
* 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
|
||||
* Android
|
||||
- require Android 7 or newer
|
||||
|
||||
ver 0.23.13 (2023/05/22)
|
||||
* input
|
||||
- curl: fix busy loop after connection failed
|
||||
- curl: hide "404" log messages for non-existent ".mpdignore" files
|
||||
* archive
|
||||
- zzip: fix crash bug
|
||||
* database
|
||||
- simple: reveal hidden songs after deleting containing CUE
|
||||
* decoder
|
||||
- ffmpeg: reorder to a lower priority than "gme"
|
||||
- gme: require GME 0.6 or later
|
||||
* output
|
||||
- pipewire: fix corruption bug due to missing lock
|
||||
* Linux
|
||||
- shut down if parent process dies in --no-daemon mode
|
||||
- determine systemd unit directories via pkg-config
|
||||
* support libfmt 10
|
||||
|
||||
ver 0.23.12 (2023/01/17)
|
||||
* input
|
||||
- curl: require CURL 7.55.0 or later
|
||||
* decoder
|
||||
- mad: fix integer underflow with very small files
|
||||
* tags
|
||||
- fix crash bug due to race condition
|
||||
* output
|
||||
- pipewire: adjust to PipeWire 0.3.64 API change
|
||||
* fix build failures with GCC 13
|
||||
|
||||
ver 0.23.11 (2022/11/28)
|
||||
* database
|
||||
- simple: move default database to ~/.cache/mpd/db from ~/.cache/mpd.db
|
||||
- simple: default "cache_directory" to ~/.cache/mpd/mounts
|
||||
* macOS: fix build failure "no archive members specified"
|
||||
* Windows
|
||||
- fix crash bug (stack buffer overflow) after I/O errors
|
||||
- fix path traversal bug because backslash was allowed in playlist names
|
||||
* Android/Windows
|
||||
- update OpenSSL to 3.0.7
|
||||
- re-enable CURL's verbose error strings
|
||||
|
||||
ver 0.23.10 (2022/10/14)
|
||||
* storage
|
||||
- curl: fix file time stamps
|
||||
* decoder
|
||||
- ffmpeg: fix libfmt 9 compiler warning
|
||||
* encoder
|
||||
- flac: fix failure when libFLAC is built without Ogg support
|
||||
* output
|
||||
- alsa: fix crash bug
|
||||
* Windows
|
||||
- log to stdout by default, don't require "log_file" setting
|
||||
|
||||
ver 0.23.9 (2022/08/18)
|
||||
* input
|
||||
- cdio_paranoia: add options "mode" and "skip"
|
||||
* decoder
|
||||
- ffmpeg: support FFmpeg 5.1
|
||||
* filter
|
||||
- replay gain: fix delayed volume display with handler=mixer
|
||||
* output
|
||||
- pipewire: set app icon
|
||||
* fix bogus volume levels with multiple partitions
|
||||
* improve iconv detection
|
||||
* macOS: fix macOS 10 build problem (0.23.8 regression)
|
||||
* Android
|
||||
- load mpd.conf from app data directory
|
||||
|
||||
ver 0.23.8 (2022/07/09)
|
||||
* storage
|
||||
- curl: fix crash if web server does not understand WebDAV
|
||||
* input
|
||||
- cdio_paranoia: fix crash if no drive was found
|
||||
- cdio_paranoia: faster cancellation
|
||||
- cdio_paranoia: don't scan for replay gain tags
|
||||
- pipewire: fix playback of very short tracks
|
||||
- pipewire: drop all buffers before manual song change
|
||||
- pipewire: fix stuttering after manual song change
|
||||
- snapcast: fix busy loop while paused
|
||||
- snapcast: fix stuttering after resuming playback
|
||||
* mixer
|
||||
- better error messages
|
||||
- alsa: fix setting volume before playback starts
|
||||
- pipewire: fix crash bug
|
||||
- pipewire: fix volume change events with PipeWire 0.3.53
|
||||
- pipewire: don't force initial volume=100%
|
||||
* support libfmt 9
|
||||
|
||||
ver 0.23.7 (2022/05/09)
|
||||
* database
|
||||
- upnp: support pupnp 1.14
|
||||
* decoder
|
||||
- ffmpeg: fix HLS seeking
|
||||
- opus: fix missing song length on high-latency files
|
||||
* output
|
||||
- shout: require at least libshout 2.4.0
|
||||
* mixer
|
||||
- pipewire: fix volume restore
|
||||
- software: update volume of disabled outputs
|
||||
* support libiconv
|
||||
|
||||
ver 0.23.6 (2022/03/14)
|
||||
* protocol
|
||||
- support filename "cover.webp" for "albumart" command
|
||||
- support "readcomments" and "readpicture" on CUE tracks
|
||||
* decoder
|
||||
- ffmpeg: fix end-of-file check (update stuck at empty files)
|
||||
- opus: fix "readpicture" on Opus files
|
||||
* output
|
||||
- pipewire: fix crash bug if setting volume before playback starts
|
||||
- wasapi: fix resume after pause
|
||||
|
||||
ver 0.23.5 (2021/12/01)
|
||||
* protocol
|
||||
- support relative offsets for "searchadd"
|
||||
- fix "searchaddpl" bug (bogus error "Bad position")
|
||||
* database
|
||||
- upnp: fix crash bug
|
||||
* tags
|
||||
- fix MixRamp support
|
||||
* migrate to PCRE2
|
||||
* GCC 12 build fixes
|
||||
|
||||
ver 0.23.4 (2021/11/11)
|
||||
* protocol
|
||||
- add optional position parameter to "searchaddpl"
|
||||
* decoder
|
||||
- ffmpeg: support libavcodec 59
|
||||
* output
|
||||
- alsa: add option "thesycon_dsd_workaround" to work around device bug
|
||||
* fix crash on debug builds if startup fails
|
||||
* systemd
|
||||
- remove "RuntimeDirectory" directive because it caused problems
|
||||
- ignore the "pid_file" setting if started as systemd service
|
||||
* Windows
|
||||
- enable the "openmpt" decoder plugin
|
||||
|
||||
ver 0.23.3 (2021/10/31)
|
||||
* protocol
|
||||
- add optional position parameter to "add" and "playlistadd"
|
||||
- allow range in "playlistdelete"
|
||||
* database
|
||||
- fix scanning files with question mark in the name
|
||||
- inotify: fix use-after-free bug
|
||||
* output
|
||||
- alsa: add option "stop_dsd_silence" to work around DSD DAC noise
|
||||
* macOS: fix libfmt related build failure
|
||||
* systemd: add "RuntimeDirectory" directive
|
||||
|
||||
ver 0.23.2 (2021/10/22)
|
||||
* protocol
|
||||
- fix "albumart" timeout bug
|
||||
* input
|
||||
- nfs: fix playback bug
|
||||
* output
|
||||
- pipewire: send artist and title to PipeWire
|
||||
- pipewire: DSD support
|
||||
* neighbor
|
||||
- mention failed plugin name in error message
|
||||
* player
|
||||
- fix cross-fade regression
|
||||
* fix crash with libfmt versions older than 7
|
||||
|
||||
ver 0.23.1 (2021/10/19)
|
||||
* protocol
|
||||
- use decimal notation instead of scientific notation
|
||||
- "load" supports relative positions
|
||||
* output
|
||||
- emit "mixer" idle event when replay gain changes volume
|
||||
- pipewire: emit "mixer" idle events on external volume change
|
||||
- pipewire: attempt to change the graph sample rate
|
||||
- snapcast: fix time stamp bug which caused "Failed to get chunk"
|
||||
* fix libfmt linker problems
|
||||
* fix broken password authentication
|
||||
|
||||
ver 0.23 (2021/10/14)
|
||||
* protocol
|
||||
- new command "getvol"
|
||||
|
@ -2,10 +2,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.musicpd"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="60"
|
||||
android:versionName="0.23">
|
||||
android:versionCode="72"
|
||||
android:versionName="0.23.14">
|
||||
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
||||
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="30"/>
|
||||
|
||||
<uses-feature android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
@ -17,10 +17,9 @@
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
|
||||
<application android:allowBackup="true"
|
||||
android:debuggable="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:banner="@drawable/icon"
|
||||
@ -43,7 +42,6 @@
|
||||
<receiver android:name=".Receiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.HEADSET_PLUG" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name=".Main" android:process=":main"/>
|
||||
|
@ -12,18 +12,30 @@ unsigned_apk = custom_target(
|
||||
],
|
||||
)
|
||||
|
||||
aligned_apk = custom_target(
|
||||
'mpd-aligned.apk',
|
||||
output: 'mpd-aligned.apk',
|
||||
input: unsigned_apk,
|
||||
command: [
|
||||
android_zipalign,
|
||||
'-f', '4',
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
if get_option('android_debug_keystore') != ''
|
||||
debug_apk = custom_target(
|
||||
'mpd-debug.apk',
|
||||
output: 'mpd-debug.apk',
|
||||
input: unsigned_apk,
|
||||
input: aligned_apk,
|
||||
command: [
|
||||
jarsigner,
|
||||
'-keystore', get_option('android_debug_keystore'),
|
||||
'-storepass', 'android',
|
||||
'-signedjar', '@OUTPUT@',
|
||||
'@INPUT@',
|
||||
'androiddebugkey',
|
||||
apksigner, 'sign',
|
||||
'--in', '@INPUT@',
|
||||
'--out', '@OUTPUT@',
|
||||
'--debuggable-apk-permitted',
|
||||
'-ks', get_option('android_debug_keystore'),
|
||||
'--ks-key-alias', 'androiddebugkey',
|
||||
'--ks-pass', 'pass:android',
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
@ -31,29 +43,16 @@ endif
|
||||
|
||||
if get_option('android_keystore') != '' and get_option('android_keyalias') != '' and get_option('android_keypass') != ''
|
||||
unaligned_apk = custom_target(
|
||||
'mpd-unaligned.apk',
|
||||
output: 'mpd-unaligned.apk',
|
||||
input: unsigned_apk,
|
||||
command: [
|
||||
jarsigner,
|
||||
'-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
|
||||
'-keystore', get_option('android_keystore'),
|
||||
'-storepass', get_option('android_keypass'),
|
||||
'-signedjar', '@OUTPUT@',
|
||||
'@INPUT@',
|
||||
get_option('android_keyalias'),
|
||||
],
|
||||
)
|
||||
|
||||
apk = custom_target(
|
||||
'mpd.apk',
|
||||
output: 'mpd.apk',
|
||||
input: unaligned_apk,
|
||||
input: aligned_apk,
|
||||
command: [
|
||||
android_zipalign,
|
||||
'-f', '4',
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
apksigner, 'sign',
|
||||
'--in', '@INPUT@',
|
||||
'--out', '@OUTPUT@',
|
||||
'-ks', get_option('android_keystore'),
|
||||
'--ks-key-alias', get_option('android_keyalias'),
|
||||
'--ks-pass', 'pass:' + get_option('android_keypass'),
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
endif
|
||||
|
131
android/build.py
131
android/build.py
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env -S python3 -u
|
||||
|
||||
import os, os.path
|
||||
import sys, subprocess
|
||||
@ -13,137 +13,20 @@ android_abi = sys.argv[3]
|
||||
configure_args = sys.argv[4:]
|
||||
|
||||
if not os.path.isfile(os.path.join(sdk_path, 'tools', 'android')):
|
||||
print("SDK not found in", ndk_path, file=sys.stderr)
|
||||
print("SDK not found in", sdk_path, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if not os.path.isdir(ndk_path):
|
||||
print("NDK not found in", ndk_path, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
android_abis = {
|
||||
'armeabi-v7a': {
|
||||
'arch': 'arm-linux-androideabi',
|
||||
'ndk_arch': 'arm',
|
||||
'llvm_triple': 'armv7-linux-androideabi',
|
||||
'cflags': '-fpic -mfpu=neon -mfloat-abi=softfp',
|
||||
},
|
||||
|
||||
'arm64-v8a': {
|
||||
'arch': 'aarch64-linux-android',
|
||||
'ndk_arch': 'arm64',
|
||||
'llvm_triple': 'aarch64-linux-android',
|
||||
'cflags': '-fpic',
|
||||
},
|
||||
|
||||
'x86': {
|
||||
'arch': 'i686-linux-android',
|
||||
'ndk_arch': 'x86',
|
||||
'llvm_triple': 'i686-linux-android',
|
||||
'cflags': '-fPIC -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32',
|
||||
},
|
||||
|
||||
'x86_64': {
|
||||
'arch': 'x86_64-linux-android',
|
||||
'ndk_arch': 'x86_64',
|
||||
'llvm_triple': 'x86_64-linux-android',
|
||||
'cflags': '-fPIC -m64',
|
||||
},
|
||||
}
|
||||
|
||||
# select the NDK target
|
||||
abi_info = android_abis[android_abi]
|
||||
arch = abi_info['arch']
|
||||
|
||||
# the path to the MPD sources
|
||||
mpd_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]) or '.', '..'))
|
||||
sys.path[0] = os.path.join(mpd_path, 'python')
|
||||
|
||||
# output directories
|
||||
from build.dirs import lib_path, tarball_path, src_path
|
||||
from build.meson import configure as run_meson
|
||||
|
||||
arch_path = os.path.join(lib_path, arch)
|
||||
build_path = os.path.join(arch_path, 'build')
|
||||
|
||||
# build host configuration
|
||||
build_arch = 'linux-x86_64'
|
||||
|
||||
# set up the NDK toolchain
|
||||
|
||||
class AndroidNdkToolchain:
|
||||
def __init__(self, tarball_path, src_path, build_path,
|
||||
use_cxx):
|
||||
self.tarball_path = tarball_path
|
||||
self.src_path = src_path
|
||||
self.build_path = build_path
|
||||
|
||||
ndk_arch = abi_info['ndk_arch']
|
||||
android_api_level = '21'
|
||||
|
||||
install_prefix = os.path.join(arch_path, 'root')
|
||||
|
||||
self.arch = arch
|
||||
self.actual_arch = arch
|
||||
self.install_prefix = install_prefix
|
||||
|
||||
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
|
||||
llvm_triple = abi_info['llvm_triple'] + android_api_level
|
||||
|
||||
common_flags = '-Os -g'
|
||||
common_flags += ' ' + abi_info['cflags']
|
||||
|
||||
llvm_bin = os.path.join(llvm_path, 'bin')
|
||||
self.cc = os.path.join(llvm_bin, 'clang')
|
||||
self.cxx = os.path.join(llvm_bin, 'clang++')
|
||||
common_flags += ' -target ' + llvm_triple
|
||||
|
||||
common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections'
|
||||
|
||||
self.ar = os.path.join(llvm_bin, 'llvm-ar')
|
||||
self.ranlib = os.path.join(llvm_bin, 'llvm-ranlib')
|
||||
self.nm = os.path.join(llvm_bin, 'llvm-nm')
|
||||
self.strip = os.path.join(llvm_bin, 'llvm-strip')
|
||||
|
||||
self.cflags = common_flags
|
||||
self.cxxflags = common_flags
|
||||
self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include')
|
||||
self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \
|
||||
' -Wl,--exclude-libs=ALL' + \
|
||||
' ' + common_flags
|
||||
self.ldflags = common_flags
|
||||
self.libs = ''
|
||||
|
||||
self.is_arm = ndk_arch == 'arm'
|
||||
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||
self.is_aarch64 = ndk_arch == 'arm64'
|
||||
self.is_windows = False
|
||||
|
||||
libstdcxx_flags = ''
|
||||
libstdcxx_cxxflags = ''
|
||||
libstdcxx_ldflags = ''
|
||||
libstdcxx_libs = '-static-libstdc++'
|
||||
|
||||
if self.is_armv7:
|
||||
# On 32 bit ARM, clang generates no ".eh_frame" section;
|
||||
# instead, the LLVM unwinder library is used for unwinding
|
||||
# the stack after a C++ exception was thrown
|
||||
libstdcxx_libs += ' -lunwind'
|
||||
|
||||
if use_cxx:
|
||||
self.cxxflags += ' ' + libstdcxx_cxxflags
|
||||
self.ldflags += ' ' + libstdcxx_ldflags
|
||||
self.libs += ' ' + libstdcxx_libs
|
||||
|
||||
self.env = dict(os.environ)
|
||||
|
||||
# redirect pkg-config to use our root directory instead of the
|
||||
# default one on the build host
|
||||
import shutil
|
||||
bin_dir = os.path.join(install_prefix, 'bin')
|
||||
os.makedirs(bin_dir, exist_ok=True)
|
||||
self.pkg_config = shutil.copy(os.path.join(mpd_path, 'build', 'pkg-config.sh'),
|
||||
os.path.join(bin_dir, 'pkg-config'))
|
||||
self.env['PKG_CONFIG'] = self.pkg_config
|
||||
from build.toolchain import AndroidNdkToolchain
|
||||
|
||||
# a list of third-party libraries to be used by MPD on Android
|
||||
from build.libs import *
|
||||
@ -165,13 +48,17 @@ thirdparty_libs = [
|
||||
|
||||
# build the third-party libraries
|
||||
for x in thirdparty_libs:
|
||||
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
||||
toolchain = AndroidNdkToolchain(mpd_path, lib_path,
|
||||
tarball_path, src_path,
|
||||
ndk_path, android_abi,
|
||||
use_cxx=x.use_cxx)
|
||||
if not x.is_installed(toolchain):
|
||||
x.build(toolchain)
|
||||
|
||||
# configure and build MPD
|
||||
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
||||
toolchain = AndroidNdkToolchain(mpd_path, lib_path,
|
||||
tarball_path, src_path,
|
||||
ndk_path, android_abi,
|
||||
use_cxx=True)
|
||||
|
||||
configure_args += [
|
||||
|
54
android/gdb.sh
Executable file
54
android/gdb.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script need the following modification in ANDROID_NDK in order to attach
|
||||
# to the good :main pid
|
||||
#--- a/prebuilt/linux-x86_64/bin/ndk-gdb.py
|
||||
#+++ b/prebuilt/linux-x86_64/bin/ndk-gdb.py
|
||||
#@@ -669,7 +669,7 @@
|
||||
# log("Sleeping for {} seconds.".format(args.delay))
|
||||
# time.sleep(args.delay)
|
||||
#
|
||||
#- pids = gdbrunner.get_pids(device, pkg_name)
|
||||
#+ pids = gdbrunner.get_pids(device, pkg_name + ":main")
|
||||
# if len(pids) == 0:
|
||||
# error("Failed to find running process '{}'".format(pkg_name))
|
||||
# if len(pids) > 1:
|
||||
|
||||
SCRIPT_PATH=$(dirname $0)
|
||||
BUILD_PATH="`pwd`"
|
||||
TMP_PATH="$BUILD_PATH/gdb"
|
||||
NDK_GDB_ARGS="--force"
|
||||
ANDROID_NDK=$1
|
||||
|
||||
if [ ! -f $ANDROID_NDK/source.properties ];then
|
||||
echo "usage: $0 ANDROID_NDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $BUILD_PATH/libmpd.so ];then
|
||||
echo "This script need to be executed from the android build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$TMP_PATH"
|
||||
mkdir -p "$TMP_PATH"
|
||||
|
||||
ANDROID_MANIFEST="$SCRIPT_PATH/AndroidManifest.xml"
|
||||
ABI=`ls "$BUILD_PATH/android/apk/apk/lib" --sort=time | head -n 1`
|
||||
|
||||
if [ ! -f "$ANDROID_MANIFEST" -o "$ABI" = "" ]; then
|
||||
echo "Invalid manifest/ABI, did you try building first ?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$TMP_PATH"/jni
|
||||
touch "$TMP_PATH"/jni/Android.mk
|
||||
echo "APP_ABI := $ABI" > "$TMP_PATH"/jni/Application.mk
|
||||
|
||||
DEST=obj/local/$ABI
|
||||
mkdir -p "$TMP_PATH/$DEST"
|
||||
|
||||
cp "$BUILD_PATH/libmpd.so" "$TMP_PATH/$DEST"
|
||||
cp "$ANDROID_MANIFEST" "$TMP_PATH"
|
||||
|
||||
(cd "$TMP_PATH" && bash $ANDROID_NDK/ndk-gdb $NDK_GDB_ARGS)
|
@ -17,7 +17,7 @@ android_dx = join_paths(android_build_tools_dir, 'dx')
|
||||
android_zipalign = join_paths(android_build_tools_dir, 'zipalign')
|
||||
|
||||
javac = find_program('javac')
|
||||
jarsigner = find_program('jarsigner')
|
||||
apksigner = find_program('apksigner')
|
||||
rsvg_convert = find_program('rsvg-convert')
|
||||
convert = find_program('convert')
|
||||
zip = find_program('zip')
|
||||
|
@ -13,7 +13,7 @@ GENCLASS="$D/classes"
|
||||
GENINCLUDE="$D/include"
|
||||
|
||||
mkdir -p "$GENSRC/$JAVA_PKG_PATH"
|
||||
"$JAVAC" -source 1.6 -target 1.6 -Xlint:-options \
|
||||
"$JAVAC" -source 1.7 -target 1.7 -Xlint:-options \
|
||||
-cp "$CLASSPATH" \
|
||||
-h "$GENINCLUDE" \
|
||||
-d "$GENCLASS" \
|
||||
|
@ -24,14 +24,13 @@ import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothClass;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
@ -200,24 +199,14 @@ public class Main extends Service implements Runnable {
|
||||
return;
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_HEADSET_PLUG);
|
||||
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
|
||||
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
|
||||
filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
|
||||
registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!mPauseOnHeadphonesDisconnect) {
|
||||
if (!mPauseOnHeadphonesDisconnect)
|
||||
return;
|
||||
}
|
||||
|
||||
if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
|
||||
if (intent.hasExtra("state") && intent.getIntExtra("state", 0) == 0)
|
||||
pause();
|
||||
} else {
|
||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
if (device.getBluetoothClass().hasService(BluetoothClass.Service.AUDIO))
|
||||
pause();
|
||||
}
|
||||
if (intent.getAction() == AudioManager.ACTION_AUDIO_BECOMING_NOISY)
|
||||
pause();
|
||||
}
|
||||
}, filter);
|
||||
|
||||
|
@ -25,16 +25,18 @@ import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class Receiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("Receiver", "onReceive: " + intent);
|
||||
if (intent.getAction() == "android.intent.action.BOOT_COMPLETED") {
|
||||
if (Settings.Preferences.getBoolean(context,
|
||||
Settings.Preferences.KEY_RUN_ON_BOOT, false)) {
|
||||
final boolean wakelock = Settings.Preferences.getBoolean(context,
|
||||
Settings.Preferences.KEY_WAKELOCK, false);
|
||||
Main.start(context, wakelock);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("Receiver", "onReceive: " + intent);
|
||||
if (intent.getAction() == "android.intent.action.BOOT_COMPLETED") {
|
||||
if (Settings.Preferences.getBoolean(context,
|
||||
Settings.Preferences.KEY_RUN_ON_BOOT,
|
||||
false)) {
|
||||
final boolean wakelock =
|
||||
Settings.Preferences.getBoolean(context,
|
||||
Settings.Preferences.KEY_WAKELOCK, false);
|
||||
Main.start(context, wakelock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
doc/conf.py
10
doc/conf.py
@ -38,16 +38,19 @@ author = 'Max Kellermann'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.23'
|
||||
with open('../meson.build') as f:
|
||||
import re
|
||||
version = re.match(r"project\([^\)]*\bversion:\s*'([^']+)'",
|
||||
f.read(4096)).group(1)
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version + '~git'
|
||||
#release = version + '~git'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
language = "en"
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
@ -107,6 +110,7 @@ html_theme = 'classic'
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
html_theme_options = {"sidebarwidth": "300px"}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
# html_theme_path = []
|
||||
|
@ -11,6 +11,12 @@ Music Player Daemon
|
||||
client
|
||||
protocol
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: man pages:
|
||||
|
||||
mpd.1
|
||||
mpd.conf.5
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
@ -128,23 +128,6 @@ audio_output
|
||||
no audio_output section is specified, then MPD will scan for a usable audio
|
||||
output.
|
||||
|
||||
replaygain <off or album or track or auto>
|
||||
If specified, mpd will adjust the volume of songs played using ReplayGain
|
||||
tags (see https://wiki.hydrogenaud.io/index.php?title=Replaygain).
|
||||
Setting this to "album" will
|
||||
adjust volume using the album's ReplayGain tags, while setting it to "track"
|
||||
will adjust it using the track ReplayGain tags. "auto" uses the track
|
||||
ReplayGain tags if random play is activated otherwise the album ReplayGain
|
||||
tags. Currently only FLAC, Ogg Vorbis, Musepack, and MP3 (through ID3v2
|
||||
ReplayGain tags, not APEv2) are supported.
|
||||
|
||||
replaygain_preamp <-15 to 15>
|
||||
This is the gain (in dB) applied to songs with ReplayGain tags.
|
||||
|
||||
volume_normalization <yes or no>
|
||||
If yes, mpd will normalize the volume of songs as they play. The default is
|
||||
no.
|
||||
|
||||
filesystem_charset <charset>
|
||||
This specifies the character set used for the filesystem. A list of supported
|
||||
character sets can be obtained by running "iconv -l". The default is
|
||||
|
@ -26,22 +26,25 @@
|
||||
# files over an accepted protocol.
|
||||
#
|
||||
#db_file "~/.mpd/database"
|
||||
#
|
||||
|
||||
# These settings are the locations for the daemon log files for the daemon.
|
||||
# These logs are great for troubleshooting, depending on your log_level
|
||||
# settings.
|
||||
#
|
||||
# The special value "syslog" makes MPD use the local syslog daemon. This
|
||||
# setting defaults to logging to syslog.
|
||||
#
|
||||
#log_file "~/.mpd/log"
|
||||
# If you use systemd, do not configure a log_file. With systemd, MPD
|
||||
# defaults to the systemd journal, which is fine.
|
||||
#
|
||||
#log_file "~/.mpd/log"
|
||||
|
||||
# This setting sets the location of the file which stores the process ID
|
||||
# for use of mpd --kill and some init scripts. This setting is disabled by
|
||||
# default and the pid file will not be stored.
|
||||
#
|
||||
#pid_file "~/.mpd/pid"
|
||||
# If you use systemd, do not configure a pid_file.
|
||||
#
|
||||
#pid_file "~/.mpd/pid"
|
||||
|
||||
# This setting sets the location of the file which contains information about
|
||||
# most variables to get MPD back into the same general shape it was in before
|
||||
# it was brought down. This setting is disabled by default and the server
|
||||
@ -76,7 +79,7 @@
|
||||
# This setting sets the address for the daemon to listen on. Careful attention
|
||||
# should be paid if this is assigned to anything other than the default, any.
|
||||
# This setting can deny access to control of the daemon. Not effective if
|
||||
# systemd socket activiation is in use.
|
||||
# systemd socket activation is in use.
|
||||
#
|
||||
# For network
|
||||
#bind_to_address "any"
|
||||
@ -178,11 +181,11 @@
|
||||
#
|
||||
#database {
|
||||
# plugin "simple"
|
||||
# path "~/.local/share/mpd/db
|
||||
# path "~/.local/share/mpd/db"
|
||||
# cache_directory "~/.local/share/mpd/cache"
|
||||
#}
|
||||
#
|
||||
# An example of database config for a sattelite setup
|
||||
# An example of database config for a satellite setup
|
||||
#
|
||||
#music_directory "nfs://fileserver.local/srv/mp3"
|
||||
#database {
|
||||
@ -311,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.
|
||||
|
@ -61,6 +61,15 @@ upnp
|
||||
|
||||
Provides access to UPnP media servers.
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
||||
* - Setting
|
||||
- Description
|
||||
* - **interface**
|
||||
- Interface used to discover media servers. Decided by upnp if left unconfigured.
|
||||
|
||||
Storage plugins
|
||||
===============
|
||||
|
||||
@ -197,6 +206,11 @@ Plays audio CDs using libcdio. The URI has the form: "cdda://[DEVICE][/TRACK]".
|
||||
- If the CD drive does not specify a byte order, MPD assumes it is the CPU's native byte order. This setting allows overriding this.
|
||||
* - **speed N**
|
||||
- Request CDParanoia cap the extraction speed to Nx normal CD audio rotation speed, keeping the drive quiet.
|
||||
* - **mode disable|overlap|full**
|
||||
- Set the paranoia mode; ``disable`` means no fixups, ``overlap``
|
||||
performs overlapped reads, and ``full`` enables all options.
|
||||
* - **skip yes|no**
|
||||
- If set to ``no``, then never skip failed reads.
|
||||
|
||||
curl
|
||||
----
|
||||
@ -205,8 +219,9 @@ Opens remote files or streams over HTTP using libcurl.
|
||||
|
||||
Note that unless overridden by the below settings (e.g. by setting
|
||||
them to a blank value), general curl configuration from environment
|
||||
variables such as ``http_proxy`` or specified in :file:`~/.curlrc`
|
||||
will be in effect.
|
||||
variables such as ``http_proxy`` will be in effect.
|
||||
|
||||
User name and password are read from an optional :file:`~/.netrc`, :file:`~/.curlrc` is not read.
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
@ -836,6 +851,16 @@ The `Advanced Linux Sound Architecture (ALSA) <http://www.alsa-project.org/>`_ p
|
||||
- If set to no, then libasound will not attempt to convert between different sample formats (16 bit, 24 bit, floating point, ...).
|
||||
* - **dop yes|no**
|
||||
- If set to yes, then DSD over PCM according to the `DoP standard <http://dsd-guide.com/dop-open-standard>`_ is enabled. This wraps DSD samples in fake 24 bit PCM, and is understood by some DSD capable products, but may be harmful to other hardware. Therefore, the default is no and you can enable the option at your own risk.
|
||||
* - **stop_dsd_silence yes|no**
|
||||
- If enabled, silence is played before manually stopping playback
|
||||
("stop" or "pause") in DSD mode (native DSD or DoP). This is a
|
||||
workaround for some DACs which emit noise when stopping DSD
|
||||
playback.
|
||||
* - **thesycon_dsd_workaround yes|no**
|
||||
- If enabled, enables a workaround for a bug in Thesycon USB
|
||||
audio receivers. On these devices, playing DSD512 or PCM
|
||||
causes all subsequent attempts to play other DSD rates to fail,
|
||||
which can be fixed by briefly playing PCM at 44.1 kHz.
|
||||
* - **allowed_formats F1 F2 ...**
|
||||
- Specifies a list of allowed audio formats, separated by a space. All items may contain asterisks as a wild card, and may be followed by "=dop" to enable DoP (DSD over PCM) for this particular format. The first matching format is used, and if none matches, MPD chooses the best fallback of this list.
|
||||
|
||||
@ -1090,10 +1115,12 @@ Connect to a `PipeWire <https://pipewire.org/>`_ server. Requires
|
||||
* - **target NAME**
|
||||
- Link to the given target. If not specified, let the PipeWire
|
||||
manager select a target. To get a list of available targets,
|
||||
type ``pw-cli dump short Node``
|
||||
type ``pw-cli ls Node``
|
||||
* - **remote NAME**
|
||||
- The name of the remote to connect to. The default is
|
||||
``pipewire-0``.
|
||||
* - **dsd yes|no**
|
||||
- Enable DSD playback. This requires PipeWire 0.38.
|
||||
|
||||
.. _pulse_plugin:
|
||||
|
||||
@ -1193,6 +1220,8 @@ allows MPD to act as a `Snapcast
|
||||
<https://github.com/badaix/snapcast>`__ server. Snapcast clients
|
||||
connect to it and receive audio data from MPD.
|
||||
|
||||
You must set a format.
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
@ -479,7 +479,7 @@ Querying :program:`MPD`'s status
|
||||
current song in seconds, but with higher resolution.
|
||||
- ``duration`` [#since_0_20]_: Duration of the current song in seconds.
|
||||
- ``bitrate``: instantaneous bitrate in kbps
|
||||
- ``xfade``: ``crossfade`` in seconds
|
||||
- ``xfade``: ``crossfade`` in seconds (see :ref:`crossfading`)
|
||||
- ``mixrampdb``: ``mixramp`` threshold in dB
|
||||
- ``mixrampdelay``: ``mixrampdelay`` in seconds
|
||||
- ``audio``: The format emitted by the decoder plugin during
|
||||
@ -519,17 +519,19 @@ Playback options
|
||||
.. _command_crossfade:
|
||||
|
||||
:command:`crossfade {SECONDS}`
|
||||
Sets crossfading between songs.
|
||||
Sets crossfading between songs. See :ref:`crossfading`.
|
||||
|
||||
.. _command_mixrampdb:
|
||||
|
||||
:command:`mixrampdb {deciBels}`
|
||||
Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp
|
||||
Sets the threshold at which songs will be overlapped.
|
||||
See :ref:`mixramp`.
|
||||
|
||||
.. _command_mixrampdelay:
|
||||
|
||||
:command:`mixrampdelay {SECONDS}`
|
||||
Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
|
||||
See :ref:`mixramp`.
|
||||
|
||||
.. _command_random:
|
||||
|
||||
@ -543,6 +545,13 @@ Playback options
|
||||
Sets repeat state to ``STATE``,
|
||||
``STATE`` should be 0 or 1.
|
||||
|
||||
If enabled, MPD keeps repeating the whole queue (:ref:`single mode
|
||||
<command_single>` disabled) or the current song (:ref:`single mode
|
||||
<command_single>` enabled).
|
||||
|
||||
If :ref:`random mode <command_random>` is also enabled, the
|
||||
playback order will be shuffled each time the queue gets repeated.
|
||||
|
||||
.. _command_setvol:
|
||||
|
||||
:command:`setvol {VOL}`
|
||||
@ -551,7 +560,7 @@ Playback options
|
||||
|
||||
.. _command_getvol:
|
||||
|
||||
:command:`getvol`
|
||||
:command:`getvol` [#since_0_23]_
|
||||
|
||||
Read the volume. The result is a ``volume:`` line like in
|
||||
:ref:`status <command_status>`. If there is no mixer, MPD will
|
||||
@ -689,11 +698,14 @@ Whenever possible, ids should be used.
|
||||
|
||||
.. _command_add:
|
||||
|
||||
:command:`add {URI}`
|
||||
:command:`add {URI} [POSITION]`
|
||||
Adds the file ``URI`` to the playlist
|
||||
(directories add recursively). ``URI``
|
||||
can also be a single file.
|
||||
|
||||
The position parameter is the same as in :ref:`addid
|
||||
<command_addid>`. [#since_0_23_3]_
|
||||
|
||||
Clients that are connected via local socket may add arbitrary
|
||||
local files (URI is an absolute path). Example::
|
||||
|
||||
@ -711,10 +723,10 @@ Whenever possible, ids should be used.
|
||||
|
||||
If the second parameter is given, then the song is inserted at the
|
||||
specified position. If the parameter starts with ``+`` or ``-``,
|
||||
then it is relative to the current song; e.g. ``+0`` inserts right
|
||||
after the current song and ``-0`` inserts right before the current
|
||||
song (i.e. zero songs between the current song and the newly added
|
||||
song).
|
||||
then it is relative to the current song [#since_0_23]_; e.g. ``+0``
|
||||
inserts right after the current song and ``-0`` inserts right
|
||||
before the current song (i.e. zero songs between the current song
|
||||
and the newly added song).
|
||||
|
||||
.. _command_clear:
|
||||
|
||||
@ -768,8 +780,8 @@ Whenever possible, ids should be used.
|
||||
.. _command_playlistfind:
|
||||
|
||||
:command:`playlistfind {FILTER}`
|
||||
Finds songs in the queue with strict
|
||||
matching.
|
||||
Search the queue for songs matching
|
||||
``FILTER`` (see :ref:`Filters <filter_syntax>`).
|
||||
|
||||
.. _command_playlistid:
|
||||
|
||||
@ -789,8 +801,10 @@ Whenever possible, ids should be used.
|
||||
.. _command_playlistsearch:
|
||||
|
||||
:command:`playlistsearch {FILTER}`
|
||||
Searches case-insensitively for partial matches in the
|
||||
queue.
|
||||
Search the queue for songs matching
|
||||
``FILTER`` (see :ref:`Filters <filter_syntax>`).
|
||||
Parameters have the same meaning as for :ref:`find
|
||||
<command_playlistfind>`, except that search is not case sensitive.
|
||||
|
||||
.. _command_plchanges:
|
||||
|
||||
@ -923,18 +937,22 @@ remote playlists (absolute URI with a supported scheme).
|
||||
only a part of the playlist.
|
||||
|
||||
The ``POSITION`` parameter specifies where the songs will be
|
||||
inserted into the queue. (This requires specifying the range as
|
||||
well; the special value `0:` can be used if the whole playlist
|
||||
shall be loaded at a certain queue position.)
|
||||
inserted into the queue; it can be relative as described in
|
||||
:ref:`addid <command_addid>`. (This requires specifying the range
|
||||
as well; the special value `0:` can be used if the whole playlist
|
||||
shall be loaded at a certain queue position.) [#since_0_23_1]_
|
||||
|
||||
.. _command_playlistadd:
|
||||
|
||||
:command:`playlistadd {NAME} {URI}`
|
||||
:command:`playlistadd {NAME} {URI} [POSITION]`
|
||||
Adds ``URI`` to the playlist
|
||||
`NAME.m3u`.
|
||||
`NAME.m3u` will be created if it does
|
||||
not exist.
|
||||
|
||||
The ``POSITION`` parameter specifies where the songs will be
|
||||
inserted into the playlist. [#since_0_23_3]_
|
||||
|
||||
.. _command_playlistclear:
|
||||
|
||||
:command:`playlistclear {NAME}`
|
||||
@ -946,6 +964,8 @@ remote playlists (absolute URI with a supported scheme).
|
||||
Deletes ``SONGPOS`` from the
|
||||
playlist `NAME.m3u`.
|
||||
|
||||
The second parameter can be a range. [#since_0_23_3]_
|
||||
|
||||
.. _command_playlistmove:
|
||||
|
||||
:command:`playlistmove {NAME} {FROM} {TO}`
|
||||
@ -1059,11 +1079,11 @@ The music database
|
||||
|
||||
.. _command_findadd:
|
||||
|
||||
:command:`findadd {FILTER} [sort {TYPE}] [window {START:END}]`
|
||||
:command:`findadd {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
|
||||
Search the database for songs matching
|
||||
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
|
||||
the queue. Parameters have the same meaning as for
|
||||
:ref:`find <command_find>`.
|
||||
:ref:`find <command_find>` and :ref:`searchadd <command_searchadd>`.
|
||||
|
||||
.. _command_list:
|
||||
|
||||
@ -1196,15 +1216,12 @@ The music database
|
||||
|
||||
.. _command_search:
|
||||
|
||||
:command:`search {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
|
||||
:command:`search {FILTER} [sort {TYPE}] [window {START:END}]`
|
||||
Search the database for songs matching
|
||||
``FILTER`` (see :ref:`Filters <filter_syntax>`). Parameters
|
||||
have the same meaning as for :ref:`find <command_find>`,
|
||||
except that search is not case sensitive.
|
||||
|
||||
The ``position`` parameter specifies where the songs will be
|
||||
inserted.
|
||||
|
||||
.. _command_searchadd:
|
||||
|
||||
:command:`searchadd {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
|
||||
@ -1214,9 +1231,14 @@ The music database
|
||||
|
||||
Parameters have the same meaning as for :ref:`search <command_search>`.
|
||||
|
||||
The ``position`` parameter specifies where the songs will be
|
||||
inserted. [#since_0_23]_
|
||||
It can be relative to the current song as in :ref:`addid
|
||||
<command_addid>`. [#since_0_23_5]_
|
||||
|
||||
.. _command_searchaddpl:
|
||||
|
||||
:command:`searchaddpl {NAME} {FILTER} [sort {TYPE}] [window {START:END}]`
|
||||
:command:`searchaddpl {NAME} {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
|
||||
Search the database for songs matching
|
||||
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
|
||||
the playlist named ``NAME``.
|
||||
@ -1225,6 +1247,9 @@ The music database
|
||||
|
||||
Parameters have the same meaning as for :ref:`search <command_search>`.
|
||||
|
||||
The ``position`` parameter specifies where the songs will be
|
||||
inserted. [#since_0_23_4]_
|
||||
|
||||
.. _command_update:
|
||||
|
||||
:command:`update [URI]`
|
||||
@ -1643,3 +1668,8 @@ client-to-client messages are local to the current partition.
|
||||
.. [#since_0_20] Since :program:`MPD` 0.20
|
||||
.. [#since_0_21] Since :program:`MPD` 0.21
|
||||
.. [#since_0_22_4] Since :program:`MPD` 0.22.4
|
||||
.. [#since_0_23] Since :program:`MPD` 0.23
|
||||
.. [#since_0_23_1] Since :program:`MPD` 0.23.1
|
||||
.. [#since_0_23_3] Since :program:`MPD` 0.23.3
|
||||
.. [#since_0_23_4] Since :program:`MPD` 0.23.4
|
||||
.. [#since_0_23_5] Since :program:`MPD` 0.23.5
|
||||
|
144
doc/user.rst
144
doc/user.rst
@ -36,7 +36,9 @@ Installing on Android
|
||||
|
||||
An experimental Android build is available on Google Play. After installing and launching it, :program:`MPD` will scan the music in your Music directory and you can control it as usual with a :program:`MPD` client.
|
||||
|
||||
If you need to tweak the configuration, you can create a file called :file:`mpd.conf` on the data partition (the directory which is returned by Android's :dfn:`getExternalStorageDirectory()` API function).
|
||||
If you need to tweak the configuration, you can create a file called
|
||||
:file:`mpd.conf` in MPD's data directory on the external storage
|
||||
(usually :file:`Android/data/org.musicpd/files/mpd.conf`).
|
||||
|
||||
ALSA is not available on Android; only the :ref:`OpenSL ES
|
||||
<sles_output>` output plugin can be used for local playback.
|
||||
@ -64,13 +66,13 @@ In any case, you need:
|
||||
Each plugin usually needs a codec library, which you also need to
|
||||
install. Check the :doc:`plugins` for details about required libraries
|
||||
|
||||
For example, the following installs a fairly complete list of build dependencies on Debian Buster:
|
||||
For example, the following installs a fairly complete list of build dependencies on Debian Bullseye:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
apt install meson g++ \
|
||||
libfmt-dev \
|
||||
libpcre3-dev \
|
||||
libpcre2-dev \
|
||||
libmad0-dev libmpg123-dev libid3tag0-dev \
|
||||
libflac-dev libvorbis-dev libopus-dev libogg-dev \
|
||||
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
|
||||
@ -172,7 +174,9 @@ tarball and change into the directory. Then, instead of
|
||||
|
||||
mkdir -p output/win64
|
||||
cd output/win64
|
||||
../../win32/build.py --64
|
||||
../../win32/build.py --64 \
|
||||
--buildtype=debugoptimized -Db_ndebug=true \
|
||||
-Dwrap_mode=forcefallback
|
||||
|
||||
This downloads various library sources, and then configures and builds
|
||||
:program:`MPD` (for x64; to build a 32 bit binary, pass
|
||||
@ -182,6 +186,11 @@ around. It is large, but easy to use. If you wish to have a small
|
||||
mpd.exe with DLLs, you need to compile manually, without the
|
||||
:file:`build.py` script.
|
||||
|
||||
The option ``-Dwrap_mode=forcefallback`` tells Meson to download and
|
||||
cross-compile several libraries used by MPD instead of looking for
|
||||
them on your computer.
|
||||
|
||||
|
||||
Compiling for Android
|
||||
---------------------
|
||||
|
||||
@ -190,7 +199,7 @@ Compiling for Android
|
||||
You need:
|
||||
|
||||
* Android SDK
|
||||
* `Android NDK r23 <https://developer.android.com/ndk/downloads>`_
|
||||
* `Android NDK r25b <https://developer.android.com/ndk/downloads>`_
|
||||
* `Meson 0.56.0 <http://mesonbuild.com/>`__ and `Ninja
|
||||
<https://ninja-build.org/>`__
|
||||
* cmake
|
||||
@ -205,8 +214,10 @@ tarball and change into the directory. Then, instead of
|
||||
|
||||
mkdir -p output/android
|
||||
cd output/android
|
||||
../../android/build.py SDK_PATH NDK_PATH ABI
|
||||
meson configure -Dandroid_debug_keystore=$HOME/.android/debug.keystore
|
||||
../../android/build.py SDK_PATH NDK_PATH ABI \
|
||||
--buildtype=debugoptimized -Db_ndebug=true \
|
||||
-Dwrap_mode=forcefallback \
|
||||
-Dandroid_debug_keystore=$HOME/.android/debug.keystore
|
||||
ninja android/apk/mpd-debug.apk
|
||||
|
||||
:envvar:`SDK_PATH` is the absolute path where you installed the
|
||||
@ -292,7 +303,7 @@ Configuring neighbor plugins
|
||||
----------------------------
|
||||
|
||||
All neighbor plugins are disabled by default to avoid unwanted
|
||||
overhead. To enable (and configure) a plugin, add a :code:`neighbor`
|
||||
overhead. To enable (and configure) a plugin, add a :code:`neighbors`
|
||||
block to :file:`mpd.conf`:
|
||||
|
||||
.. code-block:: none
|
||||
@ -456,6 +467,11 @@ The following table lists the audio_output options valid for all plugins:
|
||||
implement an external mixer, see :ref:`external_mixer`) or no mixer
|
||||
(:samp:`none`). By default, the hardware mixer is used for
|
||||
devices which support it, and none for the others.
|
||||
* - **replay_gain_handler software|mixer|none**
|
||||
- Specifies how :ref:`replay_gain` is applied. The default is
|
||||
``software``, which uses an internal software volume control.
|
||||
``mixer`` uses the configured (hardware) mixer control.
|
||||
``none`` disables replay gain on this audio output.
|
||||
* - **filters "name,...**"
|
||||
- The specified configured filters are instantiated in the given
|
||||
order. Each filter name refers to a ``filter`` block, see
|
||||
@ -524,7 +540,7 @@ The following table lists the playlist_plugin options valid for all plugins:
|
||||
|
||||
* - Name
|
||||
- Description
|
||||
* - **plugin**
|
||||
* - **name**
|
||||
- The name of the plugin
|
||||
* - **enabled yes|no**
|
||||
- Allows you to disable a playlist plugin without recompiling. By default, all plugins are enabled.
|
||||
@ -574,6 +590,92 @@ Sometimes, music needs to be resampled before it can be played; for example, CDs
|
||||
Check the :ref:`resampler_plugins` reference for a list of resamplers
|
||||
and how to configure them.
|
||||
|
||||
Volume Normalization Settings
|
||||
-----------------------------
|
||||
|
||||
.. _replay_gain:
|
||||
|
||||
Replay Gain
|
||||
^^^^^^^^^^^
|
||||
|
||||
The setting ``replaygain`` specifies whether MPD shall adjust the
|
||||
volume of songs played using `ReplayGain
|
||||
<https://wiki.hydrogenaud.io/index.php?title=Replaygain>`__ tags.
|
||||
Setting this to ``album`` will adjust volume using the album's
|
||||
ReplayGain tags, while setting it to ``track`` will adjust it using
|
||||
the "track" ReplayGain tags. ``auto`` uses the track ReplayGain tags
|
||||
if random play is activated otherwise the album ReplayGain
|
||||
tags.
|
||||
|
||||
If ReplayGain is enabled, then the setting ``replaygain_preamp`` is
|
||||
set to a value (in dB) between ``-15`` and ``15``. This is the gain
|
||||
applied to songs with ReplayGain tags.
|
||||
|
||||
On songs without ReplayGain tags, the setting
|
||||
``replaygain_missing_preamp`` is used instead. If this setting is not
|
||||
configured, then no ReplayGain is applied to such songs, and they will
|
||||
appear too loud.
|
||||
|
||||
ReplayGain is usually implemented with a software volume filter (which
|
||||
prevents `Bit-perfect playback`_). To use a hardware mixer, set
|
||||
``replay_gain_handler`` to ``mixer`` in the ``audio_output`` section
|
||||
(see :ref:`config_audio_output` for details).
|
||||
|
||||
Simple Volume Normalization
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
MPD implements a very simple volume normalization method which can be
|
||||
enabled by setting ``volume_normalization`` to ``yes``. It supports
|
||||
16 bit PCM only.
|
||||
|
||||
|
||||
.. _crossfading:
|
||||
|
||||
Cross-Fading
|
||||
------------
|
||||
|
||||
If ``crossfade`` is set to a positive number, then adjacent songs are
|
||||
cross-faded by this number of seconds. This is a run-time setting
|
||||
:ref:`which can be controlled by clients <command_crossfade>`,
|
||||
e.g. with :program:`mpc`::
|
||||
|
||||
mpc crossfade 10
|
||||
mpc crossfade 0
|
||||
|
||||
Zero means cross-fading is disabled.
|
||||
|
||||
Cross-fading is only possible if both songs have the same audio
|
||||
format. At the cost of quality loss and higher CPU usage, you can
|
||||
make sure this is always given by configuring
|
||||
:ref:`audio_output_format`.
|
||||
|
||||
.. _mixramp:
|
||||
|
||||
MixRamp
|
||||
^^^^^^^
|
||||
|
||||
MixRamp tags describe the loudness levels at start and end of a song
|
||||
and can be used by MPD to find the best time to begin cross-fading.
|
||||
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
|
||||
- both songs have the same audio format (or :ref:`audio_output_format`
|
||||
is configured)
|
||||
|
||||
The `MixRamp <http://sourceforge.net/projects/mixramp>`__ tool can be
|
||||
used to add MixRamp tags to your song files.
|
||||
|
||||
|
||||
|
||||
Client Connections
|
||||
------------------
|
||||
|
||||
@ -970,7 +1072,19 @@ The "music directory" is where you store your music files. :program:`MPD` stores
|
||||
|
||||
Depending on the size of your music collection and the speed of the storage, this can take a while.
|
||||
|
||||
To exclude a file from the update, create a file called :file:`.mpdignore` in its parent directory. Each line of that file may contain a list of shell wildcards. Matching files in the current directory and all subdirectories are excluded.
|
||||
To exclude a file from the update, create a file called
|
||||
:file:`.mpdignore` in its parent directory. Each line of that file
|
||||
may contain a list of shell wildcards. Matching files (or
|
||||
directories) in the current directory and all subdirectories are
|
||||
excluded. Example::
|
||||
|
||||
*.opus
|
||||
99*
|
||||
|
||||
Subject to pattern matching is the file/directory name. It is (not
|
||||
yet) possible to match nested path names, e.g. something like
|
||||
``foo/*.flac`` is not possible.
|
||||
|
||||
|
||||
Mounting other storages into the music directory
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -1010,6 +1124,15 @@ See :ref:`tags` for a list of supported tags.
|
||||
The :ref:`metadata_to_use <metadata_to_use>` setting can be used to
|
||||
enable or disable certain tags.
|
||||
|
||||
Note that :program:`MPD` may not necessarily read metadata itself,
|
||||
instead relying on data reported by the decoder that was used to read
|
||||
a file. For example, this is the case for the FFmpeg decoder: both
|
||||
:program:`MPD` and FFmpeg need to support a given metadata format in
|
||||
order for metadata to be picked up correctly.
|
||||
|
||||
Only if a decoder does not have metadata support will :program:`MPD`
|
||||
attempt to parse a song's metadata itself.
|
||||
|
||||
The queue
|
||||
---------
|
||||
|
||||
@ -1067,6 +1190,7 @@ Check list for bit-perfect playback:
|
||||
* Disable sound processing inside ALSA by configuring a "hardware"
|
||||
device (:samp:`hw:0,0` or similar).
|
||||
* Don't use software volume (setting :code:`mixer_type`).
|
||||
* Don't use :ref:`replay_gain`.
|
||||
* Don't force :program:`MPD` to use a specific audio format (settings
|
||||
:code:`format`, :ref:`audio_output_format <audio_output_format>`).
|
||||
* Verify that you are really doing bit-perfect playback using :program:`MPD`'s verbose log and :file:`/proc/asound/card*/pcm*p/sub*/hw_params`. Some DACs can also indicate the audio format.
|
||||
|
21
meson.build
21
meson.build
@ -1,7 +1,7 @@
|
||||
project(
|
||||
'mpd',
|
||||
['c', 'cpp'],
|
||||
version: '0.23',
|
||||
version: '0.23.14',
|
||||
meson_version: '>= 0.56.0',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
@ -44,7 +44,7 @@ version_conf = configuration_data()
|
||||
version_conf.set_quoted('PACKAGE', meson.project_name())
|
||||
version_conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||
version_conf.set_quoted('VERSION', meson.project_version())
|
||||
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.0')
|
||||
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.5')
|
||||
configure_file(output: 'Version.h', configuration: version_conf)
|
||||
|
||||
conf = configuration_data()
|
||||
@ -73,6 +73,9 @@ test_common_flags = [
|
||||
# clang specific warning options:
|
||||
'-Wunreachable-code-aggressive',
|
||||
'-Wused-but-marked-unused',
|
||||
|
||||
# suppress bogus GCC12 warnings in libfmt headers
|
||||
'-Wno-stringop-overflow',
|
||||
]
|
||||
|
||||
test_global_cxxflags = test_global_common_flags + [
|
||||
@ -202,7 +205,6 @@ enable_daemon = not is_windows and not is_android and get_option('daemon')
|
||||
conf.set('ENABLE_DAEMON', enable_daemon)
|
||||
|
||||
conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
|
||||
conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
|
||||
conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
|
||||
conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
|
||||
|
||||
@ -248,6 +250,14 @@ endif
|
||||
|
||||
fmt_dep = dependency('fmt', fallback: ['fmt', 'fmt_dep'])
|
||||
|
||||
if compiler.get_id() == 'clang' and compiler.version().version_compare('<15')
|
||||
fmt_dep = declare_dependency(
|
||||
dependencies: fmt_dep,
|
||||
# suppress bogus clang 14 warning (the version in Android NDK r25b)
|
||||
compile_args: ['-Wno-unused-local-typedef'],
|
||||
)
|
||||
endif
|
||||
|
||||
log = static_library(
|
||||
'log',
|
||||
'src/Log.cxx',
|
||||
@ -265,8 +275,8 @@ sources = [
|
||||
version_cxx,
|
||||
'src/Main.cxx',
|
||||
'src/protocol/ArgParser.cxx',
|
||||
'src/protocol/Result.cxx',
|
||||
'src/command/CommandError.cxx',
|
||||
'src/command/PositionArg.cxx',
|
||||
'src/command/AllCommands.cxx',
|
||||
'src/command/QueueCommands.cxx',
|
||||
'src/command/TagCommands.cxx',
|
||||
@ -349,7 +359,7 @@ sources = [
|
||||
'src/TagStream.cxx',
|
||||
'src/TagAny.cxx',
|
||||
'src/TimePrint.cxx',
|
||||
'src/mixer/Volume.cxx',
|
||||
'src/mixer/Memento.cxx',
|
||||
'src/PlaylistFile.cxx',
|
||||
]
|
||||
|
||||
@ -379,6 +389,7 @@ endif
|
||||
|
||||
if enable_database
|
||||
sources += [
|
||||
'src/storage/StorageState.cxx',
|
||||
'src/queue/PlaylistUpdate.cxx',
|
||||
'src/command/StorageCommands.cxx',
|
||||
'src/command/DatabaseCommands.cxx',
|
||||
|
@ -1,26 +1,32 @@
|
||||
import os.path, subprocess, sys
|
||||
from typing import Collection, Iterable, Optional, Sequence, Union
|
||||
from collections.abc import Mapping
|
||||
|
||||
from build.makeproject import MakeProject
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class AutotoolsProject(MakeProject):
|
||||
def __init__(self, url, md5, installed, configure_args=[],
|
||||
autogen=False,
|
||||
autoreconf=False,
|
||||
cppflags='',
|
||||
ldflags='',
|
||||
libs='',
|
||||
subdirs=None,
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
configure_args: Iterable[str]=[],
|
||||
autogen: bool=False,
|
||||
autoreconf: bool=False,
|
||||
per_arch_cflags: Optional[Mapping[str, str]]=None,
|
||||
cppflags: str='',
|
||||
ldflags: str='',
|
||||
libs: str='',
|
||||
subdirs: Optional[Collection[str]]=None,
|
||||
**kwargs):
|
||||
MakeProject.__init__(self, url, md5, installed, **kwargs)
|
||||
self.configure_args = configure_args
|
||||
self.autogen = autogen
|
||||
self.autoreconf = autoreconf
|
||||
self.per_arch_cflags = per_arch_cflags
|
||||
self.cppflags = cppflags
|
||||
self.ldflags = ldflags
|
||||
self.libs = libs
|
||||
self.subdirs = subdirs
|
||||
|
||||
def configure(self, toolchain):
|
||||
def configure(self, toolchain: AnyToolchain) -> str:
|
||||
src = self.unpack(toolchain)
|
||||
if self.autogen:
|
||||
if sys.platform == 'darwin':
|
||||
@ -35,27 +41,48 @@ class AutotoolsProject(MakeProject):
|
||||
|
||||
build = self.make_build_path(toolchain)
|
||||
|
||||
arch_cflags = ''
|
||||
if self.per_arch_cflags is not None and toolchain.host_triplet is not None:
|
||||
arch_cflags = self.per_arch_cflags.get(toolchain.host_triplet, '')
|
||||
|
||||
configure = [
|
||||
os.path.join(src, 'configure'),
|
||||
'CC=' + toolchain.cc,
|
||||
'CXX=' + toolchain.cxx,
|
||||
'CFLAGS=' + toolchain.cflags,
|
||||
'CXXFLAGS=' + toolchain.cxxflags,
|
||||
'CFLAGS=' + toolchain.cflags + ' ' + arch_cflags,
|
||||
'CXXFLAGS=' + toolchain.cxxflags + ' ' + arch_cflags,
|
||||
'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags,
|
||||
'LDFLAGS=' + toolchain.ldflags + ' ' + self.ldflags,
|
||||
'LIBS=' + toolchain.libs + ' ' + self.libs,
|
||||
'AR=' + toolchain.ar,
|
||||
'ARFLAGS=' + toolchain.arflags,
|
||||
'RANLIB=' + toolchain.ranlib,
|
||||
'STRIP=' + toolchain.strip,
|
||||
'--host=' + toolchain.arch,
|
||||
'--prefix=' + toolchain.install_prefix,
|
||||
'--enable-silent-rules',
|
||||
] + self.configure_args
|
||||
'--disable-silent-rules',
|
||||
]
|
||||
|
||||
if toolchain.host_triplet is not None:
|
||||
configure.append('--host=' + toolchain.host_triplet)
|
||||
|
||||
configure.extend(self.configure_args)
|
||||
|
||||
try:
|
||||
print(configure)
|
||||
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
||||
except subprocess.CalledProcessError:
|
||||
# dump config.log after a failed configure run
|
||||
try:
|
||||
with open(os.path.join(build, 'config.log')) as f:
|
||||
sys.stdout.write(f.read())
|
||||
except:
|
||||
pass
|
||||
# re-raise the exception
|
||||
raise
|
||||
|
||||
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
||||
return build
|
||||
|
||||
def _build(self, toolchain):
|
||||
def _build(self, toolchain: AnyToolchain) -> None:
|
||||
build = self.configure(toolchain)
|
||||
if self.subdirs is not None:
|
||||
for subdir in self.subdirs:
|
||||
|
@ -1,17 +1,21 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from typing import cast, Optional, Sequence, TextIO, Union
|
||||
from collections.abc import Mapping
|
||||
|
||||
from build.project import Project
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
def __write_cmake_compiler(f, language, compiler):
|
||||
def __write_cmake_compiler(f: TextIO, language: str, compiler: str) -> None:
|
||||
s = compiler.split(' ', 1)
|
||||
if len(s) == 2:
|
||||
print(f'set(CMAKE_{language}_COMPILER_LAUNCHER {s[0]})', file=f)
|
||||
compiler = s[1]
|
||||
print(f'set(CMAKE_{language}_COMPILER {compiler})', file=f)
|
||||
|
||||
def __write_cmake_toolchain_file(f, toolchain):
|
||||
if '-darwin' in toolchain.actual_arch:
|
||||
def __write_cmake_toolchain_file(f: TextIO, toolchain: AnyToolchain) -> None:
|
||||
if toolchain.is_darwin:
|
||||
cmake_system_name = 'Darwin'
|
||||
elif toolchain.is_windows:
|
||||
cmake_system_name = 'Windows'
|
||||
@ -20,67 +24,99 @@ def __write_cmake_toolchain_file(f, toolchain):
|
||||
|
||||
f.write(f"""
|
||||
set(CMAKE_SYSTEM_NAME {cmake_system_name})
|
||||
set(CMAKE_SYSTEM_PROCESSOR {toolchain.actual_arch.split('-', 1)[0]})
|
||||
set(CMAKE_SYSTEM_PROCESSOR {toolchain.host_triplet.split('-', 1)[0]})
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET {toolchain.actual_arch})
|
||||
set(CMAKE_CXX_COMPILER_TARGET {toolchain.actual_arch})
|
||||
set(CMAKE_C_COMPILER_TARGET {toolchain.host_triplet})
|
||||
set(CMAKE_CXX_COMPILER_TARGET {toolchain.host_triplet})
|
||||
|
||||
set(CMAKE_C_FLAGS "{toolchain.cflags} {toolchain.cppflags}")
|
||||
set(CMAKE_CXX_FLAGS "{toolchain.cxxflags} {toolchain.cppflags}")
|
||||
set(CMAKE_C_FLAGS_INIT "{toolchain.cflags} {toolchain.cppflags}")
|
||||
set(CMAKE_CXX_FLAGS_INIT "{toolchain.cxxflags} {toolchain.cppflags}")
|
||||
""")
|
||||
__write_cmake_compiler(f, 'C', toolchain.cc)
|
||||
__write_cmake_compiler(f, 'CXX', toolchain.cxx)
|
||||
|
||||
def configure(toolchain, src, build, args=()):
|
||||
cross_args = []
|
||||
if cmake_system_name == 'Darwin':
|
||||
# On macOS, cmake forcibly adds an "-isysroot" flag even if
|
||||
# one is already present in the flags variable; this breaks
|
||||
# cross-compiling for iOS, and can be worked around by setting
|
||||
# the CMAKE_OSX_SYSROOT variable
|
||||
# (https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html).
|
||||
m = re.search(r'-isysroot +(\S+)', toolchain.cflags)
|
||||
if m:
|
||||
sysroot = m.group(1)
|
||||
|
||||
print(f'set(CMAKE_OSX_SYSROOT {sysroot})', file=f)
|
||||
|
||||
# search libraries and headers only in the sysroot, not on
|
||||
# the build host
|
||||
f.write(f"""
|
||||
set(CMAKE_FIND_ROOT_PATH "{toolchain.install_prefix};{sysroot}")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
""")
|
||||
|
||||
def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[], env: Optional[Mapping[str, str]]=None) -> None:
|
||||
cross_args: list[str] = []
|
||||
|
||||
if toolchain.is_windows:
|
||||
cross_args.append('-DCMAKE_RC_COMPILER=' + toolchain.windres)
|
||||
|
||||
# Several targets need a sysroot to prevent pkg-config from
|
||||
# looking for libraries on the build host (TODO: fix this
|
||||
# properly); but we must not do that on Android because the NDK
|
||||
# has a sysroot already
|
||||
if '-android' not in toolchain.actual_arch and '-darwin' not in toolchain.actual_arch:
|
||||
cross_args.append('-DCMAKE_SYSROOT=' + toolchain.install_prefix)
|
||||
|
||||
os.makedirs(build, exist_ok=True)
|
||||
cmake_toolchain_file = os.path.join(build, 'cmake_toolchain_file')
|
||||
with open(cmake_toolchain_file, 'w') as f:
|
||||
__write_cmake_toolchain_file(f, toolchain)
|
||||
cross_args.append('-DCMAKE_RC_COMPILER=' + cast(str, toolchain.windres))
|
||||
|
||||
configure = [
|
||||
'cmake',
|
||||
src,
|
||||
|
||||
'-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file,
|
||||
|
||||
'-DCMAKE_INSTALL_PREFIX=' + toolchain.install_prefix,
|
||||
'-DCMAKE_BUILD_TYPE=release',
|
||||
|
||||
'-GNinja',
|
||||
] + cross_args + args
|
||||
|
||||
subprocess.check_call(configure, env=toolchain.env, cwd=build)
|
||||
if toolchain.host_triplet is not None:
|
||||
# cross-compiling: write a toolchain file
|
||||
os.makedirs(build, exist_ok=True)
|
||||
|
||||
# Several targets need a sysroot to prevent pkg-config from
|
||||
# looking for libraries on the build host (TODO: fix this
|
||||
# properly); but we must not do that on Android because the NDK
|
||||
# has a sysroot already
|
||||
if not toolchain.is_android and not toolchain.is_darwin:
|
||||
cross_args.append('-DCMAKE_SYSROOT=' + toolchain.install_prefix)
|
||||
|
||||
cmake_toolchain_file = os.path.join(build, 'cmake_toolchain_file')
|
||||
with open(cmake_toolchain_file, 'w') as f:
|
||||
__write_cmake_toolchain_file(f, toolchain)
|
||||
|
||||
configure.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)
|
||||
|
||||
if env is None:
|
||||
env = toolchain.env
|
||||
else:
|
||||
env = {**toolchain.env, **env}
|
||||
|
||||
print(configure)
|
||||
subprocess.check_call(configure, env=env, cwd=build)
|
||||
|
||||
class CmakeProject(Project):
|
||||
def __init__(self, url, md5, installed, configure_args=[],
|
||||
windows_configure_args=[],
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
configure_args: list[str]=[],
|
||||
windows_configure_args: list[str]=[],
|
||||
env: Optional[Mapping[str, str]]=None,
|
||||
**kwargs):
|
||||
Project.__init__(self, url, md5, installed, **kwargs)
|
||||
self.configure_args = configure_args
|
||||
self.windows_configure_args = windows_configure_args
|
||||
self.env = env
|
||||
|
||||
def configure(self, toolchain):
|
||||
def configure(self, toolchain: AnyToolchain) -> str:
|
||||
src = self.unpack(toolchain)
|
||||
build = self.make_build_path(toolchain)
|
||||
configure_args = self.configure_args
|
||||
if toolchain.is_windows:
|
||||
configure_args = configure_args + self.windows_configure_args
|
||||
configure(toolchain, src, build, configure_args)
|
||||
configure(toolchain, src, build, configure_args, self.env)
|
||||
return build
|
||||
|
||||
def _build(self, toolchain):
|
||||
def _build(self, toolchain: AnyToolchain) -> None:
|
||||
build = self.configure(toolchain)
|
||||
subprocess.check_call(['ninja', 'install'],
|
||||
subprocess.check_call(['ninja', '-v', 'install'],
|
||||
cwd=build, env=toolchain.env)
|
||||
|
@ -1,12 +1,50 @@
|
||||
from build.verify import verify_file_digest
|
||||
from typing import Sequence, Union
|
||||
import os
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
def download_and_verify(url, md5, parent_path):
|
||||
from .verify import verify_file_digest
|
||||
|
||||
def __to_string_sequence(x: Union[str, Sequence[str]]) -> Sequence[str]:
|
||||
if isinstance(x, str):
|
||||
return (x,)
|
||||
else:
|
||||
return x
|
||||
|
||||
def __get_any(x: Union[str, Sequence[str]]) -> str:
|
||||
if isinstance(x, str):
|
||||
return x
|
||||
else:
|
||||
return x[0]
|
||||
|
||||
def __download_one(url: str, path: str) -> None:
|
||||
print("download", url)
|
||||
urllib.request.urlretrieve(url, path)
|
||||
|
||||
def __download(urls: Sequence[str], path: str) -> None:
|
||||
for url in urls[:-1]:
|
||||
try:
|
||||
__download_one(url, path)
|
||||
return
|
||||
except:
|
||||
print("download error:", sys.exc_info()[0])
|
||||
__download_one(urls[-1], path)
|
||||
|
||||
def __download_and_verify_to(urls: Sequence[str], md5: str, path: str) -> None:
|
||||
__download(urls, path)
|
||||
if not verify_file_digest(path, md5):
|
||||
raise RuntimeError("Digest mismatch")
|
||||
|
||||
def download_basename(urls: Union[str, Sequence[str]]) -> str:
|
||||
return os.path.basename(__get_any(urls))
|
||||
|
||||
def download_and_verify(urls: Union[str, Sequence[str]], md5: str, parent_path: str) -> str:
|
||||
"""Download a file, verify its MD5 checksum and return the local path."""
|
||||
|
||||
base = download_basename(urls)
|
||||
|
||||
os.makedirs(parent_path, exist_ok=True)
|
||||
path = os.path.join(parent_path, os.path.basename(url))
|
||||
path = os.path.join(parent_path, base)
|
||||
|
||||
try:
|
||||
if verify_file_digest(path, md5): return path
|
||||
@ -16,11 +54,6 @@ def download_and_verify(url, md5, parent_path):
|
||||
|
||||
tmp_path = path + '.tmp'
|
||||
|
||||
print("download", url)
|
||||
urllib.request.urlretrieve(url, tmp_path)
|
||||
if not verify_file_digest(tmp_path, md5):
|
||||
os.unlink(tmp_path)
|
||||
raise RuntimeError("Digest mismatch")
|
||||
|
||||
__download_and_verify_to(__to_string_sequence(urls), md5, tmp_path)
|
||||
os.rename(tmp_path, path)
|
||||
return path
|
||||
|
@ -12,14 +12,14 @@ from build.boost import BoostProject
|
||||
from build.jack import JackProject
|
||||
|
||||
libmpdclient = MesonProject(
|
||||
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.19.tar.xz',
|
||||
'158aad4c2278ab08e76a3f2b0166c99b39fae00ee17231bd225c5a36e977a189',
|
||||
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.20.tar.xz',
|
||||
'18793f68e939c3301e34d8fcadea1f7daa24143941263cecadb80126194e277d',
|
||||
'lib/libmpdclient.a',
|
||||
)
|
||||
|
||||
libogg = CmakeProject(
|
||||
'http://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.xz',
|
||||
'c163bc12bc300c401b6aa35907ac682671ea376f13ae0969a220f7ddf71893fe',
|
||||
'http://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz',
|
||||
'c4d91be36fc8e54deae7575241e03f4211eb102afb3fc0775fbbc1b740016705',
|
||||
'lib/libogg.a',
|
||||
[
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
@ -29,8 +29,8 @@ libogg = CmakeProject(
|
||||
)
|
||||
|
||||
opus = AutotoolsProject(
|
||||
'https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz',
|
||||
'65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d',
|
||||
'https://downloads.xiph.org/releases/opus/opus-1.4.tar.gz',
|
||||
'c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f',
|
||||
'lib/libopus.a',
|
||||
[
|
||||
'--disable-shared', '--enable-static',
|
||||
@ -43,20 +43,23 @@ opus = AutotoolsProject(
|
||||
)
|
||||
|
||||
flac = AutotoolsProject(
|
||||
'http://downloads.xiph.org/releases/flac/flac-1.3.3.tar.xz',
|
||||
'213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748',
|
||||
'http://downloads.xiph.org/releases/flac/flac-1.4.3.tar.xz',
|
||||
'6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70',
|
||||
'lib/libFLAC.a',
|
||||
[
|
||||
'--disable-shared', '--enable-static',
|
||||
'--disable-stack-smash-protection',
|
||||
'--disable-xmms-plugin', '--disable-cpplibs',
|
||||
'--disable-doxygen-docs',
|
||||
'--disable-programs',
|
||||
],
|
||||
subdirs=['include', 'src/libFLAC'],
|
||||
)
|
||||
|
||||
zlib = ZlibProject(
|
||||
'http://zlib.net/zlib-1.2.11.tar.xz',
|
||||
'4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066',
|
||||
('http://zlib.net/zlib-1.3.tar.xz',
|
||||
'https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.xz'),
|
||||
'8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7',
|
||||
'lib/libz.a',
|
||||
)
|
||||
|
||||
@ -109,29 +112,35 @@ libmodplug = AutotoolsProject(
|
||||
[
|
||||
'--disable-shared', '--enable-static',
|
||||
],
|
||||
patches='src/lib/modplug/patches',
|
||||
)
|
||||
|
||||
libopenmpt = AutotoolsProject(
|
||||
'https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-0.5.8+release.autotools.tar.gz',
|
||||
'61de7cc0c011b10472ca16adcc123689',
|
||||
'https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-0.6.6+release.autotools.tar.gz',
|
||||
'6ddb9e26a430620944891796fefb1bbb38bd9148f6cfc558810c0d3f269876c7',
|
||||
'lib/libopenmpt.a',
|
||||
[
|
||||
'--disable-shared', '--enable-static'
|
||||
'--disable-shared', '--enable-static',
|
||||
'--disable-openmpt123',
|
||||
'--disable-examples',
|
||||
'--disable-tests',
|
||||
'--disable-doxygen-doc',
|
||||
'--without-mpg123', '--without-ogg', '--without-vorbis', '--without-vorbisfile',
|
||||
'--without-portaudio', '--without-portaudiocpp', '--without-sndfile',
|
||||
'--without-flac',
|
||||
],
|
||||
base='libopenmpt-0.6.6+release.autotools',
|
||||
)
|
||||
|
||||
wildmidi = CmakeProject(
|
||||
'https://codeload.github.com/Mindwerks/wildmidi/tar.gz/wildmidi-0.4.4',
|
||||
'6f267c8d331e9859906837e2c197093fddec31829d2ebf7b958cf6b7ae935430',
|
||||
'https://github.com/Mindwerks/wildmidi/releases/download/wildmidi-0.4.5/wildmidi-0.4.5.tar.gz',
|
||||
'd5e7bef00a7aa47534a53d43b1265f8d3d27f6a28e7f563c1cdf02ff4fa35b99',
|
||||
'lib/libWildMidi.a',
|
||||
[
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DWANT_PLAYER=OFF',
|
||||
'-DWANT_STATIC=ON',
|
||||
],
|
||||
base='wildmidi-wildmidi-0.4.4',
|
||||
name='wildmidi',
|
||||
version='0.4.4',
|
||||
)
|
||||
|
||||
gme = CmakeProject(
|
||||
@ -142,13 +151,13 @@ gme = CmakeProject(
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DENABLE_UBSAN=OFF',
|
||||
'-DZLIB_INCLUDE_DIR=OFF',
|
||||
'-DSDL2_DIR=OFF',
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SDL2=ON',
|
||||
],
|
||||
)
|
||||
|
||||
ffmpeg = FfmpegProject(
|
||||
'http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz',
|
||||
'06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909',
|
||||
'http://ffmpeg.org/releases/ffmpeg-6.0.tar.xz',
|
||||
'57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082',
|
||||
'lib/libavcodec.a',
|
||||
[
|
||||
'--disable-shared', '--enable-static',
|
||||
@ -162,17 +171,21 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-swscale',
|
||||
'--disable-postproc',
|
||||
'--disable-avfilter',
|
||||
'--disable-lzo',
|
||||
'--disable-faan',
|
||||
'--disable-pixelutils',
|
||||
'--disable-network',
|
||||
'--disable-encoders',
|
||||
'--disable-hwaccels',
|
||||
'--disable-muxers',
|
||||
'--disable-protocols',
|
||||
'--disable-devices',
|
||||
'--disable-filters',
|
||||
'--disable-v4l2_m2m',
|
||||
|
||||
'--disable-sdl2',
|
||||
'--disable-vulkan',
|
||||
'--disable-xlib',
|
||||
|
||||
'--disable-parser=bmp',
|
||||
'--disable-parser=cavsvideo',
|
||||
'--disable-parser=dvbsub',
|
||||
@ -185,17 +198,22 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-parser=h263',
|
||||
'--disable-parser=h264',
|
||||
'--disable-parser=hevc',
|
||||
'--disable-parser=jpeg2000',
|
||||
'--disable-parser=mjpeg',
|
||||
'--disable-parser=mlp',
|
||||
'--disable-parser=mpeg4video',
|
||||
'--disable-parser=mpegvideo',
|
||||
'--disable-parser=opus',
|
||||
'--disable-parser=qoi',
|
||||
'--disable-parser=rv30',
|
||||
'--disable-parser=rv40',
|
||||
'--disable-parser=vc1',
|
||||
'--disable-parser=vp3',
|
||||
'--disable-parser=vp8',
|
||||
'--disable-parser=vp9',
|
||||
'--disable-parser=png',
|
||||
'--disable-parser=pnm',
|
||||
'--disable-parser=webp',
|
||||
'--disable-parser=xma',
|
||||
|
||||
'--disable-demuxer=aqtitle',
|
||||
@ -211,6 +229,42 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-demuxer=h264',
|
||||
'--disable-demuxer=ico',
|
||||
'--disable-demuxer=image2',
|
||||
'--disable-demuxer=image2pipe',
|
||||
'--disable-demuxer=image_bmp_pipe',
|
||||
'--disable-demuxer=image_cri_pipe',
|
||||
'--disable-demuxer=image_dds_pipe',
|
||||
'--disable-demuxer=image_dpx_pipe',
|
||||
'--disable-demuxer=image_exr_pipe',
|
||||
'--disable-demuxer=image_gem_pipe',
|
||||
'--disable-demuxer=image_gif_pipe',
|
||||
'--disable-demuxer=image_j2k_pipe',
|
||||
'--disable-demuxer=image_jpeg_pipe',
|
||||
'--disable-demuxer=image_jpegls_pipe',
|
||||
'--disable-demuxer=image_jpegxl_pipe',
|
||||
'--disable-demuxer=image_pam_pipe',
|
||||
'--disable-demuxer=image_pbm_pipe',
|
||||
'--disable-demuxer=image_pcx_pipe',
|
||||
'--disable-demuxer=image_pfm_pipe',
|
||||
'--disable-demuxer=image_pgm_pipe',
|
||||
'--disable-demuxer=image_pgmyuv_pipe',
|
||||
'--disable-demuxer=image_pgx_pipe',
|
||||
'--disable-demuxer=image_phm_pipe',
|
||||
'--disable-demuxer=image_photocd_pipe',
|
||||
'--disable-demuxer=image_pictor_pipe',
|
||||
'--disable-demuxer=image_png_pipe',
|
||||
'--disable-demuxer=image_ppm_pipe',
|
||||
'--disable-demuxer=image_psd_pipe',
|
||||
'--disable-demuxer=image_qdraw_pipe',
|
||||
'--disable-demuxer=image_qoi_pipe',
|
||||
'--disable-demuxer=image_sgi_pipe',
|
||||
'--disable-demuxer=image_sunrast_pipe',
|
||||
'--disable-demuxer=image_svg_pipe',
|
||||
'--disable-demuxer=image_tiff_pipe',
|
||||
'--disable-demuxer=image_vbn_pipe',
|
||||
'--disable-demuxer=image_webp_pipe',
|
||||
'--disable-demuxer=image_xbm_pipe',
|
||||
'--disable-demuxer=image_xpm_pipe',
|
||||
'--disable-demuxer=image_xwd_pipe',
|
||||
'--disable-demuxer=jacosub',
|
||||
'--disable-demuxer=lrc',
|
||||
'--disable-demuxer=microdvd',
|
||||
@ -233,6 +287,7 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-demuxer=tedcaptions',
|
||||
'--disable-demuxer=vobsub',
|
||||
'--disable-demuxer=vplayer',
|
||||
'--disable-demuxer=webm_dash_manifest',
|
||||
'--disable-demuxer=webvtt',
|
||||
'--disable-demuxer=yuv4mpegpipe',
|
||||
|
||||
@ -262,78 +317,179 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-decoder=qdmc',
|
||||
|
||||
# disable lots of image and video codecs
|
||||
'--disable-decoder=acelp_kelvin',
|
||||
'--disable-decoder=agm',
|
||||
'--disable-decoder=aic',
|
||||
'--disable-decoder=alias_pix',
|
||||
'--disable-decoder=ansi',
|
||||
'--disable-decoder=apng',
|
||||
'--disable-decoder=arbc',
|
||||
'--disable-decoder=argo',
|
||||
'--disable-decoder=ass',
|
||||
'--disable-decoder=asv1',
|
||||
'--disable-decoder=asv2',
|
||||
'--disable-decoder=apng',
|
||||
'--disable-decoder=aura',
|
||||
'--disable-decoder=aura2',
|
||||
'--disable-decoder=avrn',
|
||||
'--disable-decoder=avrp',
|
||||
'--disable-decoder=avui',
|
||||
'--disable-decoder=ayuv',
|
||||
'--disable-decoder=bethsoftvid',
|
||||
'--disable-decoder=bfi',
|
||||
'--disable-decoder=bink',
|
||||
'--disable-decoder=bintext',
|
||||
'--disable-decoder=bitpacked',
|
||||
'--disable-decoder=bmp',
|
||||
'--disable-decoder=bmv_video',
|
||||
'--disable-decoder=brender_pix',
|
||||
'--disable-decoder=c93',
|
||||
'--disable-decoder=cavs',
|
||||
'--disable-decoder=ccaption',
|
||||
'--disable-decoder=cdgraphics',
|
||||
'--disable-decoder=cdtoons',
|
||||
'--disable-decoder=cdxl',
|
||||
'--disable-decoder=cfhd',
|
||||
'--disable-decoder=cinepak',
|
||||
'--disable-decoder=clearvideo',
|
||||
'--disable-decoder=cljr',
|
||||
'--disable-decoder=cllc',
|
||||
'--disable-decoder=cpia',
|
||||
'--disable-decoder=cscd',
|
||||
'--disable-decoder=cyuv',
|
||||
'--disable-decoder=dds',
|
||||
'--disable-decoder=dirac',
|
||||
'--disable-decoder=dnxhd',
|
||||
'--disable-decoder=dpx',
|
||||
'--disable-decoder=dsicinvideo',
|
||||
'--disable-decoder=dvbsub',
|
||||
'--disable-decoder=dvdsub',
|
||||
'--disable-decoder=dvvideo',
|
||||
'--disable-decoder=dxa',
|
||||
'--disable-decoder=dxtory',
|
||||
'--disable-decoder=dxv',
|
||||
'--disable-decoder=eacmv',
|
||||
'--disable-decoder=eamad',
|
||||
'--disable-decoder=eatgq',
|
||||
'--disable-decoder=eatgv',
|
||||
'--disable-decoder=eatqi',
|
||||
'--disable-decoder=eightbps',
|
||||
'--disable-decoder=escape124',
|
||||
'--disable-decoder=escape130',
|
||||
'--disable-decoder=exr',
|
||||
'--disable-decoder=ffv1',
|
||||
'--disable-decoder=ffvhuff',
|
||||
'--disable-decoder=ffwavesynth',
|
||||
'--disable-decoder=fic',
|
||||
'--disable-decoder=fits',
|
||||
'--disable-decoder=flashsv',
|
||||
'--disable-decoder=flashsv2',
|
||||
'--disable-decoder=flic',
|
||||
'--disable-decoder=flv',
|
||||
'--disable-decoder=fmvc',
|
||||
'--disable-decoder=fraps',
|
||||
'--disable-decoder=fourxm',
|
||||
'--disable-decoder=frwu',
|
||||
'--disable-decoder=g2m',
|
||||
'--disable-decoder=gdv',
|
||||
'--disable-decoder=gem',
|
||||
'--disable-decoder=gif',
|
||||
'--disable-decoder=h261',
|
||||
'--disable-decoder=h263',
|
||||
'--disable-decoder=h263i',
|
||||
'--disable-decoder=h263p',
|
||||
'--disable-decoder=h264',
|
||||
'--disable-decoder=hap',
|
||||
'--disable-decoder=hevc',
|
||||
'--disable-decoder=hnm4_video',
|
||||
'--disable-decoder=hq_hqa',
|
||||
'--disable-decoder=hqx',
|
||||
'--disable-decoder=huffyuv',
|
||||
'--disable-decoder=hymt',
|
||||
'--disable-decoder=idcin',
|
||||
'--disable-decoder=idf',
|
||||
'--disable-decoder=iff_ilbm',
|
||||
'--disable-decoder=imm4',
|
||||
'--disable-decoder=indeo2',
|
||||
'--disable-decoder=indeo3',
|
||||
'--disable-decoder=indeo4',
|
||||
'--disable-decoder=indeo5',
|
||||
'--disable-decoder=interplay_video',
|
||||
'--disable-decoder=ipu',
|
||||
'--disable-decoder=jacosub',
|
||||
'--disable-decoder=jpeg2000',
|
||||
'--disable-decoder=jpegls',
|
||||
'--disable-decoder=jv',
|
||||
'--disable-decoder=kgv1',
|
||||
'--disable-decoder=kmvc',
|
||||
'--disable-decoder=lagarith',
|
||||
'--disable-decoder=loco',
|
||||
'--disable-decoder=lscr',
|
||||
'--disable-decoder=m101',
|
||||
'--disable-decoder=magicyuv',
|
||||
'--disable-decoder=mdec',
|
||||
'--disable-decoder=microdvd',
|
||||
'--disable-decoder=mimic',
|
||||
'--disable-decoder=mjpeg',
|
||||
'--disable-decoder=mmvideo',
|
||||
'--disable-decoder=mpl2',
|
||||
'--disable-decoder=mobiclip',
|
||||
'--disable-decoder=motionpixels',
|
||||
'--disable-decoder=movtext',
|
||||
'--disable-decoder=mpeg1video',
|
||||
'--disable-decoder=mpeg2video',
|
||||
'--disable-decoder=mpeg4',
|
||||
'--disable-decoder=mpegvideo',
|
||||
'--disable-decoder=msa1',
|
||||
'--disable-decoder=mscc',
|
||||
'--disable-decoder=msmpeg4_crystalhd',
|
||||
'--disable-decoder=msmpeg4v1',
|
||||
'--disable-decoder=msmpeg4v2',
|
||||
'--disable-decoder=msmpeg4v3',
|
||||
'--disable-decoder=msp2',
|
||||
'--disable-decoder=msrle',
|
||||
'--disable-decoder=mss1',
|
||||
'--disable-decoder=msvideo1',
|
||||
'--disable-decoder=mszh',
|
||||
'--disable-decoder=mts2',
|
||||
'--disable-decoder=mv30',
|
||||
'--disable-decoder=mvc1',
|
||||
'--disable-decoder=mvc2',
|
||||
'--disable-decoder=mvdv',
|
||||
'--disable-decoder=mvha',
|
||||
'--disable-decoder=mwsc',
|
||||
'--disable-decoder=notchlc',
|
||||
'--disable-decoder=nuv',
|
||||
'--disable-decoder=on2avc',
|
||||
'--disable-decoder=paf_video',
|
||||
'--disable-decoder=pam',
|
||||
'--disable-decoder=pbm',
|
||||
'--disable-decoder=pcx',
|
||||
'--disable-decoder=pgm',
|
||||
'--disable-decoder=pgmyuv',
|
||||
'--disable-decoder=pgssub',
|
||||
'--disable-decoder=pgx',
|
||||
'--disable-decoder=phm',
|
||||
'--disable-decoder=photocd',
|
||||
'--disable-decoder=png',
|
||||
'--disable-decoder=pictor',
|
||||
'--disable-decoder=pixlet',
|
||||
'--disable-decoder=pjs',
|
||||
'--disable-decoder=ppm',
|
||||
'--disable-decoder=prores',
|
||||
'--disable-decoder=prosumer',
|
||||
'--disable-decoder=psd',
|
||||
'--disable-decoder=ptx',
|
||||
'--disable-decoder=qdraw',
|
||||
'--disable-decoder=qoi',
|
||||
'--disable-decoder=qpeg',
|
||||
'--disable-decoder=qtrle',
|
||||
'--disable-decoder=rawvideo',
|
||||
'--disable-decoder=r10k',
|
||||
'--disable-decoder=r210',
|
||||
'--disable-decoder=rasc',
|
||||
'--disable-decoder=realtext',
|
||||
'--disable-decoder=rl2',
|
||||
'--disable-decoder=rpza',
|
||||
'--disable-decoder=roq',
|
||||
'--disable-decoder=roq_dpcm',
|
||||
'--disable-decoder=rscc',
|
||||
@ -342,53 +498,122 @@ ffmpeg = FfmpegProject(
|
||||
'--disable-decoder=rv30',
|
||||
'--disable-decoder=rv40',
|
||||
'--disable-decoder=sami',
|
||||
'--disable-decoder=sanm',
|
||||
'--disable-decoder=scpr',
|
||||
'--disable-decoder=screenpresso',
|
||||
'--disable-decoder=sga',
|
||||
'--disable-decoder=sgi',
|
||||
'--disable-decoder=sgirle',
|
||||
'--disable-decoder=sheervideo',
|
||||
'--disable-decoder=simbiosis_imx',
|
||||
'--disable-decoder=smc',
|
||||
'--disable-decoder=snow',
|
||||
'--disable-decoder=speedhq',
|
||||
'--disable-decoder=srgc',
|
||||
'--disable-decoder=srt',
|
||||
'--disable-decoder=ssa',
|
||||
'--disable-decoder=stl',
|
||||
'--disable-decoder=subrip',
|
||||
'--disable-decoder=subviewer',
|
||||
'--disable-decoder=subviewer1',
|
||||
'--disable-decoder=sunrast',
|
||||
'--disable-decoder=svq1',
|
||||
'--disable-decoder=svq3',
|
||||
'--disable-decoder=targa',
|
||||
'--disable-decoder=targa_y216',
|
||||
'--disable-decoder=text',
|
||||
'--disable-decoder=tiff',
|
||||
'--disable-decoder=tiertexseqvideo',
|
||||
'--disable-decoder=tmv',
|
||||
'--disable-decoder=truemotion1',
|
||||
'--disable-decoder=truemotion2',
|
||||
'--disable-decoder=truemotion2rt',
|
||||
'--disable-decoder=tscc',
|
||||
'--disable-decoder=tscc2',
|
||||
'--disable-decoder=twinvq',
|
||||
'--disable-decoder=txd',
|
||||
'--disable-decoder=ulti',
|
||||
'--disable-decoder=utvideo',
|
||||
'--disable-decoder=v210',
|
||||
'--disable-decoder=v210x',
|
||||
'--disable-decoder=v308',
|
||||
'--disable-decoder=v408',
|
||||
'--disable-decoder=v410',
|
||||
'--disable-decoder=vb',
|
||||
'--disable-decoder=vble',
|
||||
'--disable-decoder=vbn',
|
||||
'--disable-decoder=vc1',
|
||||
'--disable-decoder=vcr1',
|
||||
'--disable-decoder=vmdvideo',
|
||||
'--disable-decoder=vmnc',
|
||||
'--disable-decoder=vp3',
|
||||
'--disable-decoder=vp5',
|
||||
'--disable-decoder=vp6',
|
||||
'--disable-decoder=vp7',
|
||||
'--disable-decoder=vp8',
|
||||
'--disable-decoder=vp9',
|
||||
'--disable-decoder=vplayer',
|
||||
'--disable-decoder=vqa',
|
||||
'--disable-decoder=webvtt',
|
||||
'--disable-decoder=wcmv',
|
||||
'--disable-decoder=wmv1',
|
||||
'--disable-decoder=wmv2',
|
||||
'--disable-decoder=wmv3',
|
||||
'--disable-decoder=wnv1',
|
||||
'--disable-decoder=wrapped_avframe',
|
||||
'--disable-decoder=xan_wc3',
|
||||
'--disable-decoder=xan_wc4',
|
||||
'--disable-decoder=xbin',
|
||||
'--disable-decoder=xbm',
|
||||
'--disable-decoder=xface',
|
||||
'--disable-decoder=xl',
|
||||
'--disable-decoder=xpm',
|
||||
'--disable-decoder=xsub',
|
||||
'--disable-decoder=xwd',
|
||||
'--disable-decoder=y41p',
|
||||
'--disable-decoder=ylc',
|
||||
'--disable-decoder=yop',
|
||||
'--disable-decoder=yuv4',
|
||||
'--disable-decoder=zero12v',
|
||||
'--disable-decoder=zerocodec',
|
||||
'--disable-decoder=zlib',
|
||||
'--disable-decoder=zmbv',
|
||||
|
||||
'--disable-bsf=av1_frame_merge',
|
||||
'--disable-bsf=av1_frame_split',
|
||||
'--disable-bsf=av1_metadata',
|
||||
'--disable-bsf=dts2pts',
|
||||
'--disable-bsf=h264_metadata',
|
||||
'--disable-bsf=h264_mp4toannexb',
|
||||
'--disable-bsf=h264_redundant_pps',
|
||||
'--disable-bsf=hevc_metadata',
|
||||
'--disable-bsf=hevc_mp4toannexb',
|
||||
'--disable-bsf=mjpeg2jpeg',
|
||||
'--disable-bsf=opus_metadata',
|
||||
'--disable-bsf=pgs_frame_merge',
|
||||
'--disable-bsf=text2movsub',
|
||||
'--disable-bsf=vp9_metadata',
|
||||
'--disable-bsf=vp9_raw_reorder',
|
||||
'--disable-bsf=vp9_superframe',
|
||||
'--disable-bsf=vp9_superframe_split',
|
||||
],
|
||||
)
|
||||
|
||||
openssl = OpenSSLProject(
|
||||
'https://www.openssl.org/source/openssl-3.0.0.tar.gz',
|
||||
'59eedfcb46c25214c9bd37ed6078297b4df01d012267fe9e9eee31f61bc70536',
|
||||
('https://www.openssl.org/source/openssl-3.1.3.tar.gz',
|
||||
'https://artfiles.org/openssl.org/source/openssl-3.1.3.tar.gz'),
|
||||
'f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6',
|
||||
'include/openssl/ossl_typ.h',
|
||||
)
|
||||
|
||||
curl = CmakeProject(
|
||||
'https://curl.se/download/curl-7.79.1.tar.xz',
|
||||
'0606f74b1182ab732a17c11613cbbaf7084f2e6cca432642d0e3ad7c224c3689',
|
||||
('https://curl.se/download/curl-8.2.1.tar.xz',
|
||||
'https://github.com/curl/curl/releases/download/curl-8_2_1/curl-8.2.1.tar.xz'),
|
||||
'dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894',
|
||||
'lib/libcurl.a',
|
||||
[
|
||||
'-DBUILD_CURL_EXE=OFF',
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DCURL_DISABLE_VERBOSE_STRINGS=ON',
|
||||
'-DCURL_DISABLE_LDAP=ON',
|
||||
'-DCURL_DISABLE_TELNET=ON',
|
||||
'-DCURL_DISABLE_DICT=ON',
|
||||
@ -411,14 +636,14 @@ curl = CmakeProject(
|
||||
'-DBUILD_TESTING=OFF',
|
||||
],
|
||||
windows_configure_args=[
|
||||
'-DCMAKE_USE_SCHANNEL=ON',
|
||||
'-DCURL_USE_SCHANNEL=ON',
|
||||
],
|
||||
patches='src/lib/curl/patches',
|
||||
)
|
||||
|
||||
libnfs = AutotoolsProject(
|
||||
'https://github.com/sahlberg/libnfs/archive/libnfs-4.0.0.tar.gz',
|
||||
'6ee77e9fe220e2d3e3b1f53cfea04fb319828cc7dbb97dd9df09e46e901d797d',
|
||||
'https://github.com/sahlberg/libnfs/archive/libnfs-5.0.2.tar.gz',
|
||||
'637e56643b19da9fba98f06847788c4dad308b723156a64748041035dcdf9bd3',
|
||||
'lib/libnfs.a',
|
||||
[
|
||||
'--disable-shared', '--enable-static',
|
||||
@ -429,8 +654,7 @@ libnfs = AutotoolsProject(
|
||||
|
||||
'--disable-utils', '--disable-examples',
|
||||
],
|
||||
base='libnfs-libnfs-4.0.0',
|
||||
patches='src/lib/nfs/patches',
|
||||
base='libnfs-libnfs-5.0.2',
|
||||
autoreconf=True,
|
||||
)
|
||||
|
||||
@ -441,7 +665,7 @@ jack = JackProject(
|
||||
)
|
||||
|
||||
boost = BoostProject(
|
||||
'https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2',
|
||||
'fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854',
|
||||
'https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2',
|
||||
'71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa',
|
||||
'include/boost/version.hpp',
|
||||
)
|
||||
|
@ -1,28 +1,35 @@
|
||||
import subprocess
|
||||
import subprocess, multiprocessing
|
||||
from typing import Optional, Sequence, Union
|
||||
|
||||
from build.project import Project
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class MakeProject(Project):
|
||||
def __init__(self, url, md5, installed,
|
||||
install_target='install',
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
install_target: str='install',
|
||||
**kwargs):
|
||||
Project.__init__(self, url, md5, installed, **kwargs)
|
||||
self.install_target = install_target
|
||||
|
||||
def get_simultaneous_jobs(self):
|
||||
return 12
|
||||
def get_simultaneous_jobs(self) -> int:
|
||||
try:
|
||||
# use twice as many simultaneous jobs as we have CPU cores
|
||||
return multiprocessing.cpu_count() * 2
|
||||
except NotImplementedError:
|
||||
# default to 12, if multiprocessing.cpu_count() is not implemented
|
||||
return 12
|
||||
|
||||
def get_make_args(self, toolchain):
|
||||
def get_make_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]
|
||||
|
||||
def get_make_install_args(self, toolchain):
|
||||
def get_make_install_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
return ['--quiet', self.install_target]
|
||||
|
||||
def make(self, toolchain, wd, args):
|
||||
subprocess.check_call(['/usr/bin/make'] + args,
|
||||
def make(self, toolchain: AnyToolchain, wd: str, args: list[str]) -> None:
|
||||
subprocess.check_call(['make'] + args,
|
||||
cwd=wd, env=toolchain.env)
|
||||
|
||||
def build_make(self, toolchain, wd, install=True):
|
||||
def build_make(self, toolchain: AnyToolchain, wd: str, install: bool=True) -> None:
|
||||
self.make(toolchain, wd, self.get_make_args(toolchain))
|
||||
if install:
|
||||
self.make(toolchain, wd, self.get_make_install_args(toolchain))
|
||||
|
@ -1,9 +1,17 @@
|
||||
import os.path, subprocess, sys
|
||||
import os
|
||||
import subprocess
|
||||
import platform
|
||||
from typing import Optional, Sequence, Union
|
||||
|
||||
from build.project import Project
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
def make_cross_file(toolchain):
|
||||
def __no_ccache(cmd: str) -> str:
|
||||
if cmd.startswith('ccache '):
|
||||
cmd = cmd[7:]
|
||||
return cmd
|
||||
|
||||
def make_cross_file(toolchain: AnyToolchain) -> str:
|
||||
if toolchain.is_windows:
|
||||
system = 'windows'
|
||||
windres = "windres = '%s'" % toolchain.windres
|
||||
@ -22,7 +30,7 @@ def make_cross_file(toolchain):
|
||||
cpu = 'arm64-v8a'
|
||||
else:
|
||||
cpu_family = 'x86'
|
||||
if 'x86_64' in toolchain.arch:
|
||||
if 'x86_64' in toolchain.host_triplet:
|
||||
cpu = 'x86_64'
|
||||
else:
|
||||
cpu = 'i686'
|
||||
@ -37,8 +45,8 @@ def make_cross_file(toolchain):
|
||||
with open(path, 'w') as f:
|
||||
f.write(f"""
|
||||
[binaries]
|
||||
c = '{toolchain.cc}'
|
||||
cpp = '{toolchain.cxx}'
|
||||
c = '{__no_ccache(toolchain.cc)}'
|
||||
cpp = '{__no_ccache(toolchain.cxx)}'
|
||||
ar = '{toolchain.ar}'
|
||||
strip = '{toolchain.strip}'
|
||||
pkgconfig = '{toolchain.pkg_config}'
|
||||
@ -53,19 +61,21 @@ pkgconfig = '{toolchain.pkg_config}'
|
||||
f.write(f"""
|
||||
[properties]
|
||||
root = '{toolchain.install_prefix}'
|
||||
""")
|
||||
|
||||
if toolchain.is_android:
|
||||
f.write("""
|
||||
# Keep Meson from executing Android-x86 test binariees
|
||||
needs_exe_wrapper = true
|
||||
""")
|
||||
|
||||
f.write(f"""
|
||||
[built-in options]
|
||||
c_args = {repr((toolchain.cppflags + ' ' + toolchain.cflags).split())}
|
||||
c_link_args = {repr(toolchain.ldflags.split() + toolchain.libs.split())}
|
||||
|
||||
cpp_args = {repr((toolchain.cppflags + ' ' + toolchain.cxxflags).split())}
|
||||
cpp_link_args = {repr(toolchain.ldflags.split() + toolchain.libs.split())}
|
||||
""")
|
||||
|
||||
if 'android' in toolchain.arch:
|
||||
f.write("""
|
||||
# Keep Meson from executing Android-x86 test binariees
|
||||
needs_exe_wrapper = true
|
||||
""")
|
||||
|
||||
f.write(f"""
|
||||
@ -77,21 +87,23 @@ endian = '{endian}'
|
||||
""")
|
||||
return path
|
||||
|
||||
def configure(toolchain, src, build, args=()):
|
||||
cross_file = make_cross_file(toolchain)
|
||||
def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[]) -> None:
|
||||
configure = [
|
||||
'meson',
|
||||
src, build,
|
||||
'meson', 'setup',
|
||||
build, src,
|
||||
|
||||
'--prefix', toolchain.install_prefix,
|
||||
|
||||
'--buildtype', 'plain',
|
||||
|
||||
'--default-library=static',
|
||||
|
||||
'--cross-file', cross_file,
|
||||
] + args
|
||||
|
||||
if toolchain.host_triplet is not None:
|
||||
# cross-compiling: write a cross-file
|
||||
cross_file = make_cross_file(toolchain)
|
||||
configure.append(f'--cross-file={cross_file}')
|
||||
|
||||
env = toolchain.env.copy()
|
||||
|
||||
# Meson 0.54 requires the BOOST_ROOT environment variable
|
||||
@ -100,18 +112,19 @@ def configure(toolchain, src, build, args=()):
|
||||
subprocess.check_call(configure, env=env)
|
||||
|
||||
class MesonProject(Project):
|
||||
def __init__(self, url, md5, installed, configure_args=[],
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
configure_args: list[str]=[],
|
||||
**kwargs):
|
||||
Project.__init__(self, url, md5, installed, **kwargs)
|
||||
self.configure_args = configure_args
|
||||
|
||||
def configure(self, toolchain):
|
||||
def configure(self, toolchain: AnyToolchain) -> str:
|
||||
src = self.unpack(toolchain)
|
||||
build = self.make_build_path(toolchain)
|
||||
configure(toolchain, src, build, self.configure_args)
|
||||
return build
|
||||
|
||||
def _build(self, toolchain):
|
||||
def _build(self, toolchain: AnyToolchain) -> None:
|
||||
build = self.configure(toolchain)
|
||||
subprocess.check_call(['ninja', 'install'],
|
||||
subprocess.check_call(['ninja', '-v', 'install'],
|
||||
cwd=build, env=toolchain.env)
|
||||
|
@ -1,13 +1,15 @@
|
||||
import subprocess
|
||||
from typing import Optional, Sequence, Union
|
||||
|
||||
from build.makeproject import MakeProject
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class OpenSSLProject(MakeProject):
|
||||
def __init__(self, url, md5, installed,
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
**kwargs):
|
||||
MakeProject.__init__(self, url, md5, installed, install_target='install_dev', **kwargs)
|
||||
|
||||
def get_make_args(self, toolchain):
|
||||
def get_make_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
return MakeProject.get_make_args(self, toolchain) + [
|
||||
'CC=' + toolchain.cc,
|
||||
'CFLAGS=' + toolchain.cflags,
|
||||
@ -17,45 +19,60 @@ class OpenSSLProject(MakeProject):
|
||||
'build_libs',
|
||||
]
|
||||
|
||||
def get_make_install_args(self, toolchain):
|
||||
def get_make_install_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
# OpenSSL's Makefile runs "ranlib" during installation
|
||||
return MakeProject.get_make_install_args(self, toolchain) + [
|
||||
'RANLIB=' + toolchain.ranlib,
|
||||
]
|
||||
|
||||
def _build(self, toolchain):
|
||||
def _build(self, toolchain: AnyToolchain) -> None:
|
||||
src = self.unpack(toolchain, out_of_tree=False)
|
||||
|
||||
# OpenSSL has a weird target architecture scheme with lots of
|
||||
# hard-coded architectures; this table translates between our
|
||||
# "toolchain_arch" (HOST_TRIPLET) and the OpenSSL target
|
||||
# host triplet and the OpenSSL target
|
||||
openssl_archs = {
|
||||
# not using "android-*" because those OpenSSL targets want
|
||||
# to know where the SDK is, but our own build scripts
|
||||
# prepared everything already to look like a regular Linux
|
||||
# build
|
||||
'arm-linux-androideabi': 'linux-generic32',
|
||||
'armv7a-linux-androideabi': 'linux-generic32',
|
||||
'aarch64-linux-android': 'linux-aarch64',
|
||||
'i686-linux-android': 'linux-x86-clang',
|
||||
'x86_64-linux-android': 'linux-x86_64-clang',
|
||||
|
||||
# Kobo
|
||||
# generic Linux
|
||||
'arm-linux-gnueabihf': 'linux-generic32',
|
||||
|
||||
# Windows
|
||||
'i686-w64-mingw32': 'mingw',
|
||||
'x86_64-w64-mingw32': 'mingw64',
|
||||
|
||||
# Apple
|
||||
'x86_64-apple-darwin': 'darwin64-x86_64-cc',
|
||||
'aarch64-apple-darwin': 'darwin64-arm64-cc',
|
||||
}
|
||||
|
||||
openssl_arch = openssl_archs[toolchain.arch]
|
||||
configure = [
|
||||
'./Configure',
|
||||
'no-shared',
|
||||
'no-module',
|
||||
'no-engine',
|
||||
'no-static-engine',
|
||||
'no-async',
|
||||
'no-tests',
|
||||
'no-makedepend',
|
||||
'--libdir=lib', # no "lib64" on amd64, please
|
||||
'--prefix=' + toolchain.install_prefix,
|
||||
]
|
||||
|
||||
subprocess.check_call(['./Configure',
|
||||
'no-shared',
|
||||
'no-module', 'no-engine', 'no-static-engine',
|
||||
'no-async',
|
||||
'no-tests',
|
||||
'no-asm', # "asm" causes build failures on Windows
|
||||
openssl_arch,
|
||||
'--prefix=' + toolchain.install_prefix],
|
||||
cwd=src, env=toolchain.env)
|
||||
if toolchain.is_windows:
|
||||
# workaround for build failures
|
||||
configure.append('no-asm')
|
||||
|
||||
if toolchain.host_triplet is not None:
|
||||
configure.append(openssl_archs[toolchain.host_triplet])
|
||||
configure.append(f'--cross-compile-prefix={toolchain.host_triplet}-')
|
||||
|
||||
subprocess.check_call(configure, cwd=src, env=toolchain.env)
|
||||
self.build_make(toolchain, src)
|
||||
|
@ -1,26 +1,30 @@
|
||||
import os, shutil
|
||||
import re
|
||||
from typing import cast, BinaryIO, Optional, Sequence, Union
|
||||
|
||||
from build.download import download_and_verify
|
||||
from build.download import download_basename, download_and_verify
|
||||
from build.tar import untar
|
||||
from build.quilt import push_all
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class Project:
|
||||
def __init__(self, url, md5, installed, name=None, version=None,
|
||||
base=None,
|
||||
patches=None,
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
name: Optional[str]=None, version: Optional[str]=None,
|
||||
base: Optional[str]=None,
|
||||
patches: Optional[str]=None,
|
||||
edits=None,
|
||||
use_cxx=False):
|
||||
use_cxx: bool=False):
|
||||
if base is None:
|
||||
basename = os.path.basename(url)
|
||||
basename = download_basename(url)
|
||||
m = re.match(r'^(.+)\.(tar(\.(gz|bz2|xz|lzma))?|zip)$', basename)
|
||||
if not m: raise
|
||||
if not m: raise RuntimeError('Could not identify tarball name: ' + basename)
|
||||
self.base = m.group(1)
|
||||
else:
|
||||
self.base = base
|
||||
|
||||
if name is None or version is None:
|
||||
m = re.match(r'^([-\w]+)-(\d[\d.]*[a-z]?[\d.]*(?:-(?:alpha|beta)\d+)?)(\+.*)?$', self.base)
|
||||
if not m: raise RuntimeError('Could not identify tarball name: ' + self.base)
|
||||
if name is None: name = m.group(1)
|
||||
if version is None: version = m.group(2)
|
||||
|
||||
@ -38,10 +42,10 @@ class Project:
|
||||
self.edits = edits
|
||||
self.use_cxx = use_cxx
|
||||
|
||||
def download(self, toolchain):
|
||||
def download(self, toolchain: AnyToolchain) -> str:
|
||||
return download_and_verify(self.url, self.md5, toolchain.tarball_path)
|
||||
|
||||
def is_installed(self, toolchain):
|
||||
def is_installed(self, toolchain: AnyToolchain) -> bool:
|
||||
tarball = self.download(toolchain)
|
||||
installed = os.path.join(toolchain.install_prefix, self.installed)
|
||||
tarball_mtime = os.path.getmtime(tarball)
|
||||
@ -50,13 +54,13 @@ class Project:
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
def unpack(self, toolchain, out_of_tree=True):
|
||||
def unpack(self, toolchain: AnyToolchain, out_of_tree: bool=True) -> str:
|
||||
if out_of_tree:
|
||||
parent_path = toolchain.src_path
|
||||
else:
|
||||
parent_path = toolchain.build_path
|
||||
path = untar(self.download(toolchain), parent_path, self.base)
|
||||
|
||||
path = untar(self.download(toolchain), parent_path, self.base,
|
||||
lazy=out_of_tree and self.patches is None)
|
||||
if self.patches is not None:
|
||||
push_all(toolchain, path, self.patches)
|
||||
|
||||
@ -71,8 +75,10 @@ class Project:
|
||||
|
||||
return path
|
||||
|
||||
def make_build_path(self, toolchain):
|
||||
def make_build_path(self, toolchain: AnyToolchain, lazy: bool=False) -> str:
|
||||
path = os.path.join(toolchain.build_path, self.base)
|
||||
if lazy and os.path.isdir(path):
|
||||
return path
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except FileNotFoundError:
|
||||
@ -80,5 +86,5 @@ class Project:
|
||||
os.makedirs(path, exist_ok=True)
|
||||
return path
|
||||
|
||||
def build(self, toolchain):
|
||||
def build(self, toolchain: AnyToolchain) -> None:
|
||||
self._build(toolchain)
|
||||
|
@ -1,9 +1,12 @@
|
||||
import subprocess
|
||||
from typing import Union
|
||||
|
||||
def run_quilt(toolchain, cwd, patches_path, *args):
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
def run_quilt(toolchain: AnyToolchain, cwd: str, patches_path: str, *args: str) -> None:
|
||||
env = dict(toolchain.env)
|
||||
env['QUILT_PATCHES'] = patches_path
|
||||
subprocess.check_call(['quilt'] + list(args), cwd=cwd, env=env)
|
||||
|
||||
def push_all(toolchain, src_path, patches_path):
|
||||
def push_all(toolchain: AnyToolchain, src_path: str, patches_path: str) -> None:
|
||||
run_quilt(toolchain, src_path, patches_path, 'push', '-a')
|
||||
|
@ -1,14 +1,17 @@
|
||||
import os, shutil, subprocess
|
||||
|
||||
def untar(tarball_path, parent_path, base):
|
||||
def untar(tarball_path: str, parent_path: str, base: str,
|
||||
lazy: bool=False) -> str:
|
||||
path = os.path.join(parent_path, base)
|
||||
if lazy and os.path.isdir(path):
|
||||
return path
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
os.makedirs(parent_path, exist_ok=True)
|
||||
try:
|
||||
subprocess.check_call(['/bin/tar', 'xfC', tarball_path, parent_path])
|
||||
subprocess.check_call(['tar', 'xfC', tarball_path, parent_path])
|
||||
except FileNotFoundError:
|
||||
import tarfile
|
||||
tar = tarfile.open(tarball_path)
|
||||
|
175
python/build/toolchain.py
Normal file
175
python/build/toolchain.py
Normal file
@ -0,0 +1,175 @@
|
||||
import os.path
|
||||
import shutil
|
||||
from typing import Union
|
||||
|
||||
android_abis = {
|
||||
'armeabi-v7a': {
|
||||
'arch': 'armv7a-linux-androideabi',
|
||||
'ndk_arch': 'arm',
|
||||
'cflags': '-fpic -mfpu=neon -mfloat-abi=softfp',
|
||||
},
|
||||
|
||||
'arm64-v8a': {
|
||||
'arch': 'aarch64-linux-android',
|
||||
'ndk_arch': 'arm64',
|
||||
'cflags': '-fpic',
|
||||
},
|
||||
|
||||
'x86': {
|
||||
'arch': 'i686-linux-android',
|
||||
'ndk_arch': 'x86',
|
||||
'cflags': '-fPIC -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32',
|
||||
},
|
||||
|
||||
'x86_64': {
|
||||
'arch': 'x86_64-linux-android',
|
||||
'ndk_arch': 'x86_64',
|
||||
'cflags': '-fPIC -m64',
|
||||
},
|
||||
}
|
||||
|
||||
class AndroidNdkToolchain:
|
||||
def __init__(self, top_path: str, lib_path: str,
|
||||
tarball_path: str, src_path: str,
|
||||
ndk_path: str, android_abi: str,
|
||||
use_cxx):
|
||||
# build host configuration
|
||||
build_arch = 'linux-x86_64'
|
||||
|
||||
# select the NDK target
|
||||
abi_info = android_abis[android_abi]
|
||||
host_triplet = abi_info['arch']
|
||||
|
||||
arch_path = os.path.join(lib_path, host_triplet)
|
||||
|
||||
self.tarball_path = tarball_path
|
||||
self.src_path = src_path
|
||||
self.build_path = os.path.join(arch_path, 'build')
|
||||
|
||||
ndk_arch = abi_info['ndk_arch']
|
||||
android_api_level = '24'
|
||||
|
||||
install_prefix = os.path.join(arch_path, 'root')
|
||||
|
||||
self.host_triplet = host_triplet
|
||||
self.install_prefix = install_prefix
|
||||
|
||||
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
|
||||
llvm_triple = host_triplet + android_api_level
|
||||
|
||||
common_flags = '-Os -g'
|
||||
common_flags += ' ' + abi_info['cflags']
|
||||
|
||||
llvm_bin = os.path.join(llvm_path, 'bin')
|
||||
self.cc = os.path.join(llvm_bin, 'clang')
|
||||
self.cxx = os.path.join(llvm_bin, 'clang++')
|
||||
common_flags += ' -target ' + llvm_triple
|
||||
|
||||
common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections'
|
||||
|
||||
self.ar = os.path.join(llvm_bin, 'llvm-ar')
|
||||
self.arflags = 'rcs'
|
||||
self.ranlib = os.path.join(llvm_bin, 'llvm-ranlib')
|
||||
self.nm = os.path.join(llvm_bin, 'llvm-nm')
|
||||
self.strip = os.path.join(llvm_bin, 'llvm-strip')
|
||||
|
||||
self.cflags = common_flags
|
||||
self.cxxflags = common_flags
|
||||
self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include')
|
||||
self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \
|
||||
' -Wl,--exclude-libs=ALL' + \
|
||||
' ' + common_flags
|
||||
self.ldflags = common_flags
|
||||
self.libs = ''
|
||||
|
||||
self.is_arm = ndk_arch == 'arm'
|
||||
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||
self.is_aarch64 = ndk_arch == 'arm64'
|
||||
self.is_windows = False
|
||||
self.is_android = True
|
||||
self.is_darwin = False
|
||||
|
||||
libstdcxx_flags = ''
|
||||
libstdcxx_cxxflags = ''
|
||||
libstdcxx_ldflags = ''
|
||||
libstdcxx_libs = '-static-libstdc++'
|
||||
|
||||
if self.is_armv7:
|
||||
# On 32 bit ARM, clang generates no ".eh_frame" section;
|
||||
# instead, the LLVM unwinder library is used for unwinding
|
||||
# the stack after a C++ exception was thrown
|
||||
libstdcxx_libs += ' -lunwind'
|
||||
|
||||
if use_cxx:
|
||||
self.cxxflags += ' ' + libstdcxx_cxxflags
|
||||
self.ldflags += ' ' + libstdcxx_ldflags
|
||||
self.libs += ' ' + libstdcxx_libs
|
||||
|
||||
self.env = dict(os.environ)
|
||||
|
||||
# redirect pkg-config to use our root directory instead of the
|
||||
# default one on the build host
|
||||
bin_dir = os.path.join(install_prefix, 'bin')
|
||||
os.makedirs(bin_dir, exist_ok=True)
|
||||
self.pkg_config = shutil.copy(os.path.join(top_path, 'build', 'pkg-config.sh'),
|
||||
os.path.join(bin_dir, 'pkg-config'))
|
||||
self.env['PKG_CONFIG'] = self.pkg_config
|
||||
|
||||
class MingwToolchain:
|
||||
def __init__(self, top_path: str,
|
||||
toolchain_path, host_triplet, x64: bool,
|
||||
tarball_path, src_path, build_path, install_prefix):
|
||||
self.host_triplet = host_triplet
|
||||
self.tarball_path = tarball_path
|
||||
self.src_path = src_path
|
||||
self.build_path = build_path
|
||||
self.install_prefix = install_prefix
|
||||
|
||||
toolchain_bin = os.path.join(toolchain_path, 'bin')
|
||||
self.cc = os.path.join(toolchain_bin, host_triplet + '-gcc')
|
||||
self.cxx = os.path.join(toolchain_bin, host_triplet + '-g++')
|
||||
self.ar = os.path.join(toolchain_bin, host_triplet + '-ar')
|
||||
self.arflags = 'rcs'
|
||||
self.ranlib = os.path.join(toolchain_bin, host_triplet + '-ranlib')
|
||||
self.nm = os.path.join(toolchain_bin, host_triplet + '-nm')
|
||||
self.strip = os.path.join(toolchain_bin, host_triplet + '-strip')
|
||||
self.windres = os.path.join(toolchain_bin, host_triplet + '-windres')
|
||||
|
||||
common_flags = '-O2 -g'
|
||||
|
||||
if not x64:
|
||||
# enable SSE support which is required for LAME
|
||||
common_flags += ' -march=pentium3'
|
||||
|
||||
self.cflags = common_flags
|
||||
self.cxxflags = common_flags
|
||||
self.cppflags = '-isystem ' + os.path.join(install_prefix, 'include') + \
|
||||
' -DWINVER=0x0600 -D_WIN32_WINNT=0x0600'
|
||||
self.ldflags = '-L' + os.path.join(install_prefix, 'lib') + \
|
||||
' -static-libstdc++ -static-libgcc'
|
||||
self.libs = ''
|
||||
|
||||
# Explicitly disable _FORTIFY_SOURCE because it is broken with
|
||||
# mingw. This prevents some libraries such as libFLAC to
|
||||
# enable it.
|
||||
self.cppflags += ' -D_FORTIFY_SOURCE=0'
|
||||
|
||||
self.is_arm = host_triplet.startswith('arm')
|
||||
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||
self.is_aarch64 = host_triplet == 'aarch64'
|
||||
self.is_windows = 'mingw32' in host_triplet
|
||||
self.is_android = False
|
||||
self.is_darwin = False
|
||||
|
||||
self.env = dict(os.environ)
|
||||
|
||||
# redirect pkg-config to use our root directory instead of the
|
||||
# default one on the build host
|
||||
import shutil
|
||||
bin_dir = os.path.join(install_prefix, 'bin')
|
||||
os.makedirs(bin_dir, exist_ok=True)
|
||||
self.pkg_config = shutil.copy(os.path.join(top_path, 'build', 'pkg-config.sh'),
|
||||
os.path.join(bin_dir, 'pkg-config'))
|
||||
self.env['PKG_CONFIG'] = self.pkg_config
|
||||
|
||||
AnyToolchain = Union[AndroidNdkToolchain, MingwToolchain]
|
@ -1,6 +1,7 @@
|
||||
import hashlib
|
||||
from typing import cast, Any, BinaryIO
|
||||
|
||||
def feed_file(h, f):
|
||||
def feed_file(h: Any, f: BinaryIO) -> None:
|
||||
"""Feed data read from an open file into the hashlib instance."""
|
||||
|
||||
while True:
|
||||
@ -10,20 +11,20 @@ def feed_file(h, f):
|
||||
break
|
||||
h.update(data)
|
||||
|
||||
def feed_file_path(h, path):
|
||||
def feed_file_path(h: Any, path: str) -> None:
|
||||
"""Feed data read from a file (to be opened by this function) into the hashlib instance."""
|
||||
|
||||
with open(path, 'rb') as f:
|
||||
feed_file(h, f)
|
||||
|
||||
def file_digest(algorithm, path):
|
||||
def file_digest(algorithm: Any, path: str) -> str:
|
||||
"""Calculate the digest of a file and return it in hexadecimal notation."""
|
||||
|
||||
h = algorithm()
|
||||
feed_file_path(h, path)
|
||||
return h.hexdigest()
|
||||
return cast(str, h.hexdigest())
|
||||
|
||||
def guess_digest_algorithm(digest):
|
||||
def guess_digest_algorithm(digest: str) -> Any:
|
||||
l = len(digest)
|
||||
if l == 32:
|
||||
return hashlib.md5
|
||||
@ -36,7 +37,7 @@ def guess_digest_algorithm(digest):
|
||||
else:
|
||||
return None
|
||||
|
||||
def verify_file_digest(path, expected_digest):
|
||||
def verify_file_digest(path: str, expected_digest: str) -> bool:
|
||||
"""Verify the digest of a file, and return True if the digest matches with the given expected digest."""
|
||||
|
||||
algorithm = guess_digest_algorithm(expected_digest)
|
||||
|
@ -1,22 +1,34 @@
|
||||
import os.path, subprocess
|
||||
import subprocess
|
||||
from typing import Optional, Sequence, Union
|
||||
|
||||
from build.project import Project
|
||||
from build.makeproject import MakeProject
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class ZlibProject(Project):
|
||||
def __init__(self, url, md5, installed,
|
||||
class ZlibProject(MakeProject):
|
||||
def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str,
|
||||
**kwargs):
|
||||
Project.__init__(self, url, md5, installed, **kwargs)
|
||||
MakeProject.__init__(self, url, md5, installed, **kwargs)
|
||||
|
||||
def _build(self, toolchain):
|
||||
def get_make_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
return MakeProject.get_make_args(self, toolchain) + [
|
||||
'CC=' + toolchain.cc + ' ' + toolchain.cppflags + ' ' + toolchain.cflags,
|
||||
'CPP=' + toolchain.cc + ' -E ' + toolchain.cppflags,
|
||||
'AR=' + toolchain.ar,
|
||||
'ARFLAGS=' + toolchain.arflags,
|
||||
'RANLIB=' + toolchain.ranlib,
|
||||
'LDSHARED=' + toolchain.cc + ' -shared',
|
||||
'libz.a'
|
||||
]
|
||||
|
||||
def get_make_install_args(self, toolchain: AnyToolchain) -> list[str]:
|
||||
return [
|
||||
'RANLIB=' + toolchain.ranlib,
|
||||
self.install_target
|
||||
]
|
||||
|
||||
def _build(self, toolchain: AnyToolchain) -> None:
|
||||
src = self.unpack(toolchain, out_of_tree=False)
|
||||
|
||||
subprocess.check_call(['/usr/bin/make', '--quiet',
|
||||
'-f', 'win32/Makefile.gcc',
|
||||
'PREFIX=' + toolchain.arch + '-',
|
||||
'-j12',
|
||||
'install',
|
||||
'INCLUDE_PATH='+ os.path.join(toolchain.install_prefix, 'include'),
|
||||
'LIBRARY_PATH=' + os.path.join(toolchain.install_prefix, 'lib'),
|
||||
'BINARY_PATH=' + os.path.join(toolchain.install_prefix, 'bin'),
|
||||
],
|
||||
cwd=src, env=toolchain.env)
|
||||
subprocess.check_call(['./configure', '--prefix=' + toolchain.install_prefix, '--static'],
|
||||
cwd=src, env=toolchain.env)
|
||||
self.build_make(toolchain, src)
|
||||
|
@ -86,6 +86,9 @@ enum Option {
|
||||
OPTION_KILL,
|
||||
OPTION_NO_CONFIG,
|
||||
OPTION_NO_DAEMON,
|
||||
#ifdef __linux__
|
||||
OPTION_SYSTEMD,
|
||||
#endif
|
||||
OPTION_STDOUT,
|
||||
OPTION_STDERR,
|
||||
OPTION_VERBOSE,
|
||||
@ -98,6 +101,9 @@ static constexpr OptionDef option_defs[] = {
|
||||
{"kill", "kill the currently running mpd session"},
|
||||
{"no-config", "don't read from config"},
|
||||
{"no-daemon", "don't detach from console"},
|
||||
#ifdef __linux__
|
||||
{"systemd", "systemd service mode"},
|
||||
#endif
|
||||
{"stdout", nullptr}, // hidden, compatibility with old versions
|
||||
{"stderr", "print messages to stderr"},
|
||||
{"verbose", 'v', "verbose logging"},
|
||||
@ -328,7 +334,7 @@ bool ConfigLoader::TryFile(const AllocatedPath &base_path, Path path)
|
||||
}
|
||||
|
||||
void
|
||||
ParseCommandLine(int argc, char **argv, struct options &options,
|
||||
ParseCommandLine(int argc, char **argv, CommandLineOptions &options,
|
||||
ConfigData &config)
|
||||
{
|
||||
bool use_config_file = true;
|
||||
@ -346,9 +352,20 @@ ParseCommandLine(int argc, char **argv, struct options &options,
|
||||
break;
|
||||
|
||||
case OPTION_NO_DAEMON:
|
||||
#ifdef ENABLE_DAEMON
|
||||
options.daemon = false;
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef __linux__
|
||||
case OPTION_SYSTEMD:
|
||||
#ifdef ENABLE_DAEMON
|
||||
options.daemon = false;
|
||||
#endif
|
||||
options.systemd = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case OPTION_STDOUT:
|
||||
case OPTION_STDERR:
|
||||
options.log_stderr = true;
|
||||
|
@ -20,17 +20,29 @@
|
||||
#ifndef MPD_COMMAND_LINE_HXX
|
||||
#define MPD_COMMAND_LINE_HXX
|
||||
|
||||
#include "config.h" // for ENABLE_DAEMON
|
||||
|
||||
struct ConfigData;
|
||||
|
||||
struct options {
|
||||
struct CommandLineOptions {
|
||||
bool kill = false;
|
||||
|
||||
#ifdef ENABLE_DAEMON
|
||||
bool daemon = true;
|
||||
#else
|
||||
static constexpr bool daemon = false;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
bool systemd = false;
|
||||
#endif
|
||||
|
||||
bool log_stderr = false;
|
||||
bool verbose = false;
|
||||
};
|
||||
|
||||
void
|
||||
ParseCommandLine(int argc, char **argv, struct options &options,
|
||||
ParseCommandLine(int argc, char **argv, CommandLineOptions &options,
|
||||
ConfigData &config);
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "net/SocketUtil.hxx"
|
||||
#include "system/Error.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "fs/StandardDirectory.hxx"
|
||||
#include "fs/XDG.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
@ -85,13 +86,10 @@ ListenXdgRuntimeDir(ClientListener &listener) noexcept
|
||||
use $XDG_RUNTIME_DIR */
|
||||
return false;
|
||||
|
||||
Path xdg_runtime_dir = Path::FromFS(getenv("XDG_RUNTIME_DIR"));
|
||||
if (xdg_runtime_dir.IsNull())
|
||||
const auto mpd_runtime_dir = GetAppRuntimeDir();
|
||||
if (mpd_runtime_dir.IsNull())
|
||||
return false;
|
||||
|
||||
const auto mpd_runtime_dir = xdg_runtime_dir / Path::FromFS("mpd");
|
||||
mkdir(mpd_runtime_dir.c_str(), 0700);
|
||||
|
||||
const auto socket_path = mpd_runtime_dir / Path::FromFS("socket");
|
||||
unlink(socket_path.c_str());
|
||||
|
||||
|
@ -48,15 +48,14 @@ LocateFileUri(const char *uri, const Client *client
|
||||
/* this path was relative to the music
|
||||
directory */
|
||||
// TODO: don't use suffix.data() (ok for now because we know it's null-terminated)
|
||||
return LocatedUri(LocatedUri::Type::RELATIVE,
|
||||
suffix.data());
|
||||
return {LocatedUri::Type::RELATIVE, suffix.data()};
|
||||
}
|
||||
#endif
|
||||
|
||||
if (client != nullptr)
|
||||
client->AllowFile(path);
|
||||
|
||||
return LocatedUri(LocatedUri::Type::PATH, uri, std::move(path));
|
||||
return {LocatedUri::Type::PATH, uri, std::move(path)};
|
||||
}
|
||||
|
||||
static LocatedUri
|
||||
@ -90,8 +89,7 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri
|
||||
const auto suffix = storage->MapToRelativeUTF8(uri);
|
||||
if (suffix.data() != nullptr)
|
||||
// TODO: don't use suffix.data() (ok for now because we know it's null-terminated)
|
||||
return LocatedUri(LocatedUri::Type::RELATIVE,
|
||||
suffix.data());
|
||||
return {LocatedUri::Type::RELATIVE, suffix.data()};
|
||||
}
|
||||
|
||||
if (kind == UriPluginKind::STORAGE &&
|
||||
@ -99,7 +97,7 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri
|
||||
throw std::invalid_argument("Unsupported URI scheme");
|
||||
#endif
|
||||
|
||||
return LocatedUri(LocatedUri::Type::ABSOLUTE, uri);
|
||||
return {LocatedUri::Type::ABSOLUTE, uri};
|
||||
}
|
||||
|
||||
LocatedUri
|
||||
|
@ -45,7 +45,10 @@ void
|
||||
LogFmt(LogLevel level, const Domain &domain,
|
||||
const S &format_str, Args&&... args) noexcept
|
||||
{
|
||||
#if FMT_VERSION >= 70000
|
||||
#if FMT_VERSION >= 90000
|
||||
return LogVFmt(level, domain, format_str,
|
||||
fmt::make_format_args(args...));
|
||||
#elif FMT_VERSION >= 70000
|
||||
return LogVFmt(level, domain, fmt::to_string_view(format_str),
|
||||
fmt::make_args_checked<Args...>(format_str,
|
||||
args...));
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "LogBackend.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/StringStrip.hxx"
|
||||
#include "Version.h"
|
||||
@ -110,7 +111,7 @@ chomp_length(std::string_view p) noexcept
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static int
|
||||
ToSysLogLevel(LogLevel log_level) noexcept
|
||||
{
|
||||
|
@ -158,12 +158,15 @@ log_init(const ConfigData &config, bool verbose, bool use_stdout)
|
||||
getenv("NOTIFY_SOCKET") != nullptr) {
|
||||
/* if MPD was started as a systemd
|
||||
service, default to journal (which
|
||||
is connected to fd=2) */
|
||||
is connected to stdout&stderr) */
|
||||
out_fd = STDOUT_FILENO;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifndef HAVE_SYSLOG
|
||||
#ifdef _WIN32
|
||||
/* default to stdout on Windows */
|
||||
out_fd = STDOUT_FILENO;
|
||||
#elif !defined(HAVE_SYSLOG)
|
||||
throw std::runtime_error("config parameter 'log_file' not found");
|
||||
#endif
|
||||
#ifdef HAVE_SYSLOG
|
||||
|
80
src/Main.cxx
80
src/Main.cxx
@ -142,14 +142,24 @@ struct Config {
|
||||
#ifdef ENABLE_DAEMON
|
||||
|
||||
static void
|
||||
glue_daemonize_init(const struct options *options,
|
||||
glue_daemonize_init(const CommandLineOptions &options,
|
||||
const ConfigData &config)
|
||||
{
|
||||
auto pid_file = config.GetPath(ConfigOption::PID_FILE);
|
||||
|
||||
#ifdef __linux__
|
||||
if (options.systemd && pid_file != nullptr) {
|
||||
pid_file = nullptr;
|
||||
fprintf(stderr,
|
||||
"Ignoring the 'pid_file' setting in systemd mode\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
daemonize_init(config.GetString(ConfigOption::USER),
|
||||
config.GetString(ConfigOption::GROUP),
|
||||
config.GetPath(ConfigOption::PID_FILE));
|
||||
std::move(pid_file));
|
||||
|
||||
if (options->kill)
|
||||
if (options.kill)
|
||||
daemonize_kill();
|
||||
}
|
||||
|
||||
@ -361,7 +371,8 @@ Instance::BeginShutdownPartitions() noexcept
|
||||
}
|
||||
|
||||
static inline void
|
||||
MainConfigured(const struct options &options, const ConfigData &raw_config)
|
||||
MainConfigured(const CommandLineOptions &options,
|
||||
const ConfigData &raw_config)
|
||||
{
|
||||
#ifdef ENABLE_DAEMON
|
||||
daemonize_close_stdin();
|
||||
@ -384,7 +395,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
|
||||
const Config config(raw_config);
|
||||
|
||||
#ifdef ENABLE_DAEMON
|
||||
glue_daemonize_init(&options, raw_config);
|
||||
glue_daemonize_init(options, raw_config);
|
||||
#endif
|
||||
|
||||
TagLoadConfig(raw_config);
|
||||
@ -471,7 +482,10 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
|
||||
#ifndef ANDROID
|
||||
setup_log_output();
|
||||
|
||||
const ScopeSignalHandlersInit signal_handlers_init(instance);
|
||||
const ScopeSignalHandlersInit signal_handlers_init{
|
||||
instance,
|
||||
options.daemon,
|
||||
};
|
||||
#endif
|
||||
|
||||
instance.io_thread.Start();
|
||||
@ -579,19 +593,46 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
static void
|
||||
AndroidMain()
|
||||
/**
|
||||
* Wrapper for ReadConfigFile() which returns false if the file was
|
||||
* not found.
|
||||
*/
|
||||
static bool
|
||||
TryReadConfigFile(ConfigData &config, Path path)
|
||||
{
|
||||
struct options options;
|
||||
if (!FileExists(path))
|
||||
return false;
|
||||
|
||||
ReadConfigFile(config, path);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
LoadConfigFile(JNIEnv *env, ConfigData &config)
|
||||
{
|
||||
/* try loading mpd.conf from
|
||||
"Android/data/org.musicpd/files/mpd.conf" (the app specific
|
||||
data directory) first */
|
||||
if (const auto dir = context->GetExternalFilesDir(env);
|
||||
!dir.IsNull() &&
|
||||
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf")))
|
||||
return;
|
||||
|
||||
/* if that fails, attempt to load "mpd.conf" from the root of
|
||||
the SD card (pre-0.23.9, ceases to work since Android
|
||||
12) */
|
||||
if (const auto dir = Environment::getExternalStorageDirectory(env);
|
||||
!dir.IsNull())
|
||||
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf"));
|
||||
}
|
||||
|
||||
static void
|
||||
AndroidMain(JNIEnv *env)
|
||||
{
|
||||
CommandLineOptions options;
|
||||
ConfigData raw_config;
|
||||
|
||||
const auto sdcard = Environment::getExternalStorageDirectory();
|
||||
if (!sdcard.IsNull()) {
|
||||
const auto config_path =
|
||||
sdcard / Path::FromFS("mpd.conf");
|
||||
if (FileExists(config_path))
|
||||
ReadConfigFile(raw_config, config_path);
|
||||
}
|
||||
LoadConfigFile(env, raw_config);
|
||||
|
||||
MainConfigured(options, raw_config);
|
||||
}
|
||||
@ -603,9 +644,12 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
|
||||
Java::Init(env);
|
||||
Java::Object::Initialise(env);
|
||||
Java::File::Initialise(env);
|
||||
|
||||
Environment::Initialise(env);
|
||||
AtScopeExit(env) { Environment::Deinitialise(env); };
|
||||
|
||||
Context::Initialise(env);
|
||||
|
||||
context = new Context(env, _context);
|
||||
AtScopeExit() { delete context; };
|
||||
|
||||
@ -614,7 +658,7 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
|
||||
AtScopeExit() { delete logListener; };
|
||||
|
||||
try {
|
||||
AndroidMain();
|
||||
AndroidMain(env);
|
||||
} catch (...) {
|
||||
LogError(std::current_exception());
|
||||
}
|
||||
@ -642,7 +686,7 @@ Java_org_musicpd_Bridge_pause(JNIEnv *, jclass)
|
||||
static inline void
|
||||
MainOrThrow(int argc, char *argv[])
|
||||
{
|
||||
struct options options;
|
||||
CommandLineOptions options;
|
||||
ConfigData raw_config;
|
||||
|
||||
ParseCommandLine(argc, argv, options, raw_config);
|
||||
|
@ -85,15 +85,15 @@ map_fs_to_utf8(Path path_fs) noexcept
|
||||
{
|
||||
if (path_fs.IsAbsolute()) {
|
||||
if (global_instance->storage == nullptr)
|
||||
return std::string();
|
||||
return {};
|
||||
|
||||
const auto music_dir_fs = global_instance->storage->MapFS("");
|
||||
if (music_dir_fs.IsNull())
|
||||
return std::string();
|
||||
return {};
|
||||
|
||||
auto relative = music_dir_fs.Relative(path_fs);
|
||||
if (relative == nullptr || StringIsEmpty(relative))
|
||||
return std::string();
|
||||
return {};
|
||||
|
||||
path_fs = Path::FromFS(relative);
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ MusicBuffer::MusicBuffer(unsigned num_chunks)
|
||||
MusicChunkPtr
|
||||
MusicBuffer::Allocate() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return MusicChunkPtr(buffer.Allocate(), MusicChunkDeleter(*this));
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
return {buffer.Allocate(), MusicChunkDeleter(*this)};
|
||||
}
|
||||
|
||||
void
|
||||
@ -44,7 +44,7 @@ MusicBuffer::Return(MusicChunk *chunk) noexcept
|
||||
chunk->next.reset();
|
||||
chunk->other.reset();
|
||||
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
assert(!chunk->other || !chunk->other->other);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
#endif
|
||||
|
||||
bool IsFull() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
return buffer.IsFull();
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
bool
|
||||
MusicPipe::Contains(const MusicChunk *chunk) const noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
for (const MusicChunk *i = head.get(); i != nullptr; i = i->next.get())
|
||||
if (i == chunk)
|
||||
@ -41,7 +41,7 @@ MusicPipe::Contains(const MusicChunk *chunk) const noexcept
|
||||
MusicChunkPtr
|
||||
MusicPipe::Shift() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
auto chunk = std::move(head);
|
||||
if (chunk != nullptr) {
|
||||
@ -81,7 +81,7 @@ MusicPipe::Push(MusicChunkPtr chunk) noexcept
|
||||
assert(!chunk->IsEmpty());
|
||||
assert(chunk->length == 0 || chunk->audio_format.IsValid());
|
||||
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
assert(size > 0 || !audio_format.IsDefined());
|
||||
assert(!audio_format.IsDefined() ||
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
const MusicChunk *Peek() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
return head.get();
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
unsigned GetSize() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Log.hxx"
|
||||
#include "lib/fmt/ExceptionFormatter.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "mixer/Volume.hxx"
|
||||
#include "IdleFlags.hxx"
|
||||
#include "client/Listener.hxx"
|
||||
#include "client/Client.hxx"
|
||||
@ -206,7 +205,7 @@ Partition::OnBorderPause() noexcept
|
||||
void
|
||||
Partition::OnMixerVolumeChanged(Mixer &, int) noexcept
|
||||
{
|
||||
InvalidateHardwareVolume();
|
||||
mixer_memento.InvalidateHardwareVolume();
|
||||
|
||||
/* notify clients */
|
||||
EmitIdle(IDLE_MIXER);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "queue/Listener.hxx"
|
||||
#include "output/MultipleOutputs.hxx"
|
||||
#include "mixer/Listener.hxx"
|
||||
#include "mixer/Memento.hxx"
|
||||
#include "player/Control.hxx"
|
||||
#include "player/Listener.hxx"
|
||||
#include "protocol/RangeArg.hxx"
|
||||
@ -76,6 +77,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
|
||||
|
||||
MultipleOutputs outputs;
|
||||
|
||||
MixerMemento mixer_memento;
|
||||
|
||||
PlayerControl pc;
|
||||
|
||||
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -100,18 +99,15 @@ initPermissions(const ConfigData &config)
|
||||
for (const auto ¶m : config.GetParamList(ConfigOption::PASSWORD)) {
|
||||
permission_default = 0;
|
||||
|
||||
param.With([](const char *value){
|
||||
const char *separator = std::strchr(value,
|
||||
PERMISSION_PASSWORD_CHAR);
|
||||
|
||||
if (separator == nullptr)
|
||||
param.With([](const StringView value){
|
||||
const auto [password, permissions] =
|
||||
value.Split(PERMISSION_PASSWORD_CHAR);
|
||||
if (permissions == nullptr)
|
||||
throw FormatRuntimeError("\"%c\" not found in password string",
|
||||
PERMISSION_PASSWORD_CHAR);
|
||||
|
||||
std::string password(value, separator);
|
||||
|
||||
unsigned permission = parsePermissions(separator + 1);
|
||||
permission_passwords.emplace(std::move(password), permission);
|
||||
permission_passwords.emplace(password,
|
||||
parsePermissions(permissions));
|
||||
});
|
||||
}
|
||||
|
||||
@ -161,15 +157,14 @@ GetPermissionsFromAddress(SocketAddress address) noexcept
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
getPermissionFromPassword(const char *password, unsigned *permission) noexcept
|
||||
std::optional<unsigned>
|
||||
GetPermissionFromPassword(const char *password) noexcept
|
||||
{
|
||||
auto i = permission_passwords.find(password);
|
||||
if (i == permission_passwords.end())
|
||||
return -1;
|
||||
return std::nullopt;
|
||||
|
||||
*permission = i->second;
|
||||
return 0;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
struct ConfigData;
|
||||
class SocketAddress;
|
||||
|
||||
@ -32,9 +34,13 @@ static constexpr unsigned PERMISSION_CONTROL = 4;
|
||||
static constexpr unsigned PERMISSION_ADMIN = 8;
|
||||
static constexpr unsigned PERMISSION_PLAYER = 16;
|
||||
|
||||
/**
|
||||
* @return the permissions for the given password or std::nullopt if
|
||||
* the password is not accepted
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
int
|
||||
getPermissionFromPassword(const char *password, unsigned *permission) noexcept;
|
||||
std::optional<unsigned>
|
||||
GetPermissionFromPassword(const char *password) noexcept;
|
||||
|
||||
[[gnu::const]]
|
||||
unsigned
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include "PlaylistDatabase.hxx"
|
||||
#include "db/PlaylistVector.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/LineReader.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
#include "time/ChronoUtil.hxx"
|
||||
#include "util/StringStrip.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
@ -42,7 +42,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
|
||||
}
|
||||
|
||||
void
|
||||
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
|
||||
playlist_metadata_load(LineReader &file, PlaylistVector &pv, const char *name)
|
||||
{
|
||||
PlaylistInfo pm(name);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
class PlaylistVector;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv);
|
||||
@ -33,6 +33,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv);
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
void
|
||||
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name);
|
||||
playlist_metadata_load(LineReader &file, PlaylistVector &pv,
|
||||
const char *name);
|
||||
|
||||
#endif
|
||||
|
@ -26,15 +26,15 @@
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "SongLoader.hxx"
|
||||
#include "Mapper.hxx"
|
||||
#include "protocol/RangeArg.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/FileOutputStream.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/FileOutputStream.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
#include "config/Data.hxx"
|
||||
#include "config/Option.hxx"
|
||||
#include "config/Defaults.hxx"
|
||||
#include "Idle.hxx"
|
||||
#include "fs/Limits.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "fs/FileInfo.hxx"
|
||||
@ -81,6 +81,9 @@ spl_valid_name(const char *name_utf8)
|
||||
*/
|
||||
|
||||
return std::strchr(name_utf8, '/') == nullptr &&
|
||||
#ifdef _WIN32
|
||||
std::strchr(name_utf8, '\\') == nullptr &&
|
||||
#endif
|
||||
std::strchr(name_utf8, '\n') == nullptr &&
|
||||
std::strchr(name_utf8, '\r') == nullptr;
|
||||
}
|
||||
@ -173,11 +176,8 @@ ListPlaylistFiles()
|
||||
}
|
||||
|
||||
static void
|
||||
SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path)
|
||||
SavePlaylistFile(Path path_fs, const PlaylistFileContents &contents)
|
||||
{
|
||||
assert(utf8path != nullptr);
|
||||
|
||||
const auto path_fs = spl_map_to_fs(utf8path);
|
||||
assert(!path_fs.IsNull());
|
||||
|
||||
FileOutputStream fos(path_fs);
|
||||
@ -191,12 +191,11 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path)
|
||||
fos.Commit();
|
||||
}
|
||||
|
||||
PlaylistFileContents
|
||||
LoadPlaylistFile(const char *utf8path)
|
||||
static PlaylistFileContents
|
||||
LoadPlaylistFile(Path path_fs)
|
||||
try {
|
||||
PlaylistFileContents contents;
|
||||
|
||||
const auto path_fs = spl_map_to_fs(utf8path);
|
||||
assert(!path_fs.IsNull());
|
||||
|
||||
TextFile file(path_fs);
|
||||
@ -251,16 +250,54 @@ try {
|
||||
throw;
|
||||
}
|
||||
|
||||
void
|
||||
spl_move_index(const char *utf8path, unsigned src, unsigned dest)
|
||||
static PlaylistFileContents
|
||||
MaybeLoadPlaylistFile(Path path_fs, PlaylistFileEditor::LoadMode load_mode)
|
||||
try {
|
||||
if (load_mode == PlaylistFileEditor::LoadMode::NO)
|
||||
return {};
|
||||
|
||||
return LoadPlaylistFile(path_fs);
|
||||
} catch (const PlaylistError &error) {
|
||||
if (error.GetCode() == PlaylistResult::NO_SUCH_LIST &&
|
||||
load_mode == PlaylistFileEditor::LoadMode::TRY)
|
||||
return {};
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
PlaylistFileEditor::PlaylistFileEditor(const char *name_utf8,
|
||||
LoadMode load_mode)
|
||||
:path(spl_map_to_fs(name_utf8)),
|
||||
contents(MaybeLoadPlaylistFile(path, load_mode))
|
||||
{
|
||||
if (src == dest)
|
||||
/* this doesn't check whether the playlist exists, but
|
||||
what the hell.. */
|
||||
return;
|
||||
}
|
||||
|
||||
auto contents = LoadPlaylistFile(utf8path);
|
||||
void
|
||||
PlaylistFileEditor::Insert(std::size_t i, const char *uri)
|
||||
{
|
||||
if (i > size())
|
||||
throw PlaylistError(PlaylistResult::BAD_RANGE, "Bad position");
|
||||
|
||||
if (size() >= playlist_max_length)
|
||||
throw PlaylistError(PlaylistResult::TOO_LARGE,
|
||||
"Stored playlist is too large");
|
||||
|
||||
contents.emplace(std::next(contents.begin(), i), uri);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistFileEditor::Insert(std::size_t i, const DetachedSong &song)
|
||||
{
|
||||
const char *uri = playlist_saveAbsolutePaths
|
||||
? song.GetRealURI()
|
||||
: song.GetURI();
|
||||
|
||||
Insert(i, uri);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistFileEditor::MoveIndex(unsigned src, unsigned dest)
|
||||
{
|
||||
if (src >= contents.size() || dest >= contents.size())
|
||||
throw PlaylistError(PlaylistResult::BAD_RANGE, "Bad range");
|
||||
|
||||
@ -270,9 +307,31 @@ spl_move_index(const char *utf8path, unsigned src, unsigned dest)
|
||||
|
||||
const auto dest_i = std::next(contents.begin(), dest);
|
||||
contents.insert(dest_i, std::move(value));
|
||||
}
|
||||
|
||||
SavePlaylistFile(contents, utf8path);
|
||||
void
|
||||
PlaylistFileEditor::RemoveIndex(unsigned i)
|
||||
{
|
||||
if (i >= contents.size())
|
||||
throw PlaylistError(PlaylistResult::BAD_RANGE, "Bad range");
|
||||
|
||||
contents.erase(std::next(contents.begin(), i));
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistFileEditor::RemoveRange(RangeArg range)
|
||||
{
|
||||
if (!range.CheckClip(size()))
|
||||
throw PlaylistError::BadRange();
|
||||
|
||||
contents.erase(std::next(contents.begin(), range.start),
|
||||
std::next(contents.begin(), range.end));
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistFileEditor::Save()
|
||||
{
|
||||
SavePlaylistFile(path, contents);
|
||||
idle_add(IDLE_STORED_PLAYLIST);
|
||||
}
|
||||
|
||||
@ -314,20 +373,6 @@ spl_delete(const char *name_utf8)
|
||||
idle_add(IDLE_STORED_PLAYLIST);
|
||||
}
|
||||
|
||||
void
|
||||
spl_remove_index(const char *utf8path, unsigned pos)
|
||||
{
|
||||
auto contents = LoadPlaylistFile(utf8path);
|
||||
|
||||
if (pos >= contents.size())
|
||||
throw PlaylistError(PlaylistResult::BAD_RANGE, "Bad range");
|
||||
|
||||
contents.erase(std::next(contents.begin(), pos));
|
||||
|
||||
SavePlaylistFile(contents, utf8path);
|
||||
idle_add(IDLE_STORED_PLAYLIST);
|
||||
}
|
||||
|
||||
void
|
||||
spl_append_song(const char *utf8path, const DetachedSong &song)
|
||||
try {
|
||||
|
@ -20,19 +20,55 @@
|
||||
#ifndef MPD_PLAYLIST_FILE_HXX
|
||||
#define MPD_PLAYLIST_FILE_HXX
|
||||
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct ConfigData;
|
||||
struct RangeArg;
|
||||
class DetachedSong;
|
||||
class SongLoader;
|
||||
class PlaylistVector;
|
||||
class AllocatedPath;
|
||||
|
||||
typedef std::vector<std::string> PlaylistFileContents;
|
||||
|
||||
extern bool playlist_saveAbsolutePaths;
|
||||
|
||||
class PlaylistFileEditor {
|
||||
const AllocatedPath path;
|
||||
|
||||
PlaylistFileContents contents;
|
||||
|
||||
public:
|
||||
enum class LoadMode {
|
||||
NO,
|
||||
YES,
|
||||
TRY,
|
||||
};
|
||||
|
||||
/**
|
||||
* Throws on error.
|
||||
*/
|
||||
explicit PlaylistFileEditor(const char *name_utf8, LoadMode load_mode);
|
||||
|
||||
auto size() const noexcept {
|
||||
return contents.size();
|
||||
}
|
||||
|
||||
void Insert(std::size_t i, const char *uri);
|
||||
void Insert(std::size_t i, const DetachedSong &song);
|
||||
|
||||
void MoveIndex(unsigned src, unsigned dest);
|
||||
void RemoveIndex(unsigned i);
|
||||
void RemoveRange(RangeArg range);
|
||||
|
||||
void Save();
|
||||
|
||||
private:
|
||||
void Load();
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform some global initialization, e.g. load configuration values.
|
||||
*/
|
||||
@ -55,21 +91,12 @@ spl_map_to_fs(const char *name_utf8);
|
||||
PlaylistVector
|
||||
ListPlaylistFiles();
|
||||
|
||||
PlaylistFileContents
|
||||
LoadPlaylistFile(const char *utf8path);
|
||||
|
||||
void
|
||||
spl_move_index(const char *utf8path, unsigned src, unsigned dest);
|
||||
|
||||
void
|
||||
spl_clear(const char *utf8path);
|
||||
|
||||
void
|
||||
spl_delete(const char *name_utf8);
|
||||
|
||||
void
|
||||
spl_remove_index(const char *utf8path, unsigned pos);
|
||||
|
||||
void
|
||||
spl_append_song(const char *utf8path, const DetachedSong &song);
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "fs/io/FileOutputStream.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/FileOutputStream.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
#include "util/UriExtract.hxx"
|
||||
|
||||
static void
|
||||
|
@ -98,7 +98,7 @@ RemoteTagCache::ItemResolved(Item &item) noexcept
|
||||
void
|
||||
RemoteTagCache::InvokeHandlers() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
const std::scoped_lock<Mutex> lock(mutex);
|
||||
|
||||
while (!invoke_list.empty()) {
|
||||
auto &item = invoke_list.front();
|
||||
@ -125,7 +125,7 @@ RemoteTagCache::Item::OnRemoteTag(Tag &&_tag) noexcept
|
||||
|
||||
scanner.reset();
|
||||
|
||||
const std::lock_guard<Mutex> lock(parent.mutex);
|
||||
const std::scoped_lock<Mutex> lock(parent.mutex);
|
||||
parent.ItemResolved(*this);
|
||||
}
|
||||
|
||||
@ -137,6 +137,6 @@ RemoteTagCache::Item::OnRemoteTagError(std::exception_ptr e) noexcept
|
||||
|
||||
scanner.reset();
|
||||
|
||||
const std::lock_guard<Mutex> lock(parent.mutex);
|
||||
const std::scoped_lock<Mutex> lock(parent.mutex);
|
||||
parent.ItemResolved(*this);
|
||||
}
|
||||
|
@ -28,7 +28,11 @@
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class RemoteTagCacheHandler;
|
||||
|
||||
|
@ -31,7 +31,7 @@ enum class SingleMode : uint8_t {
|
||||
/**
|
||||
* Return the string representation of a #SingleMode.
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
[[gnu::const]]
|
||||
const char *
|
||||
SingleToString(SingleMode mode) noexcept;
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "TagPrint.hxx"
|
||||
#include "client/Response.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "lib/fmt/AudioFormatFormatter.hxx"
|
||||
#include "time/ChronoUtil.hxx"
|
||||
#include "util/StringBuffer.hxx"
|
||||
#include "util/UriUtil.hxx"
|
||||
@ -93,14 +94,14 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
|
||||
time_print(r, "Last-Modified", song.mtime);
|
||||
|
||||
if (song.audio_format.IsDefined())
|
||||
r.Fmt(FMT_STRING("Format: {}\n"), ToString(song.audio_format));
|
||||
r.Fmt(FMT_STRING("Format: {}\n"), song.audio_format);
|
||||
|
||||
tag_print_values(r, song.tag);
|
||||
|
||||
const auto duration = song.GetDuration();
|
||||
if (!duration.IsNegative())
|
||||
r.Fmt(FMT_STRING("Time: {}\n"
|
||||
"duration: {:1.3}\n"),
|
||||
"duration: {:1.3f}\n"),
|
||||
duration.RoundS(),
|
||||
duration.ToDoubleS());
|
||||
}
|
||||
@ -116,14 +117,14 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept
|
||||
time_print(r, "Last-Modified", song.GetLastModified());
|
||||
|
||||
if (const auto &f = song.GetAudioFormat(); f.IsDefined())
|
||||
r.Fmt(FMT_STRING("Format: {}\n"), ToString(f));
|
||||
r.Fmt(FMT_STRING("Format: {}\n"), f);
|
||||
|
||||
tag_print_values(r, song.GetTag());
|
||||
|
||||
const auto duration = song.GetDuration();
|
||||
if (!duration.IsNegative())
|
||||
r.Fmt(FMT_STRING("Time: {}\n"
|
||||
"duration: {:1.3}\n"),
|
||||
"duration: {:1.3f}\n"),
|
||||
duration.RoundS(),
|
||||
duration.ToDoubleS());
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "db/plugins/simple/Song.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "TagSave.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/LineReader.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "tag/Builder.hxx"
|
||||
@ -63,6 +63,9 @@ song_save(BufferedOutputStream &os, const Song &song)
|
||||
if (song.audio_format.IsDefined())
|
||||
os.Format("Format: %s\n", ToString(song.audio_format).c_str());
|
||||
|
||||
if (song.in_playlist)
|
||||
os.Write("InPlaylist: yes\n");
|
||||
|
||||
if (!IsNegative(song.mtime))
|
||||
os.Format(SONG_MTIME ": %li\n",
|
||||
(long)std::chrono::system_clock::to_time_t(song.mtime));
|
||||
@ -85,8 +88,8 @@ song_save(BufferedOutputStream &os, const DetachedSong &song)
|
||||
}
|
||||
|
||||
DetachedSong
|
||||
song_load(TextFile &file, const char *uri,
|
||||
std::string *target_r)
|
||||
song_load(LineReader &file, const char *uri,
|
||||
std::string *target_r, bool *in_playlist_r)
|
||||
{
|
||||
DetachedSong song(uri);
|
||||
|
||||
@ -132,6 +135,9 @@ song_load(TextFile &file, const char *uri,
|
||||
|
||||
song.SetStartTime(SongTime::FromMS(start_ms));
|
||||
song.SetEndTime(SongTime::FromMS(end_ms));
|
||||
} else if (StringIsEqual(line, "InPlaylist")) {
|
||||
if (in_playlist_r != nullptr)
|
||||
*in_playlist_r = StringIsEqual(value, "yes");
|
||||
} else {
|
||||
throw FormatRuntimeError("unknown line in db: %s", line);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ struct Song;
|
||||
struct AudioFormat;
|
||||
class DetachedSong;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
song_save(BufferedOutputStream &os, const Song &song);
|
||||
@ -43,7 +43,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song);
|
||||
* Throws on error.
|
||||
*/
|
||||
DetachedSong
|
||||
song_load(TextFile &file, const char *uri,
|
||||
std::string *target_r=nullptr);
|
||||
song_load(LineReader &file, const char *uri,
|
||||
std::string *target_r=nullptr, bool *in_playlist_r=nullptr);
|
||||
|
||||
#endif
|
||||
|
@ -22,12 +22,11 @@
|
||||
#include "output/State.hxx"
|
||||
#include "queue/PlaylistState.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/FileOutputStream.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/FileOutputStream.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
#include "storage/StorageState.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "mixer/Volume.hxx"
|
||||
#include "SongLoader.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
@ -47,7 +46,7 @@ StateFile::StateFile(StateFileConfig &&_config,
|
||||
void
|
||||
StateFile::RememberVersions() noexcept
|
||||
{
|
||||
prev_volume_version = sw_volume_state_get_hash();
|
||||
prev_volume_version = partition.mixer_memento.GetSoftwareVolumeStateHash();
|
||||
prev_output_version = audio_output_state_get_version();
|
||||
prev_playlist_version = playlist_state_get_hash(partition.playlist,
|
||||
partition.pc);
|
||||
@ -59,7 +58,7 @@ StateFile::RememberVersions() noexcept
|
||||
bool
|
||||
StateFile::IsModified() const noexcept
|
||||
{
|
||||
return prev_volume_version != sw_volume_state_get_hash() ||
|
||||
return prev_volume_version != partition.mixer_memento.GetSoftwareVolumeStateHash() ||
|
||||
prev_output_version != audio_output_state_get_version() ||
|
||||
prev_playlist_version != playlist_state_get_hash(partition.playlist,
|
||||
partition.pc)
|
||||
@ -72,7 +71,7 @@ StateFile::IsModified() const noexcept
|
||||
inline void
|
||||
StateFile::Write(BufferedOutputStream &os)
|
||||
{
|
||||
save_sw_volume_state(os);
|
||||
partition.mixer_memento.SaveSoftwareVolumeState(os);
|
||||
audio_output_state_save(os, partition.outputs);
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
@ -125,7 +124,7 @@ try {
|
||||
|
||||
const char *line;
|
||||
while ((line = file.ReadLine()) != nullptr) {
|
||||
success = read_sw_volume_state(line, partition.outputs) ||
|
||||
success = partition.mixer_memento.LoadSoftwareVolumeState(line, partition.outputs) ||
|
||||
audio_output_state_read(line, partition.outputs) ||
|
||||
playlist_state_restore(config, line, file, song_loader,
|
||||
partition.playlist,
|
||||
|
@ -32,7 +32,7 @@ StateFileConfig::StateFileConfig(const ConfigData &config)
|
||||
{
|
||||
#ifdef ANDROID
|
||||
if (path.IsNull()) {
|
||||
const auto cache_dir = GetUserCacheDir();
|
||||
const auto cache_dir = GetAppCacheDir();
|
||||
if (cache_dir.IsNull())
|
||||
return;
|
||||
|
||||
|
@ -21,12 +21,16 @@
|
||||
#include "TagStream.hxx"
|
||||
#include "TagFile.hxx"
|
||||
#include "tag/Generic.hxx"
|
||||
#include "song/LightSong.hxx"
|
||||
#include "db/Interface.hxx"
|
||||
#include "storage/StorageInterface.hxx"
|
||||
#include "client/Client.hxx"
|
||||
#include "protocol/Ack.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/UriExtract.hxx"
|
||||
#include "LocateUri.hxx"
|
||||
|
||||
@ -51,10 +55,67 @@ TagScanFile(const Path path_fs, TagHandler &handler)
|
||||
ScanGenericTags(path_fs, handler);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
|
||||
/**
|
||||
* Collapse "../" prefixes in a URI relative to the specified base
|
||||
* URI.
|
||||
*/
|
||||
static std::string
|
||||
ResolveUri(std::string_view base, const char *relative)
|
||||
{
|
||||
while (true) {
|
||||
const char *rest = StringAfterPrefix(relative, "../");
|
||||
if (rest == nullptr)
|
||||
break;
|
||||
|
||||
if (base == ".")
|
||||
throw ProtocolError(ACK_ERROR_NO_EXIST, "Bad real URI");
|
||||
|
||||
base = PathTraitsUTF8::GetParent(base);
|
||||
relative = rest;
|
||||
}
|
||||
|
||||
return PathTraitsUTF8::Build(base, relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the specified song in the database and return its
|
||||
* (resolved) "real" URI.
|
||||
*/
|
||||
static std::string
|
||||
GetRealSongUri(Client &client, std::string_view uri)
|
||||
{
|
||||
const auto &db = client.GetDatabaseOrThrow();
|
||||
|
||||
const auto *song = db.GetSong(uri);
|
||||
if (song == nullptr)
|
||||
throw ProtocolError(ACK_ERROR_NO_EXIST, "No such song");
|
||||
|
||||
AtScopeExit(&db, song) { db.ReturnSong(song); };
|
||||
|
||||
if (song->real_uri == nullptr)
|
||||
return {};
|
||||
|
||||
return ResolveUri(PathTraitsUTF8::GetParent(uri), song->real_uri);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
TagScanDatabase(Client &client, const char *uri, TagHandler &handler)
|
||||
{
|
||||
#ifdef ENABLE_DATABASE
|
||||
const auto real_uri = GetRealSongUri(client, uri);
|
||||
|
||||
if (!real_uri.empty()) {
|
||||
uri = real_uri.c_str();
|
||||
|
||||
// TODO: support absolute paths?
|
||||
if (uri_has_scheme(uri))
|
||||
return TagScanStream(uri, handler);
|
||||
}
|
||||
|
||||
const Storage *storage = client.GetStorage();
|
||||
if (storage == nullptr) {
|
||||
#else
|
||||
|
@ -35,8 +35,9 @@ tag_print_types(Response &r) noexcept
|
||||
}
|
||||
|
||||
void
|
||||
tag_print(Response &r, TagType type, StringView value) noexcept
|
||||
tag_print(Response &r, TagType type, StringView _value) noexcept
|
||||
{
|
||||
const std::string_view value{_value};
|
||||
r.Fmt(FMT_STRING("{}: {}\n"), tag_item_names[type], value);
|
||||
}
|
||||
|
||||
@ -60,7 +61,7 @@ tag_print(Response &r, const Tag &tag) noexcept
|
||||
{
|
||||
if (!tag.duration.IsNegative())
|
||||
r.Fmt(FMT_STRING("Time: {}\n"
|
||||
"duration: {:1.3}\n"),
|
||||
"duration: {:1.3f}\n"),
|
||||
tag.duration.RoundS(),
|
||||
tag.duration.ToDoubleS());
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "TagSave.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "io/BufferedOutputStream.hxx"
|
||||
|
||||
#define SONG_TIME "Time: "
|
||||
|
||||
|
@ -36,5 +36,5 @@ time_print(Response &r, const char *name,
|
||||
return;
|
||||
}
|
||||
|
||||
r.Fmt(FMT_STRING("{}: {}\n"), name, s);
|
||||
r.Fmt(FMT_STRING("{}: {}\n"), name, s.c_str());
|
||||
}
|
||||
|
@ -26,19 +26,30 @@
|
||||
|
||||
#include "AudioManager.hxx"
|
||||
|
||||
AllocatedPath
|
||||
Context::GetExternalFilesDir(JNIEnv *env, const char *_type) noexcept
|
||||
static jmethodID getExternalFilesDir_method,
|
||||
getCacheDir_method,
|
||||
getSystemService_method;
|
||||
|
||||
void
|
||||
Context::Initialise(JNIEnv *env) noexcept
|
||||
{
|
||||
assert(_type != nullptr);
|
||||
Java::Class cls{env, "android/content/Context"};
|
||||
|
||||
Java::Class cls{env, env->GetObjectClass(Get())};
|
||||
jmethodID method = env->GetMethodID(cls, "getExternalFilesDir",
|
||||
"(Ljava/lang/String;)Ljava/io/File;");
|
||||
assert(method);
|
||||
getExternalFilesDir_method = env->GetMethodID(cls, "getExternalFilesDir",
|
||||
"(Ljava/lang/String;)Ljava/io/File;");
|
||||
getCacheDir_method = env->GetMethodID(cls, "getCacheDir",
|
||||
"()Ljava/io/File;");
|
||||
getSystemService_method = env->GetMethodID(cls, "getSystemService",
|
||||
"(Ljava/lang/String;)Ljava/lang/Object;");
|
||||
}
|
||||
|
||||
Java::String type{env, _type};
|
||||
AllocatedPath
|
||||
Context::GetExternalFilesDir(JNIEnv *env, const char *type) noexcept
|
||||
{
|
||||
assert(type != nullptr);
|
||||
|
||||
jobject file = env->CallObjectMethod(Get(), method, type.Get());
|
||||
jobject file = env->CallObjectMethod(Get(), getExternalFilesDir_method,
|
||||
Java::String::Optional(env, type).Get());
|
||||
if (Java::DiscardException(env) || file == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@ -50,12 +61,7 @@ Context::GetCacheDir(JNIEnv *env) const noexcept
|
||||
{
|
||||
assert(env != nullptr);
|
||||
|
||||
Java::Class cls(env, env->GetObjectClass(Get()));
|
||||
jmethodID method = env->GetMethodID(cls, "getCacheDir",
|
||||
"()Ljava/io/File;");
|
||||
assert(method);
|
||||
|
||||
jobject file = env->CallObjectMethod(Get(), method);
|
||||
jobject file = env->CallObjectMethod(Get(), getCacheDir_method);
|
||||
if (Java::DiscardException(env) || file == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@ -67,13 +73,8 @@ Context::GetAudioManager(JNIEnv *env) noexcept
|
||||
{
|
||||
assert(env != nullptr);
|
||||
|
||||
Java::Class cls(env, env->GetObjectClass(Get()));
|
||||
jmethodID method = env->GetMethodID(cls, "getSystemService",
|
||||
"(Ljava/lang/String;)Ljava/lang/Object;");
|
||||
assert(method);
|
||||
|
||||
Java::String name(env, "audio");
|
||||
jobject am = env->CallObjectMethod(Get(), method, name.Get());
|
||||
jobject am = env->CallObjectMethod(Get(), getSystemService_method, name.Get());
|
||||
if (Java::DiscardException(env) || am == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
@ -27,12 +27,21 @@ class AudioManager;
|
||||
|
||||
class Context : public Java::GlobalObject {
|
||||
public:
|
||||
/**
|
||||
* Global initialisation. Looks up the methods of the
|
||||
* Context Java class.
|
||||
*/
|
||||
static void Initialise(JNIEnv *env) noexcept;
|
||||
|
||||
Context(JNIEnv *env, jobject obj) noexcept
|
||||
:Java::GlobalObject(env, obj) {}
|
||||
|
||||
/**
|
||||
* @param type the subdirectory name; may be nullptr
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetExternalFilesDir(JNIEnv *env,
|
||||
const char *type) noexcept;
|
||||
const char *type=nullptr) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetCacheDir(JNIEnv *env) const noexcept;
|
||||
|
@ -25,13 +25,13 @@
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
|
||||
namespace Environment {
|
||||
static Java::TrivialClass cls;
|
||||
static jmethodID getExternalStorageDirectory_method;
|
||||
static jmethodID getExternalStoragePublicDirectory_method;
|
||||
}
|
||||
|
||||
static Java::TrivialClass cls;
|
||||
static jmethodID getExternalStorageDirectory_method;
|
||||
static jmethodID getExternalStoragePublicDirectory_method;
|
||||
|
||||
void
|
||||
Environment::Initialise(JNIEnv *env) noexcept
|
||||
Initialise(JNIEnv *env) noexcept
|
||||
{
|
||||
cls.Find(env, "android/os/Environment");
|
||||
|
||||
@ -45,16 +45,14 @@ Environment::Initialise(JNIEnv *env) noexcept
|
||||
}
|
||||
|
||||
void
|
||||
Environment::Deinitialise(JNIEnv *env) noexcept
|
||||
Deinitialise(JNIEnv *env) noexcept
|
||||
{
|
||||
cls.Clear(env);
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
Environment::getExternalStorageDirectory() noexcept
|
||||
getExternalStorageDirectory(JNIEnv *env) noexcept
|
||||
{
|
||||
JNIEnv *env = Java::GetEnv();
|
||||
|
||||
jobject file =
|
||||
env->CallStaticObjectMethod(cls,
|
||||
getExternalStorageDirectory_method);
|
||||
@ -65,20 +63,20 @@ Environment::getExternalStorageDirectory() noexcept
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
Environment::getExternalStoragePublicDirectory(const char *type) noexcept
|
||||
getExternalStoragePublicDirectory(JNIEnv *env, const char *type) noexcept
|
||||
{
|
||||
if (getExternalStoragePublicDirectory_method == nullptr)
|
||||
/* needs API level 8 */
|
||||
return nullptr;
|
||||
|
||||
JNIEnv *env = Java::GetEnv();
|
||||
|
||||
Java::String type2(env, type);
|
||||
jobject file = env->CallStaticObjectMethod(Environment::cls,
|
||||
Environment::getExternalStoragePublicDirectory_method,
|
||||
jobject file = env->CallStaticObjectMethod(cls,
|
||||
getExternalStoragePublicDirectory_method,
|
||||
type2.Get());
|
||||
if (file == nullptr)
|
||||
return nullptr;
|
||||
|
||||
return Java::File::ToAbsolutePath(env, file);
|
||||
}
|
||||
|
||||
} // namespace Environment
|
||||
|
@ -17,27 +17,29 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_ANDROID_ENVIRONMENT_HXX
|
||||
#define MPD_ANDROID_ENVIRONMENT_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#pragma once
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
class AllocatedPath;
|
||||
|
||||
namespace Environment {
|
||||
void Initialise(JNIEnv *env) noexcept;
|
||||
void Deinitialise(JNIEnv *env) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the mount point of the external SD card.
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
AllocatedPath getExternalStorageDirectory() noexcept;
|
||||
void
|
||||
Initialise(JNIEnv *env) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
AllocatedPath getExternalStoragePublicDirectory(const char *type) noexcept;
|
||||
}
|
||||
void
|
||||
Deinitialise(JNIEnv *env) noexcept;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Determine the mount point of the external SD card.
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
getExternalStorageDirectory(JNIEnv *env) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
getExternalStoragePublicDirectory(JNIEnv *env, const char *type) noexcept;
|
||||
|
||||
} // namespace Environment
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "ErrorRef.hxx"
|
||||
#include "StringRef.hxx"
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Apple {
|
||||
@ -57,8 +58,8 @@ ThrowOSStatus(OSStatus status, const char *_msg)
|
||||
const Apple::StringRef cfstr(cferr.CopyDescription());
|
||||
|
||||
char msg[1024];
|
||||
strcpy(msg, _msg);
|
||||
size_t length = strlen(msg);
|
||||
std::strcpy(msg, _msg);
|
||||
size_t length = std::strlen(msg);
|
||||
|
||||
cfstr.GetCString(msg + length, sizeof(msg) - length);
|
||||
throw std::runtime_error(msg);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "plugins/ZzipArchivePlugin.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -162,11 +162,11 @@ class Iso9660InputStream final : public InputStream {
|
||||
std::array<uint8_t, ISO_BLOCKSIZE> data;
|
||||
|
||||
public:
|
||||
ConstBuffer<uint8_t> Read() const noexcept {
|
||||
[[nodiscard]] ConstBuffer<uint8_t> Read() const noexcept {
|
||||
assert(fill <= data.size());
|
||||
assert(position <= fill);
|
||||
|
||||
return {&data[position], &data[fill]};
|
||||
return {data.data() + position, data.data() + fill};
|
||||
}
|
||||
|
||||
void Consume(size_t nbytes) noexcept {
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <inttypes.h> /* for PRIoffset (PRIu64) */
|
||||
#include <cinttypes> /* for PRIoffset (PRIu64) */
|
||||
|
||||
struct ZzipDir {
|
||||
ZZIP_DIR *const dir;
|
||||
|
@ -22,6 +22,10 @@ if libzzip_dep.found()
|
||||
found_archive_plugin = true
|
||||
endif
|
||||
|
||||
if not found_archive_plugin
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
archive_plugins = static_library(
|
||||
'archive_plugins',
|
||||
archive_plugins_sources,
|
||||
|
@ -150,7 +150,13 @@ public:
|
||||
/**
|
||||
* Write a null-terminated string.
|
||||
*/
|
||||
bool Write(const char *data) noexcept;
|
||||
bool Write(std::string_view s) noexcept {
|
||||
return Write(s.data(), s.size());
|
||||
}
|
||||
|
||||
bool WriteOK() noexcept {
|
||||
return Write("OK\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the uid of the client process, or a negative value
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "Client.hxx"
|
||||
#include "Config.hxx"
|
||||
#include "Domain.hxx"
|
||||
#include "protocol/Result.hxx"
|
||||
#include "command/AllCommands.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
@ -72,7 +71,7 @@ Client::ProcessLine(char *line) noexcept
|
||||
if (idle_waiting) {
|
||||
/* send empty idle response and leave idle mode */
|
||||
idle_waiting = false;
|
||||
command_success(*this);
|
||||
WriteOK();
|
||||
}
|
||||
|
||||
/* do nothing if the client wasn't idling: the client
|
||||
@ -108,7 +107,7 @@ Client::ProcessLine(char *line) noexcept
|
||||
"list returned {}", id, unsigned(ret));
|
||||
|
||||
if (ret == CommandResult::OK)
|
||||
command_success(*this);
|
||||
WriteOK();
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
@ -144,7 +143,7 @@ Client::ProcessLine(char *line) noexcept
|
||||
return CommandResult::CLOSE;
|
||||
|
||||
if (ret == CommandResult::OK)
|
||||
command_success(*this);
|
||||
WriteOK();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -66,7 +66,11 @@ Response::WriteBinary(ConstBuffer<void> payload) noexcept
|
||||
void
|
||||
Response::Error(enum ack code, const char *msg) noexcept
|
||||
{
|
||||
FmtError(code, FMT_STRING("{}"), msg);
|
||||
Fmt(FMT_STRING("ACK [{}@{}] {{{}}} "),
|
||||
(int)code, list_index, command);
|
||||
|
||||
Write(msg);
|
||||
Write("\n");
|
||||
}
|
||||
|
||||
void
|
||||
@ -76,7 +80,7 @@ Response::VFmtError(enum ack code,
|
||||
Fmt(FMT_STRING("ACK [{}@{}] {{{}}} "),
|
||||
(int)code, list_index, command);
|
||||
|
||||
VFmt(format_str, std::move(args));
|
||||
VFmt(format_str, args);
|
||||
|
||||
Write("\n");
|
||||
}
|
||||
|
@ -82,7 +82,10 @@ public:
|
||||
|
||||
template<typename S, typename... Args>
|
||||
bool Fmt(const S &format_str, Args&&... args) noexcept {
|
||||
#if FMT_VERSION >= 70000
|
||||
#if FMT_VERSION >= 90000
|
||||
return VFmt(format_str,
|
||||
fmt::make_format_args(args...));
|
||||
#elif FMT_VERSION >= 70000
|
||||
return VFmt(fmt::to_string_view(format_str),
|
||||
fmt::make_args_checked<Args...>(format_str,
|
||||
args...));
|
||||
@ -109,7 +112,10 @@ public:
|
||||
template<typename S, typename... Args>
|
||||
void FmtError(enum ack code,
|
||||
const S &format_str, Args&&... args) noexcept {
|
||||
#if FMT_VERSION >= 70000
|
||||
#if FMT_VERSION >= 90000
|
||||
return VFmtError(code, format_str,
|
||||
fmt::make_format_args(args...));
|
||||
#elif FMT_VERSION >= 70000
|
||||
return VFmtError(code, fmt::to_string_view(format_str),
|
||||
fmt::make_args_checked<Args...>(format_str,
|
||||
args...));
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Client.hxx"
|
||||
#include "Response.hxx"
|
||||
#include "command/CommandError.hxx"
|
||||
#include "protocol/Result.hxx"
|
||||
|
||||
ThreadBackgroundCommand::ThreadBackgroundCommand(Client &_client) noexcept
|
||||
:thread(BIND_THIS_METHOD(_Run)),
|
||||
@ -57,7 +56,7 @@ ThreadBackgroundCommand::DeferredFinish() noexcept
|
||||
PrintError(response, error);
|
||||
} else {
|
||||
SendResponse(response);
|
||||
command_success(client);
|
||||
client.WriteOK();
|
||||
}
|
||||
|
||||
/* delete this object */
|
||||
|
@ -27,9 +27,3 @@ Client::Write(const void *data, size_t length) noexcept
|
||||
/* if the client is going to be closed, do nothing */
|
||||
return !IsExpired() && FullyBufferedSocket::Write(data, length);
|
||||
}
|
||||
|
||||
bool
|
||||
Client::Write(const char *data) noexcept
|
||||
{
|
||||
return Write(data, strlen(data));
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ handle_not_commands(Client &client, Request request, Response &response);
|
||||
* This array must be sorted!
|
||||
*/
|
||||
static constexpr struct command commands[] = {
|
||||
{ "add", PERMISSION_ADD, 1, 1, handle_add },
|
||||
{ "add", PERMISSION_ADD, 1, 2, handle_add },
|
||||
{ "addid", PERMISSION_ADD, 1, 2, handle_addid },
|
||||
{ "addtagid", PERMISSION_ADD, 3, 3, handle_addtagid },
|
||||
{ "albumart", PERMISSION_READ, 2, 2, handle_album_art },
|
||||
@ -157,7 +157,7 @@ static constexpr struct command commands[] = {
|
||||
{ "play", PERMISSION_PLAYER, 0, 1, handle_play },
|
||||
{ "playid", PERMISSION_PLAYER, 0, 1, handle_playid },
|
||||
{ "playlist", PERMISSION_READ, 0, 0, handle_playlist },
|
||||
{ "playlistadd", PERMISSION_CONTROL, 2, 2, handle_playlistadd },
|
||||
{ "playlistadd", PERMISSION_CONTROL, 2, 3, handle_playlistadd },
|
||||
{ "playlistclear", PERMISSION_CONTROL, 1, 1, handle_playlistclear },
|
||||
{ "playlistdelete", PERMISSION_CONTROL, 2, 2, handle_playlistdelete },
|
||||
{ "playlistfind", PERMISSION_READ, 1, -1, handle_playlistfind },
|
||||
|
@ -58,13 +58,13 @@ handle_binary_limit(Client &client, Request args,
|
||||
CommandResult
|
||||
handle_password(Client &client, Request args, Response &r)
|
||||
{
|
||||
unsigned permission = 0;
|
||||
if (getPermissionFromPassword(args.front(), &permission) < 0) {
|
||||
const auto permission = GetPermissionFromPassword(args.front());
|
||||
if (!permission) {
|
||||
r.Error(ACK_ERROR_PASSWORD, "incorrect password");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
client.SetPermission(permission);
|
||||
client.SetPermission(*permission);
|
||||
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "DatabaseCommands.hxx"
|
||||
#include "PositionArg.hxx"
|
||||
#include "Request.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "db/DatabaseQueue.hxx"
|
||||
@ -40,6 +41,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <limits.h> // for UINT_MAX
|
||||
|
||||
CommandResult
|
||||
handle_listfiles_db(Client &client, Response &r, const char *uri)
|
||||
{
|
||||
@ -86,6 +89,20 @@ ParseQueuePosition(Request &args, unsigned queue_length)
|
||||
return queue_length;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
ParseInsertPosition(Request &args, const playlist &playlist)
|
||||
{
|
||||
if (args.size >= 2 && StringIsEqual(args[args.size - 2], "position")) {
|
||||
unsigned position = ParseInsertPosition(args.back(), playlist);
|
||||
args.pop_back();
|
||||
args.pop_back();
|
||||
return position;
|
||||
}
|
||||
|
||||
/* append to the end of the queue by default */
|
||||
return playlist.queue.GetLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert all remaining arguments to a #DatabaseSelection.
|
||||
*
|
||||
@ -160,7 +177,8 @@ handle_match_add(Client &client, Request args, bool fold_case)
|
||||
{
|
||||
auto &partition = client.GetPartition();
|
||||
const auto queue_length = partition.playlist.queue.GetLength();
|
||||
const unsigned position = ParseQueuePosition(args, queue_length);
|
||||
const unsigned position =
|
||||
ParseInsertPosition(args, partition.playlist);
|
||||
|
||||
SongFilter filter;
|
||||
const auto selection = ParseDatabaseSelection(args, fold_case, filter);
|
||||
@ -199,13 +217,20 @@ handle_searchaddpl(Client &client, Request args, Response &)
|
||||
{
|
||||
const char *playlist = args.shift();
|
||||
|
||||
const unsigned position = ParseQueuePosition(args, UINT_MAX);
|
||||
|
||||
SongFilter filter;
|
||||
const auto selection = ParseDatabaseSelection(args, true, filter);
|
||||
|
||||
const Database &db = client.GetDatabaseOrThrow();
|
||||
|
||||
search_add_to_playlist(db, client.GetStorage(),
|
||||
playlist, selection);
|
||||
if (position == UINT_MAX)
|
||||
search_add_to_playlist(db, client.GetStorage(),
|
||||
playlist, selection);
|
||||
else
|
||||
SearchInsertIntoPlaylist(db, client.GetStorage(), selection,
|
||||
playlist, position);
|
||||
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,6 @@ handle_listfiles_local(Response &r, Path path_fs)
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
gcc_pure
|
||||
static bool
|
||||
IsValidName(const StringView s) noexcept
|
||||
@ -130,7 +126,8 @@ public:
|
||||
explicit PrintCommentHandler(Response &_response) noexcept
|
||||
:NullTagHandler(WANT_PAIR), response(_response) {}
|
||||
|
||||
void OnPair(StringView key, StringView value) noexcept override {
|
||||
void OnPair(StringView _key, StringView _value) noexcept override {
|
||||
const std::string_view key{_key}, value{_value};
|
||||
if (IsValidName(key) && IsValidValue(value))
|
||||
response.Fmt(FMT_STRING("{}: {}\n"), key, value);
|
||||
}
|
||||
@ -160,8 +157,7 @@ find_stream_art(std::string_view directory, Mutex &mutex)
|
||||
static constexpr auto art_names = std::array {
|
||||
"cover.png",
|
||||
"cover.jpg",
|
||||
"cover.tiff",
|
||||
"cover.bmp",
|
||||
"cover.webp",
|
||||
};
|
||||
|
||||
for(const auto name : art_names) {
|
||||
@ -213,7 +209,7 @@ read_stream_art(Response &r, const std::string_view art_directory,
|
||||
std::min<offset_type>(art_file_size - offset,
|
||||
r.GetClient().binary_limit);
|
||||
|
||||
std::unique_ptr<std::byte[]> buffer(new std::byte[buffer_size]);
|
||||
auto buffer = std::make_unique<std::byte[]>(buffer_size);
|
||||
|
||||
std::size_t read_size = 0;
|
||||
if (buffer_size > 0) {
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
}
|
||||
|
||||
void CancelThread() noexcept override {
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
const std::scoped_lock<Mutex> lock(mutex);
|
||||
cancel = true;
|
||||
cond.notify_one();
|
||||
}
|
||||
@ -204,7 +204,7 @@ GetChromaprintCommand::DecodeFile(std::string_view suffix, InputStream &is,
|
||||
return false;
|
||||
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
if (cancel)
|
||||
throw StopDecoder();
|
||||
}
|
||||
@ -224,10 +224,12 @@ GetChromaprintCommand::DecodeFile(std::string_view suffix, InputStream &is,
|
||||
inline void
|
||||
GetChromaprintCommand::DecodeFile()
|
||||
{
|
||||
const auto suffix = uri_get_suffix(uri);
|
||||
if (suffix.empty())
|
||||
const char *_suffix = PathTraitsUTF8::GetFilenameSuffix(uri.c_str());
|
||||
if (_suffix == nullptr)
|
||||
return;
|
||||
|
||||
const std::string_view suffix{_suffix};
|
||||
|
||||
InputStreamPtr input_stream;
|
||||
|
||||
try {
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "TimePrint.hxx"
|
||||
#include "decoder/DecoderPrint.hxx"
|
||||
#include "ls.hxx"
|
||||
#include "mixer/Volume.hxx"
|
||||
#include "time/ChronoUtil.hxx"
|
||||
#include "util/UriUtil.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
@ -325,7 +324,7 @@ handle_getvol(Client &client, Request, Response &r)
|
||||
{
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
const auto volume = volume_level_get(partition.outputs);
|
||||
const auto volume = partition.mixer_memento.GetVolume(partition.outputs);
|
||||
if (volume >= 0)
|
||||
r.Fmt(FMT_STRING("volume: {}\n"), volume);
|
||||
|
||||
@ -333,15 +332,13 @@ handle_getvol(Client &client, Request, Response &r)
|
||||
}
|
||||
|
||||
CommandResult
|
||||
handle_setvol(Client &client, Request args, Response &r)
|
||||
handle_setvol(Client &client, Request args, Response &)
|
||||
{
|
||||
unsigned level = args.ParseUnsigned(0, 100);
|
||||
|
||||
if (!volume_level_change(client.GetPartition().outputs, level)) {
|
||||
r.Error(ACK_ERROR_SYSTEM, "problems setting volume");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
auto &partition = client.GetPartition();
|
||||
partition.mixer_memento.SetVolume(partition.outputs, level);
|
||||
partition.EmitIdle(IDLE_MIXER);
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
@ -350,9 +347,11 @@ handle_volume(Client &client, Request args, Response &r)
|
||||
{
|
||||
int relative = args.ParseInt(0, -100, 100);
|
||||
|
||||
auto &outputs = client.GetPartition().outputs;
|
||||
auto &partition = client.GetPartition();
|
||||
auto &outputs = partition.outputs;
|
||||
auto &mixer_memento = partition.mixer_memento;
|
||||
|
||||
const int old_volume = volume_level_get(outputs);
|
||||
const int old_volume = mixer_memento.GetVolume(outputs);
|
||||
if (old_volume < 0) {
|
||||
r.Error(ACK_ERROR_SYSTEM, "No mixer");
|
||||
return CommandResult::ERROR;
|
||||
@ -364,10 +363,9 @@ handle_volume(Client &client, Request args, Response &r)
|
||||
else if (new_volume > 100)
|
||||
new_volume = 100;
|
||||
|
||||
if (new_volume != old_volume &&
|
||||
!volume_level_change(outputs, new_volume)) {
|
||||
r.Error(ACK_ERROR_SYSTEM, "problems setting volume");
|
||||
return CommandResult::ERROR;
|
||||
if (new_volume != old_volume) {
|
||||
mixer_memento.SetVolume(outputs, new_volume);
|
||||
partition.EmitIdle(IDLE_MIXER);
|
||||
}
|
||||
|
||||
return CommandResult::OK;
|
||||
|
@ -33,7 +33,11 @@ handle_enableoutput(Client &client, Request args, Response &r)
|
||||
assert(args.size == 1);
|
||||
unsigned device = args.ParseUnsigned(0);
|
||||
|
||||
if (!audio_output_enable_index(client.GetPartition().outputs, device)) {
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
if (!audio_output_enable_index(partition.outputs,
|
||||
partition.mixer_memento,
|
||||
device)) {
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
@ -47,7 +51,11 @@ handle_disableoutput(Client &client, Request args, Response &r)
|
||||
assert(args.size == 1);
|
||||
unsigned device = args.ParseUnsigned(0);
|
||||
|
||||
if (!audio_output_disable_index(client.GetPartition().outputs, device)) {
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
if (!audio_output_disable_index(partition.outputs,
|
||||
partition.mixer_memento,
|
||||
device)) {
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
@ -61,7 +69,11 @@ handle_toggleoutput(Client &client, Request args, Response &r)
|
||||
assert(args.size == 1);
|
||||
unsigned device = args.ParseUnsigned(0);
|
||||
|
||||
if (!audio_output_toggle_index(client.GetPartition().outputs, device)) {
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
if (!audio_output_toggle_index(partition.outputs,
|
||||
partition.mixer_memento,
|
||||
device)) {
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No such audio output");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
@ -186,7 +186,8 @@ handle_moveoutput(Client &client, Request request, Response &response)
|
||||
was_enabled);
|
||||
else
|
||||
/* copy the AudioOutputControl and add it to the output list */
|
||||
dest_partition.outputs.AddCopy(output,was_enabled);
|
||||
dest_partition.outputs.AddMoveFrom(std::move(*output),
|
||||
was_enabled);
|
||||
|
||||
instance.EmitIdle(IDLE_OUTPUT);
|
||||
return CommandResult::OK;
|
||||
|
@ -25,10 +25,10 @@
|
||||
#include "SingleMode.hxx"
|
||||
#include "client/Client.hxx"
|
||||
#include "client/Response.hxx"
|
||||
#include "mixer/Volume.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "IdleFlags.hxx"
|
||||
#include "lib/fmt/AudioFormatFormatter.hxx"
|
||||
#include "util/StringBuffer.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/Exception.hxx"
|
||||
@ -131,7 +131,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
|
||||
|
||||
const auto &playlist = partition.playlist;
|
||||
|
||||
const auto volume = volume_level_get(partition.outputs);
|
||||
const auto volume = partition.mixer_memento.GetVolume(partition.outputs);
|
||||
if (volume >= 0)
|
||||
r.Fmt(FMT_STRING("volume: {}\n"), volume);
|
||||
|
||||
@ -171,7 +171,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
|
||||
|
||||
if (player_status.state != PlayerState::STOP) {
|
||||
r.Fmt(FMT_STRING(COMMAND_STATUS_TIME ": {}:{}\n"
|
||||
"elapsed: {:1.3}\n"
|
||||
"elapsed: {:1.3f}\n"
|
||||
COMMAND_STATUS_BITRATE ": {}\n"),
|
||||
player_status.elapsed_time.RoundS(),
|
||||
player_status.total_time.IsNegative()
|
||||
@ -181,12 +181,12 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
|
||||
player_status.bit_rate);
|
||||
|
||||
if (!player_status.total_time.IsNegative())
|
||||
r.Fmt(FMT_STRING("duration: {:1.3}\n"),
|
||||
r.Fmt(FMT_STRING("duration: {:1.3f}\n"),
|
||||
player_status.total_time.ToDoubleS());
|
||||
|
||||
if (player_status.audio_format.IsDefined())
|
||||
r.Fmt(FMT_STRING(COMMAND_STATUS_AUDIO ": {}\n"),
|
||||
ToString(player_status.audio_format));
|
||||
player_status.audio_format);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
|
@ -19,10 +19,13 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "PlaylistCommands.hxx"
|
||||
#include "PositionArg.hxx"
|
||||
#include "Request.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "db/Interface.hxx"
|
||||
#include "db/Selection.hxx"
|
||||
#include "db/DatabasePlaylist.hxx"
|
||||
#include "db/DatabaseSong.hxx"
|
||||
#include "PlaylistSave.hxx"
|
||||
#include "PlaylistFile.hxx"
|
||||
#include "PlaylistError.hxx"
|
||||
@ -86,7 +89,7 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r)
|
||||
const unsigned old_size = playlist.GetLength();
|
||||
|
||||
const unsigned position = args.size > 2
|
||||
? args.ParseUnsigned(2, old_size)
|
||||
? ParseInsertPosition(args[2], partition.playlist)
|
||||
: old_size;
|
||||
|
||||
const SongLoader loader(client);
|
||||
@ -172,9 +175,11 @@ handle_playlistdelete([[maybe_unused]] Client &client,
|
||||
Request args, [[maybe_unused]] Response &r)
|
||||
{
|
||||
const char *const name = args[0];
|
||||
unsigned from = args.ParseUnsigned(1);
|
||||
const auto range = args.ParseRange(1);
|
||||
|
||||
spl_remove_index(name, from);
|
||||
PlaylistFileEditor editor(name, PlaylistFileEditor::LoadMode::YES);
|
||||
editor.RemoveRange(range);
|
||||
editor.Save();
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
@ -186,7 +191,14 @@ handle_playlistmove([[maybe_unused]] Client &client,
|
||||
unsigned from = args.ParseUnsigned(1);
|
||||
unsigned to = args.ParseUnsigned(2);
|
||||
|
||||
spl_move_index(name, from, to);
|
||||
if (from == to)
|
||||
/* this doesn't check whether the playlist exists, but
|
||||
what the hell.. */
|
||||
return CommandResult::OK;
|
||||
|
||||
PlaylistFileEditor editor(name, PlaylistFileEditor::LoadMode::YES);
|
||||
editor.MoveIndex(from, to);
|
||||
editor.Save();
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
@ -200,12 +212,55 @@ handle_playlistclear([[maybe_unused]] Client &client,
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
static CommandResult
|
||||
handle_playlistadd_position(Client &client, const char *playlist_name,
|
||||
const char *uri, unsigned position,
|
||||
Response &r)
|
||||
{
|
||||
PlaylistFileEditor editor{
|
||||
playlist_name,
|
||||
PlaylistFileEditor::LoadMode::TRY,
|
||||
};
|
||||
|
||||
if (position > editor.size()) {
|
||||
r.Error(ACK_ERROR_ARG, "Bad position");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
if (uri_has_scheme(uri)) {
|
||||
editor.Insert(position, uri);
|
||||
} else {
|
||||
#ifdef ENABLE_DATABASE
|
||||
const DatabaseSelection selection(uri, true, nullptr);
|
||||
|
||||
if (SearchInsertIntoPlaylist(client.GetDatabaseOrThrow(),
|
||||
client.GetStorage(),
|
||||
selection,
|
||||
editor, position) == 0)
|
||||
/* no song was found, don't need to save */
|
||||
return CommandResult::OK;
|
||||
#else
|
||||
(void)client;
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No database");
|
||||
return CommandResult::ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
editor.Save();
|
||||
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
CommandResult
|
||||
handle_playlistadd(Client &client, Request args, [[maybe_unused]] Response &r)
|
||||
{
|
||||
const char *const playlist = args[0];
|
||||
const char *const uri = args[1];
|
||||
|
||||
if (args.size >= 3)
|
||||
return handle_playlistadd_position(client, playlist, uri,
|
||||
args.ParseUnsigned(2), r);
|
||||
|
||||
if (uri_has_scheme(uri)) {
|
||||
const SongLoader loader(client);
|
||||
spl_append_uri(playlist, loader, uri);
|
||||
|
103
src/command/PositionArg.cxx
Normal file
103
src/command/PositionArg.cxx
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "PositionArg.hxx"
|
||||
#include "protocol/Ack.hxx"
|
||||
#include "protocol/ArgParser.hxx"
|
||||
#include "protocol/RangeArg.hxx"
|
||||
#include "queue/Playlist.hxx"
|
||||
|
||||
static unsigned
|
||||
RequireCurrentPosition(const playlist &p)
|
||||
{
|
||||
int position = p.GetCurrentPosition();
|
||||
if (position < 0)
|
||||
throw ProtocolError(ACK_ERROR_PLAYER_SYNC,
|
||||
"No current song");
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
unsigned
|
||||
ParseInsertPosition(const char *s, const playlist &playlist)
|
||||
{
|
||||
const auto queue_length = playlist.queue.GetLength();
|
||||
|
||||
if (*s == '+') {
|
||||
/* after the current song */
|
||||
|
||||
const unsigned current = RequireCurrentPosition(playlist);
|
||||
assert(current < queue_length);
|
||||
|
||||
return current + 1 +
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - 1);
|
||||
} else if (*s == '-') {
|
||||
/* before the current song */
|
||||
|
||||
const unsigned current = RequireCurrentPosition(playlist);
|
||||
assert(current < queue_length);
|
||||
|
||||
return current - ParseCommandArgUnsigned(s + 1, current);
|
||||
} else
|
||||
/* absolute position */
|
||||
return ParseCommandArgUnsigned(s, queue_length);
|
||||
}
|
||||
|
||||
unsigned
|
||||
ParseMoveDestination(const char *s, const RangeArg range, const playlist &p)
|
||||
{
|
||||
assert(!range.IsEmpty());
|
||||
assert(!range.IsOpenEnded());
|
||||
|
||||
const unsigned queue_length = p.queue.GetLength();
|
||||
|
||||
if (*s == '+') {
|
||||
/* after the current song */
|
||||
|
||||
unsigned current = RequireCurrentPosition(p);
|
||||
assert(current < queue_length);
|
||||
if (range.Contains(current))
|
||||
throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
|
||||
|
||||
if (current >= range.end)
|
||||
current -= range.Count();
|
||||
|
||||
return current + 1 +
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - range.Count());
|
||||
} else if (*s == '-') {
|
||||
/* before the current song */
|
||||
|
||||
unsigned current = RequireCurrentPosition(p);
|
||||
assert(current < queue_length);
|
||||
if (range.Contains(current))
|
||||
throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
|
||||
|
||||
if (current >= range.end)
|
||||
current -= range.Count();
|
||||
|
||||
return current -
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - range.Count());
|
||||
} else
|
||||
/* absolute position */
|
||||
return ParseCommandArgUnsigned(s,
|
||||
queue_length - range.Count());
|
||||
}
|
@ -17,13 +17,16 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_FFMPEG_LOG_ERROR_HXX
|
||||
#define MPD_FFMPEG_LOG_ERROR_HXX
|
||||
#pragma once
|
||||
|
||||
void
|
||||
LogFfmpegError(int errnum);
|
||||
struct playlist;
|
||||
struct RangeArg;
|
||||
|
||||
void
|
||||
LogFfmpegError(int errnum, const char *prefix);
|
||||
/**
|
||||
* Throws #ProtocolError on error.
|
||||
*/
|
||||
unsigned
|
||||
ParseInsertPosition(const char *s, const playlist &playlist);
|
||||
|
||||
#endif
|
||||
unsigned
|
||||
ParseMoveDestination(const char *s, const RangeArg range, const playlist &p);
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "QueueCommands.hxx"
|
||||
#include "PositionArg.hxx"
|
||||
#include "Request.hxx"
|
||||
#include "protocol/RangeArg.hxx"
|
||||
#include "db/DatabaseQueue.hxx"
|
||||
@ -43,17 +44,6 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
static unsigned
|
||||
RequireCurrentPosition(const playlist &p)
|
||||
{
|
||||
int position = p.GetCurrentPosition();
|
||||
if (position < 0)
|
||||
throw ProtocolError(ACK_ERROR_PLAYER_SYNC,
|
||||
"No current song");
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
static void
|
||||
AddUri(Client &client, const LocatedUri &uri)
|
||||
{
|
||||
@ -62,29 +52,24 @@ AddUri(Client &client, const LocatedUri &uri)
|
||||
SongLoader(client).LoadSong(uri));
|
||||
}
|
||||
|
||||
static CommandResult
|
||||
AddDatabaseSelection(Client &client, const char *uri,
|
||||
[[maybe_unused]] Response &r)
|
||||
{
|
||||
#ifdef ENABLE_DATABASE
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
static void
|
||||
AddDatabaseSelection(Partition &partition, const char *uri)
|
||||
{
|
||||
const ScopeBulkEdit bulk_edit(partition);
|
||||
|
||||
const DatabaseSelection selection(uri, true);
|
||||
AddFromDatabase(partition, selection);
|
||||
return CommandResult::OK;
|
||||
#else
|
||||
(void)client;
|
||||
(void)uri;
|
||||
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No database");
|
||||
return CommandResult::ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CommandResult
|
||||
handle_add(Client &client, Request args, Response &r)
|
||||
handle_add(Client &client, Request args, [[maybe_unused]] Response &r)
|
||||
{
|
||||
auto &partition = client.GetPartition();
|
||||
|
||||
const char *uri = args.front();
|
||||
if (StringIsEqual(uri, "/"))
|
||||
/* this URI is malformed, but some clients are buggy
|
||||
@ -94,6 +79,11 @@ handle_add(Client &client, Request args, Response &r)
|
||||
here */
|
||||
uri = "";
|
||||
|
||||
const auto old_size = partition.playlist.GetLength();
|
||||
const unsigned position = args.size > 1
|
||||
? ParseInsertPosition(args[1], partition.playlist)
|
||||
: old_size;
|
||||
|
||||
const auto located_uri = LocateUri(UriPluginKind::INPUT, uri,
|
||||
&client
|
||||
#ifdef ENABLE_DATABASE
|
||||
@ -104,18 +94,34 @@ handle_add(Client &client, Request args, Response &r)
|
||||
case LocatedUri::Type::ABSOLUTE:
|
||||
AddUri(client, located_uri);
|
||||
client.GetInstance().LookupRemoteTag(located_uri.canonical_uri);
|
||||
return CommandResult::OK;
|
||||
break;
|
||||
|
||||
case LocatedUri::Type::PATH:
|
||||
AddUri(client, located_uri);
|
||||
return CommandResult::OK;
|
||||
break;
|
||||
|
||||
case LocatedUri::Type::RELATIVE:
|
||||
return AddDatabaseSelection(client, located_uri.canonical_uri,
|
||||
r);
|
||||
#ifdef ENABLE_DATABASE
|
||||
AddDatabaseSelection(partition, located_uri.canonical_uri);
|
||||
break;
|
||||
#else
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No database");
|
||||
return CommandResult::ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
gcc_unreachable();
|
||||
if (position < old_size) {
|
||||
const unsigned new_size = partition.playlist.GetLength();
|
||||
const RangeArg move_range{old_size, new_size};
|
||||
|
||||
try {
|
||||
partition.MoveRange(move_range, position);
|
||||
} catch (...) {
|
||||
/* ignore - shall we handle it? */
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
CommandResult
|
||||
@ -129,30 +135,8 @@ handle_addid(Client &client, Request args, Response &r)
|
||||
|
||||
const auto queue_length = partition.playlist.queue.GetLength();
|
||||
|
||||
if (args.size > 1) {
|
||||
const char *const s = args[1];
|
||||
if (*s == '+') {
|
||||
/* after the current song */
|
||||
|
||||
const unsigned current =
|
||||
RequireCurrentPosition(partition.playlist);
|
||||
assert(current < queue_length);
|
||||
|
||||
to = current + 1 +
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - 1);
|
||||
} else if (*s == '-') {
|
||||
/* before the current song */
|
||||
|
||||
const unsigned current =
|
||||
RequireCurrentPosition(partition.playlist);
|
||||
assert(current < queue_length);
|
||||
|
||||
to = current - ParseCommandArgUnsigned(s + 1, current);
|
||||
} else
|
||||
/* absolute position */
|
||||
to = args.ParseUnsigned(1, queue_length);
|
||||
}
|
||||
if (args.size > 1)
|
||||
to = ParseInsertPosition(args[1], partition.playlist);
|
||||
|
||||
const SongLoader loader(client);
|
||||
const unsigned added_position = queue_length;
|
||||
@ -363,49 +347,6 @@ handle_prioid(Client &client, Request args, [[maybe_unused]] Response &r)
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
ParseMoveDestination(const char *s, const RangeArg range,
|
||||
const playlist &p)
|
||||
{
|
||||
assert(!range.IsEmpty());
|
||||
assert(!range.IsOpenEnded());
|
||||
|
||||
const unsigned queue_length = p.queue.GetLength();
|
||||
|
||||
if (*s == '+') {
|
||||
/* after the current song */
|
||||
|
||||
unsigned current = RequireCurrentPosition(p);
|
||||
assert(current < queue_length);
|
||||
if (range.Contains(current))
|
||||
throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
|
||||
|
||||
if (current >= range.end)
|
||||
current -= range.Count();
|
||||
|
||||
return current + 1 +
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - range.Count());
|
||||
} else if (*s == '-') {
|
||||
/* before the current song */
|
||||
|
||||
unsigned current = RequireCurrentPosition(p);
|
||||
assert(current < queue_length);
|
||||
if (range.Contains(current))
|
||||
throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
|
||||
|
||||
if (current >= range.end)
|
||||
current -= range.Count();
|
||||
|
||||
return current -
|
||||
ParseCommandArgUnsigned(s + 1,
|
||||
queue_length - current - range.Count());
|
||||
} else
|
||||
/* absolute position */
|
||||
return ParseCommandArgUnsigned(s,
|
||||
queue_length - range.Count());
|
||||
}
|
||||
|
||||
static CommandResult
|
||||
handle_move(Partition &partition, RangeArg range, const char *to)
|
||||
{
|
||||
|
@ -83,10 +83,6 @@ handle_listfiles_storage(Response &r, StorageDirectoryReader &reader)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
CommandResult
|
||||
handle_listfiles_storage(Response &r, Storage &storage, const char *uri)
|
||||
{
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "fs/List.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "fs/io/FileReader.hxx"
|
||||
#include "fs/io/BufferedReader.hxx"
|
||||
#include "io/FileReader.hxx"
|
||||
#include "io/BufferedReader.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -23,11 +23,10 @@
|
||||
#include "fs/Traits.hxx"
|
||||
#include "fs/StandardDirectory.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
|
||||
@ -96,30 +95,18 @@ ParsePath(const char *path)
|
||||
if (*path == '\0')
|
||||
return GetConfiguredHome();
|
||||
|
||||
AllocatedPath home = nullptr;
|
||||
|
||||
if (*path == '/') {
|
||||
home = GetConfiguredHome();
|
||||
|
||||
++path;
|
||||
|
||||
return GetConfiguredHome() /
|
||||
AllocatedPath::FromUTF8Throw(path);
|
||||
} else {
|
||||
const char *slash = std::strchr(path, '/');
|
||||
const char *end = slash == nullptr
|
||||
? path + strlen(path)
|
||||
: slash;
|
||||
const std::string user(path, end);
|
||||
home = GetHome(user.c_str());
|
||||
const auto [user, rest] =
|
||||
StringView{path}.Split('/');
|
||||
|
||||
if (slash == nullptr)
|
||||
return home;
|
||||
|
||||
path = slash + 1;
|
||||
return GetHome(std::string{user}.c_str())
|
||||
/ AllocatedPath::FromUTF8Throw(rest);
|
||||
}
|
||||
|
||||
if (home.IsNull())
|
||||
return nullptr;
|
||||
|
||||
return home / AllocatedPath::FromUTF8Throw(path);
|
||||
} else if (!PathTraitsUTF8::IsAbsolute(path)) {
|
||||
throw FormatRuntimeError("not an absolute path: %s", path);
|
||||
} else {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "fs/StandardDirectory.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
@ -51,17 +52,30 @@ CreateConfiguredDatabase(const ConfigData &config,
|
||||
} else {
|
||||
/* if there is no override, use the cache directory */
|
||||
|
||||
const AllocatedPath cache_dir = GetUserCacheDir();
|
||||
const AllocatedPath cache_dir = GetAppCacheDir();
|
||||
if (cache_dir.IsNull())
|
||||
return nullptr;
|
||||
|
||||
const auto db_file = cache_dir / Path::FromFS(PATH_LITERAL("mpd.db"));
|
||||
const auto db_file = cache_dir / Path::FromFS(PATH_LITERAL("db"));
|
||||
auto db_file_utf8 = db_file.ToUTF8();
|
||||
if (db_file_utf8.empty())
|
||||
return nullptr;
|
||||
|
||||
ConfigBlock block;
|
||||
block.AddBlockParam("path", std::move(db_file_utf8), -1);
|
||||
|
||||
{
|
||||
const auto mounts_dir = cache_dir
|
||||
/ Path::FromFS(PATH_LITERAL("mounts"));
|
||||
CreateDirectoryNoThrow(mounts_dir);
|
||||
|
||||
if (auto mounts_dir_utf8 = mounts_dir.ToUTF8();
|
||||
!mounts_dir_utf8.empty())
|
||||
block.AddBlockParam("cache_directory",
|
||||
std::move(mounts_dir_utf8),
|
||||
-1);
|
||||
}
|
||||
|
||||
return DatabaseGlobalInit(main_event_loop, io_event_loop,
|
||||
listener, block);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user