Fix compile error

This commit is contained in:
badaix 2020-05-05 23:18:24 +02:00
parent fc07aa83f6
commit 4e5e54fd4d
2 changed files with 7 additions and 7 deletions

View file

@ -61,7 +61,7 @@ std::unique_ptr<Player> Controller::createPlayer(ClientSettings::Player& setting
if (settings.player_name.empty() || settings.player_name == player_name) if (settings.player_name.empty() || settings.player_name == player_name)
{ {
settings.player_name = player_name; settings.player_name = player_name;
return make_unique<AlsaPlayer>(io_context_, settings, stream_); return make_unique<PlayerType>(io_context_, settings, stream_);
} }
return nullptr; return nullptr;
} }

View file

@ -26,8 +26,8 @@
#pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wmissing-braces"
#include <boost/process/child.hpp>
#include <boost/process/args.hpp> #include <boost/process/args.hpp>
#include <boost/process/child.hpp>
#include <boost/process/exe.hpp> #include <boost/process/exe.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
@ -60,14 +60,14 @@ Player::Player(boost::asio::io_context& io_context, const ClientSettings::Player
break; break;
} }
auto coalesce = [](const std::string& value, const std::string& fallback = "<none>") { auto not_empty = [](const std::string& value) -> std::string {
if (!value.empty()) if (!value.empty())
return value; return value;
else else
return fallback; return "<none>";
}; };
LOG(INFO, LOG_TAG) << "Player name: " << coalesce(settings_.player_name) << ", device: " << coalesce(settings_.pcm_device.name) LOG(INFO, LOG_TAG) << "Player name: " << not_empty(settings_.player_name) << ", device: " << not_empty(settings_.pcm_device.name)
<< ", description: " << coalesce(settings_.pcm_device.description) << ", idx: " << settings_.pcm_device.idx << ", description: " << not_empty(settings_.pcm_device.description) << ", idx: " << settings_.pcm_device.idx
<< ", sharing mode: " << sharing_mode << "\n"; << ", sharing mode: " << sharing_mode << "\n";
string mixer; string mixer;
@ -86,7 +86,7 @@ Player::Player(boost::asio::io_context& io_context, const ClientSettings::Player
mixer = "none"; mixer = "none";
break; break;
} }
LOG(INFO, LOG_TAG) << "Mixer mode: " << mixer << ", parameters: " << coalesce(settings_.mixer.parameter) << "\n"; LOG(INFO, LOG_TAG) << "Mixer mode: " << mixer << ", parameters: " << not_empty(settings_.mixer.parameter) << "\n";
LOG(INFO, LOG_TAG) << "Sampleformat: " << (settings_.sample_format.isInitialized() ? settings_.sample_format.toString() : stream->getFormat().toString()) LOG(INFO, LOG_TAG) << "Sampleformat: " << (settings_.sample_format.isInitialized() ? settings_.sample_format.toString() : stream->getFormat().toString())
<< ", stream: " << stream->getFormat().toString() << "\n"; << ", stream: " << stream->getFormat().toString() << "\n";
} }