Skip to content

Commit d257760

Browse files
authored
Update players & fixes (#313)
1 parent f5799c2 commit d257760

File tree

15 files changed

+76
-22
lines changed

15 files changed

+76
-22
lines changed

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
- Fix ignoring of "clientConfigDir" setting
44
### DeaDBeeF
55
- Provide universal .deb package to match `deadbeef-static_*.deb`
6-
- Fix deadlock with streamer
6+
- Fix deadlock with streamer code
7+
- Fix playOrPause command behavior under v1.10
78

89
# Changes in v0.10 (released 2025-02-28)
910
- Add ability to configure output device

ci/install.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ if "%BUILD_ARCH%" == "x64" (
1010

1111
cmd /c scripts\install\foobar2000.cmd v2.1-x64
1212
@if errorlevel 1 goto :end
13+
14+
cmd /c scripts\install\foobar2000.cmd v2.24-x64
15+
@if errorlevel 1 goto :end
1316
) else (
1417
cmd /c scripts\install\foobar2000.cmd v1.6
1518
@if errorlevel 1 goto :end
@@ -19,6 +22,9 @@ if "%BUILD_ARCH%" == "x64" (
1922

2023
cmd /c scripts\install\foobar2000.cmd v2.1
2124
@if errorlevel 1 goto :end
25+
26+
cmd /c scripts\install\foobar2000.cmd v2.24
27+
@if errorlevel 1 goto :end
2228
)
2329

2430
:end

ci/install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -e
44

55
function main
66
{
7-
scripts/install/deadbeef.sh v1.8
8-
scripts/install/deadbeef.sh v1.9
7+
cd scripts/install
8+
9+
./deadbeef.sh v1.8
10+
./deadbeef.sh v1.9
11+
./deadbeef.sh v1.10
912
}
1013

1114
source "$(dirname $0)/run_in_docker.sh"

ci/test.cmd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ set API_TEST_ERROR=0
2828
set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.1-x64
2929
cmd /c yarn test
3030
@if errorlevel 1 set API_TEST_ERROR=1
31+
32+
@echo.
33+
@echo === Running API tests on foobar2000 v2.24-x64 ===
34+
@echo.
35+
set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.24-x64
36+
cmd /c yarn test
37+
@if errorlevel 1 set API_TEST_ERROR=1
3138
) else (
3239
@echo.
3340
@echo === Running API tests on foobar2000 v1.6 ===
@@ -49,6 +56,13 @@ set API_TEST_ERROR=0
4956
set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.1
5057
cmd /c yarn test
5158
@if errorlevel 1 set API_TEST_ERROR=1
59+
60+
@echo.
61+
@echo === Running API tests on foobar2000 v2.24 ===
62+
@echo.
63+
set BEEFWEB_TEST_FOOBAR2000_VERSION=v2.24
64+
cmd /c yarn test
65+
@if errorlevel 1 set API_TEST_ERROR=1
5266
)
5367

5468
@popd

ci/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function main
3535
run_server_tests
3636
run_api_tests v1.8
3737
run_api_tests v1.9
38+
run_api_tests v1.10
3839
}
3940

4041
source "$(dirname $0)/run_in_docker.sh"

cpp/server/deadbeef/player.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,17 @@ class PlayerImpl final : public Player
134134
bool playNextBy(const std::string& expression, PlaylistItemSelector selector);
135135
PlaylistInfo getPlaylistInfo(ddb_playlist_t* playlist, int index, bool isCurrent);
136136

137+
bool isStopped()
138+
{
139+
if (ddbApi->get_output()->state() == OUTPUT_STATE_STOPPED)
140+
{
141+
PlaylistItemPtr activeItem(ddbApi->streamer_get_playing_track());
142+
return !activeItem;
143+
}
144+
145+
return false;
146+
}
147+
137148
PlaylistMutex playlistMutex_;
138149
ConfigMutex configMutex_;
139150
PlaylistMapping playlists_;

