diff options
Diffstat (limited to 'src/command/PlayerCommands.cxx')
-rw-r--r-- | src/command/PlayerCommands.cxx | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx index 12c71dfd4..f167b0edb 100644 --- a/src/command/PlayerCommands.cxx +++ b/src/command/PlayerCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,18 +20,21 @@ #include "config.h" #include "PlayerCommands.hxx" #include "CommandError.hxx" -#include "Playlist.hxx" +#include "queue/Playlist.hxx" #include "PlaylistPrint.hxx" -#include "UpdateGlue.hxx" -#include "Client.hxx" -#include "Volume.hxx" -#include "OutputAll.hxx" +#include "client/Client.hxx" +#include "mixer/Volume.hxx" #include "Partition.hxx" +#include "Instance.hxx" #include "protocol/Result.hxx" #include "protocol/ArgParser.hxx" #include "AudioFormat.hxx" #include "ReplayGainConfig.hxx" +#ifdef ENABLE_DATABASE +#include "db/update/Service.hxx" +#endif + #define COMMAND_STATUS_STATE "state" #define COMMAND_STATUS_REPEAT "repeat" #define COMMAND_STATUS_SINGLE "single" @@ -53,7 +56,7 @@ #define COMMAND_STATUS_UPDATING_DB "updating_db" CommandResult -handle_play(Client &client, int argc, char *argv[]) +handle_play(Client &client, unsigned argc, char *argv[]) { int song = -1; @@ -64,7 +67,7 @@ handle_play(Client &client, int argc, char *argv[]) } CommandResult -handle_playid(Client &client, int argc, char *argv[]) +handle_playid(Client &client, unsigned argc, char *argv[]) { int id = -1; @@ -77,7 +80,7 @@ handle_playid(Client &client, int argc, char *argv[]) CommandResult handle_stop(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { client.partition.Stop(); return CommandResult::OK; @@ -85,7 +88,7 @@ handle_stop(Client &client, CommandResult handle_currentsong(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { playlist_print_current(client, client.playlist); return CommandResult::OK; @@ -93,7 +96,7 @@ handle_currentsong(Client &client, CommandResult handle_pause(Client &client, - int argc, char *argv[]) + unsigned argc, char *argv[]) { if (argc == 2) { bool pause_flag; @@ -109,10 +112,9 @@ handle_pause(Client &client, CommandResult handle_status(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { const char *state = nullptr; - int updateJobId; int song; const auto player_status = client.player_control.GetStatus(); @@ -140,7 +142,7 @@ handle_status(Client &client, COMMAND_STATUS_PLAYLIST_LENGTH ": %i\n" COMMAND_STATUS_MIXRAMPDB ": %f\n" COMMAND_STATUS_STATE ": %s\n", - volume_level_get(), + volume_level_get(client.partition.outputs), playlist.GetRepeat(), playlist.GetRandom(), playlist.GetSingle(), @@ -188,11 +190,17 @@ handle_status(Client &client, } } - if ((updateJobId = isUpdatingDB())) { +#ifdef ENABLE_DATABASE + const UpdateService *update_service = client.partition.instance.update; + unsigned updateJobId = update_service != nullptr + ? update_service->GetId() + : 0; + if (updateJobId != 0) { client_printf(client, COMMAND_STATUS_UPDATING_DB ": %i\n", updateJobId); } +#endif Error error = client.player_control.LockGetError(); if (error.IsDefined()) @@ -213,7 +221,7 @@ handle_status(Client &client, CommandResult handle_next(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { playlist &playlist = client.playlist; @@ -230,14 +238,14 @@ handle_next(Client &client, CommandResult handle_previous(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { client.partition.PlayPrevious(); return CommandResult::OK; } CommandResult -handle_repeat(Client &client, gcc_unused int argc, char *argv[]) +handle_repeat(Client &client, gcc_unused unsigned argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -248,7 +256,7 @@ handle_repeat(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_single(Client &client, gcc_unused int argc, char *argv[]) +handle_single(Client &client, gcc_unused unsigned argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -259,7 +267,7 @@ handle_single(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_consume(Client &client, gcc_unused int argc, char *argv[]) +handle_consume(Client &client, gcc_unused unsigned argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -270,27 +278,27 @@ handle_consume(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_random(Client &client, gcc_unused int argc, char *argv[]) +handle_random(Client &client, gcc_unused unsigned argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) return CommandResult::ERROR; client.partition.SetRandom(status); - audio_output_all_set_replay_gain_mode(replay_gain_get_real_mode(client.partition.GetRandom())); + client.partition.outputs.SetReplayGainMode(replay_gain_get_real_mode(client.partition.GetRandom())); return CommandResult::OK; } CommandResult handle_clearerror(gcc_unused Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { client.player_control.ClearError(); return CommandResult::OK; } CommandResult -handle_seek(Client &client, gcc_unused int argc, char *argv[]) +handle_seek(Client &client, gcc_unused unsigned argc, char *argv[]) { unsigned song, seek_time; @@ -305,7 +313,7 @@ handle_seek(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_seekid(Client &client, gcc_unused int argc, char *argv[]) +handle_seekid(Client &client, gcc_unused unsigned argc, char *argv[]) { unsigned id, seek_time; @@ -320,7 +328,7 @@ handle_seekid(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_seekcur(Client &client, gcc_unused int argc, char *argv[]) +handle_seekcur(Client &client, gcc_unused unsigned argc, char *argv[]) { const char *p = argv[1]; bool relative = *p == '+' || *p == '-'; @@ -334,7 +342,7 @@ handle_seekcur(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_crossfade(Client &client, gcc_unused int argc, char *argv[]) +handle_crossfade(Client &client, gcc_unused unsigned argc, char *argv[]) { unsigned xfade_time; @@ -346,7 +354,7 @@ handle_crossfade(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_mixrampdb(Client &client, gcc_unused int argc, char *argv[]) +handle_mixrampdb(Client &client, gcc_unused unsigned argc, char *argv[]) { float db; @@ -358,7 +366,7 @@ handle_mixrampdb(Client &client, gcc_unused int argc, char *argv[]) } CommandResult -handle_mixrampdelay(Client &client, gcc_unused int argc, char *argv[]) +handle_mixrampdelay(Client &client, gcc_unused unsigned argc, char *argv[]) { float delay_secs; @@ -371,7 +379,7 @@ handle_mixrampdelay(Client &client, gcc_unused int argc, char *argv[]) CommandResult handle_replay_gain_mode(Client &client, - gcc_unused int argc, char *argv[]) + gcc_unused unsigned argc, char *argv[]) { if (!replay_gain_set_mode_string(argv[1])) { command_error(client, ACK_ERROR_ARG, @@ -379,14 +387,13 @@ handle_replay_gain_mode(Client &client, return CommandResult::ERROR; } - audio_output_all_set_replay_gain_mode(replay_gain_get_real_mode(client.playlist.queue.random)); - + client.partition.outputs.SetReplayGainMode(replay_gain_get_real_mode(client.playlist.queue.random)); return CommandResult::OK; } CommandResult handle_replay_gain_status(Client &client, - gcc_unused int argc, gcc_unused char *argv[]) + gcc_unused unsigned argc, gcc_unused char *argv[]) { client_printf(client, "replay_gain_mode: %s\n", replay_gain_get_mode_string()); |