Deprecate visualizer_fifo_path in favor of visualizer_data_source
This commit is contained in:
@@ -192,6 +192,8 @@ void Visualizer::update()
|
||||
if (new_samples == 0)
|
||||
return;
|
||||
|
||||
// A crude way to adjust the amount of samples consumed from the buffer
|
||||
// depending on how fast the rendering is.
|
||||
if (m_buffered_samples.size() > 0)
|
||||
{
|
||||
if (++m_sample_consumption_rate_up_ctr > 8)
|
||||
@@ -624,19 +626,21 @@ void Visualizer::GenLogspace()
|
||||
|
||||
void Visualizer::InitDataSource()
|
||||
{
|
||||
auto colon = Config.visualizer_fifo_path.rfind(':');
|
||||
if (Config.visualizer_fifo_path[0] != '/' && colon != std::string::npos)
|
||||
if (!Config.visualizer_fifo_path.empty())
|
||||
m_source_location = Config.visualizer_fifo_path; // deprecated
|
||||
else
|
||||
m_source_location = Config.visualizer_data_source;
|
||||
|
||||
// If there's a colon and a location doesn't start with '/' we have a UDP
|
||||
// sink. Otherwise assume it's a FIFO.
|
||||
auto colon = m_source_location.rfind(':');
|
||||
if (m_source_location[0] != '/' && colon != std::string::npos)
|
||||
{
|
||||
// UDP source
|
||||
m_source_location = Config.visualizer_fifo_path.substr(0, colon);
|
||||
m_source_port = Config.visualizer_fifo_path.substr(colon+1);
|
||||
m_source_port = m_source_location.substr(colon+1);
|
||||
m_source_location.resize(colon);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIFO source
|
||||
m_source_location = Config.visualizer_fifo_path;
|
||||
m_source_port.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Visualizer::InitVisualization()
|
||||
@@ -782,7 +786,7 @@ void Visualizer::OpenDataSource()
|
||||
m_source_fd = open(m_source_location.c_str(), O_RDONLY | O_NONBLOCK);
|
||||
if (m_source_fd < 0)
|
||||
Statusbar::printf("Couldn't open \"%1%\" for reading PCM data: %2%",
|
||||
Config.visualizer_fifo_path, strerror(errno));
|
||||
m_source_location, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,7 +800,9 @@ void Visualizer::CloseDataSource()
|
||||
void Visualizer::FindOutputID()
|
||||
{
|
||||
m_output_id = -1;
|
||||
if (!Config.visualizer_output_name.empty())
|
||||
// Look for the output only if its name is specified and we're fetching
|
||||
// samples from a FIFO.
|
||||
if (!Config.visualizer_output_name.empty() && m_source_port.empty())
|
||||
{
|
||||
for (MPD::OutputIterator out = Mpd.GetOutputs(), end; out != end; ++out)
|
||||
{
|
||||
|
||||
@@ -196,7 +196,8 @@ NC::Buffer buffer_wlength(const NC::Buffer *target,
|
||||
return *target;
|
||||
}
|
||||
|
||||
void deprecated(const char *option, double version_removal, const std::string &advice)
|
||||
void deprecated(const char *option, const char *version_removal,
|
||||
const std::string &advice)
|
||||
{
|
||||
std::cerr << "WARNING: Variable '" << option
|
||||
<< "' is deprecated and will be removed in "
|
||||
@@ -217,14 +218,14 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
if (!v.empty())
|
||||
deprecated(
|
||||
"visualizer_sample_multiplier",
|
||||
0.9,
|
||||
"0.9",
|
||||
"visualizer scales automatically");
|
||||
});
|
||||
p.add<void>("progressbar_boldness", nullptr, "", [](std::string v) {
|
||||
if (!v.empty())
|
||||
deprecated(
|
||||
"progressbar_boldness",
|
||||
0.9,
|
||||
"0.9",
|
||||
"use extended progressbar_color and progressbar_elapsed_color instead");
|
||||
});
|
||||
|
||||
@@ -243,7 +244,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
current_item_suffix_str);
|
||||
deprecated(
|
||||
"main_window_highlight_color",
|
||||
0.9,
|
||||
"0.9",
|
||||
"set current_item_prefix = \""
|
||||
+ current_item_prefix_str
|
||||
+ "\" and current_item_suffix = \""
|
||||
@@ -256,12 +257,22 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
{
|
||||
deprecated(
|
||||
"active_column_color",
|
||||
0.9,
|
||||
"0.9",
|
||||
"replaced by current_item_inactive_column_prefix"
|
||||
" and current_item_inactive_column_suffix");
|
||||
};
|
||||
});
|
||||
|
||||
p.add("visualizer_fifo_path", &visualizer_fifo_path, "", [](std::string v) {
|
||||
if (!v.empty())
|
||||
{
|
||||
deprecated("visualizer_fifo_path",
|
||||
"0.10",
|
||||
"replaced by visualizer_data_source");
|
||||
}
|
||||
return adjust_path(v);
|
||||
});
|
||||
|
||||
// keep the same order of variables as in configuration file
|
||||
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
|
||||
p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
|
||||
@@ -276,7 +287,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
p.add("mpd_connection_timeout", &mpd_connection_timeout, "5");
|
||||
p.add("mpd_crossfade_time", &crossfade_time, "5");
|
||||
p.add("random_exclude_pattern", &random_exclude_pattern, "");
|
||||
p.add("visualizer_fifo_path", &visualizer_fifo_path, "/tmp/mpd.fifo", adjust_path);
|
||||
p.add("visualizer_data_source", &visualizer_data_source, "/tmp/mpd.fifo", adjust_path);
|
||||
p.add("visualizer_output_name", &visualizer_output_name, "Visualizer feed");
|
||||
p.add("visualizer_in_stereo", &visualizer_in_stereo, "yes", yes_no);
|
||||
p.add("visualizer_sync_interval", &visualizer_sync_interval, "0",
|
||||
|
||||
@@ -61,7 +61,8 @@ struct Configuration
|
||||
std::string lyrics_directory;
|
||||
|
||||
std::string mpd_music_dir;
|
||||
std::string visualizer_fifo_path;
|
||||
std::string visualizer_fifo_path; // deprecated
|
||||
std::string visualizer_data_source;
|
||||
std::string visualizer_output_name;
|
||||
std::string empty_tag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user