cpp/server/deadbeef/player_control.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,23 @@ void PlayerImpl::pause()
211211
ddbApi->sendmessage(DB_EV_PAUSE, 0, 0, 0);
212212
}
213213

214+
// DeaDBeeF behavior:
215+
// < v1.10: DB_EV_TOGGLE_PAUSE acts like playOrPause
216+
// >= v1.10: DB_EV_TOGGLE_PAUSE acts like togglePause
217+
// Check playback state manually to support all versions
218+
214219
void PlayerImpl::togglePause()
215220
{
216-
if (ddbApi->get_output()->state() == OUTPUT_STATE_STOPPED)
217-
{
218-
PlaylistItemPtr activeItem(ddbApi->streamer_get_playing_track());
219-
220-
if (!activeItem)
221-
return;
222-
}
223-
224-
ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0);
221+
if (!isStopped())
222+
ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0);
225223
}
226224

227225
void PlayerImpl::playOrPause()
228226
{
229-
ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0);
227+
if (isStopped())
228+
ddbApi->sendmessage(DB_EV_PLAY_CURRENT, 0, 0, 0);
229+
else
230+
ddbApi->sendmessage(DB_EV_TOGGLE_PAUSE, 0, 0, 0);
230231
}
231232

232233
void PlayerImpl::setMuted(Switch value)

docs/building.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Alternatively you can build from console:
8484

8585
And create package:
8686
```
87-
> cpack
87+
> cpack -C Release
8888
```
8989

9090
`foo_beefweb-*.zip` will be created in `build\Release` directory.
@@ -150,10 +150,12 @@ This command supports `--env buildType` and `--env outputDir` with the same defa
150150

151151
Full build needs to be performed before running API tests.
152152

153-
Additionally player binaries have to be installed:
153+
`curl` should be available in `PATH`.
154+
155+
Additionally player binaries should be installed:
154156

155157
```
156-
> scripts\install\foobar2000.cmd v2.1-x64
158+
> scripts\install\foobar2000.cmd v2.24-x64
157159
```
158160

159161
or
@@ -173,7 +175,7 @@ This command supports various parameters via environment variables:
173175

174176
`BEEFWEB_TEST_BUILD_TYPE` - which build type to use (defaults to `Debug`)
175177

176-
`BEEFWEB_TEST_FOOBAR2000_VERSION` - foobar2000 version to use (defaults to `v2.1-x64`)
178+
`BEEFWEB_TEST_FOOBAR2000_VERSION` - foobar2000 version to use (defaults to `v2.24-x64`)
177179

178180
`BEEFWEB_TEST_DEADBEEF_VERSION` - DeaDBeeF version to use (defaults to `v1.9`)
179181

js/api_tests/src/foobar2000/test_context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class Foobar2000TestContextFactory extends TestContextFactory
1111
config.playerId = 'foobar2000';
1212

1313
const { BEEFWEB_TEST_FOOBAR2000_VERSION } = process.env;
14-
config.playerVersion = BEEFWEB_TEST_FOOBAR2000_VERSION || 'v2.1-x64';
14+
config.playerVersion = BEEFWEB_TEST_FOOBAR2000_VERSION || 'v2.24-x64';
1515
config.playerDir = path.join(config.appsDir, 'foobar2000', config.playerVersion);
1616

1717
config.pluginBuildDir = path.join(

scripts/install/deadbeef.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ case "$version" in
1515
hash='aa17741053f63a7fceace003bf269bd4c4c9e55e42ee14286d9fbf34fbc8e014'
1616
;;
1717

18+
'v1.10')
19+
url='https://sourceforge.net/projects/deadbeef/files/travis/linux/1.10/deadbeef-static_1.10.0-rc1-1_x86_64.tar.bz2'
20+
hash='3226f09f4ee4e4fb3e3db79971402e55d9ae38dee0ca9e4761ba007e85f62764'
21+
;;
22+
1823
*)
1924
echo "usage: $(basename $0) <version>"
2025
exit 1

0 commit comments

Comments
 (0)