mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 15:46:42 +02:00
Rename stream.stream to stream.source
This commit is contained in:
parent
db17f1b986
commit
0f91bb1935
4 changed files with 24 additions and 16 deletions
|
@ -102,7 +102,7 @@ doc_root = /usr/share/snapserver/snapweb
|
||||||
# which port the server should listen to
|
# which port the server should listen to
|
||||||
#port = 1704
|
#port = 1704
|
||||||
|
|
||||||
# stream URI of the PCM input stream, can be configured multiple times
|
# source URI of the PCM input stream, can be configured multiple times
|
||||||
# The following notation is used in this paragraph:
|
# The following notation is used in this paragraph:
|
||||||
# <angle brackets>: the whole expression must be replaced with your specific setting
|
# <angle brackets>: the whole expression must be replaced with your specific setting
|
||||||
# [square brackets]: the whole expression is optional and can be left out
|
# [square brackets]: the whole expression is optional and can be left out
|
||||||
|
@ -110,9 +110,9 @@ doc_root = /usr/share/snapserver/snapweb
|
||||||
#
|
#
|
||||||
# Format: TYPE://host/path?name=<name>[&codec=<codec>][&sampleformat=<sampleformat>][&chunk_ms=<chunk ms>]
|
# Format: TYPE://host/path?name=<name>[&codec=<codec>][&sampleformat=<sampleformat>][&chunk_ms=<chunk ms>]
|
||||||
# parameters have the form "key=value", they are concatenated with an "&" character
|
# parameters have the form "key=value", they are concatenated with an "&" character
|
||||||
# parameter "name" is mandatory for all streams, while codec, sampleformat and chunk_ms are optional
|
# parameter "name" is mandatory for all sources, while codec, sampleformat and chunk_ms are optional
|
||||||
# and will override the default codec, sampleformat or chunk_ms settings
|
# and will override the default codec, sampleformat or chunk_ms settings
|
||||||
# Non blocking streams support the dryout_ms parameter: when no new data is read from the stream, send silence to the clients
|
# Non blocking sources support the dryout_ms parameter: when no new data is read from the source, send silence to the clients
|
||||||
# Available types are:
|
# Available types are:
|
||||||
# pipe: pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000], mode can be "create" or "read"
|
# pipe: pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000], mode can be "create" or "read"
|
||||||
# librespot: librespot:///<path/to/librespot>?name=<name>[&dryout_ms=2000][&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false][&autoplay=false]
|
# librespot: librespot:///<path/to/librespot>?name=<name>[&dryout_ms=2000][&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false][&autoplay=false]
|
||||||
|
@ -125,8 +125,9 @@ doc_root = /usr/share/snapserver/snapweb
|
||||||
# sampleformat will be set to "44100:16:2"
|
# sampleformat will be set to "44100:16:2"
|
||||||
# tcp server: tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]
|
# tcp server: tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]
|
||||||
# tcp client: tcp://<server IP, e.g. 127.0.0.1>:<port>?name=<name>&mode=client
|
# tcp client: tcp://<server IP, e.g. 127.0.0.1>:<port>?name=<name>&mode=client
|
||||||
stream = pipe:///tmp/snapfifo?name=default
|
# alsa: alsa://?name=<name>&device=<alsa device>
|
||||||
#stream = tcp://127.0.0.1?name=mopidy_tcp
|
source = pipe:///tmp/snapfifo?name=default
|
||||||
|
#source = tcp://127.0.0.1?name=mopidy_tcp
|
||||||
|
|
||||||
# Default sample format
|
# Default sample format
|
||||||
#sampleformat = 48000:16:2
|
#sampleformat = 48000:16:2
|
||||||
|
@ -136,7 +137,7 @@ stream = pipe:///tmp/snapfifo?name=default
|
||||||
# Type codec:? to get codec specific options
|
# Type codec:? to get codec specific options
|
||||||
#codec = flac
|
#codec = flac
|
||||||
|
|
||||||
# Default stream read chunk size [ms]
|
# Default source stream read chunk size [ms]
|
||||||
#chunk_ms = 20
|
#chunk_ms = 20
|
||||||
|
|
||||||
# Buffer [ms]
|
# Buffer [ms]
|
||||||
|
|
|
@ -692,9 +692,9 @@ void Server::start()
|
||||||
streamManager_ =
|
streamManager_ =
|
||||||
std::make_unique<StreamManager>(this, io_context_, settings_.stream.sampleFormat, settings_.stream.codec, settings_.stream.streamChunkMs);
|
std::make_unique<StreamManager>(this, io_context_, settings_.stream.sampleFormat, settings_.stream.codec, settings_.stream.streamChunkMs);
|
||||||
// throw SnapException("xxx");
|
// throw SnapException("xxx");
|
||||||
for (const auto& streamUri : settings_.stream.pcmStreams)
|
for (const auto& sourceUri : settings_.stream.sources)
|
||||||
{
|
{
|
||||||
PcmStreamPtr stream = streamManager_->addStream(streamUri);
|
PcmStreamPtr stream = streamManager_->addStream(sourceUri);
|
||||||
if (stream)
|
if (stream)
|
||||||
LOG(INFO, LOG_TAG) << "Stream: " << stream->getUri().toJson() << "\n";
|
LOG(INFO, LOG_TAG) << "Stream: " << stream->getUri().toJson() << "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct ServerSettings
|
||||||
struct Stream
|
struct Stream
|
||||||
{
|
{
|
||||||
size_t port{1704};
|
size_t port{1704};
|
||||||
std::vector<std::string> pcmStreams;
|
std::vector<std::string> sources;
|
||||||
std::string codec{"flac"};
|
std::string codec{"flac"};
|
||||||
int32_t bufferMs{1000};
|
int32_t bufferMs{1000};
|
||||||
std::string sampleFormat{"48000:16:2"};
|
std::string sampleFormat{"48000:16:2"};
|
||||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char* argv[])
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ServerSettings settings;
|
ServerSettings settings;
|
||||||
std::string pcmStream = "pipe:///tmp/snapfifo?name=default";
|
std::string pcmSource = "pipe:///tmp/snapfifo?name=default";
|
||||||
std::string config_file = "/etc/snapserver.conf";
|
std::string config_file = "/etc/snapserver.conf";
|
||||||
|
|
||||||
OptionParser op("Allowed options");
|
OptionParser op("Allowed options");
|
||||||
|
@ -92,9 +92,11 @@ int main(int argc, char* argv[])
|
||||||
auto stream_bind_to_address = conf.add<Value<string>>("", "stream.bind_to_address", "address for the server to listen on",
|
auto stream_bind_to_address = conf.add<Value<string>>("", "stream.bind_to_address", "address for the server to listen on",
|
||||||
settings.stream.bind_to_address.front(), &settings.stream.bind_to_address[0]);
|
settings.stream.bind_to_address.front(), &settings.stream.bind_to_address[0]);
|
||||||
conf.add<Value<size_t>>("", "stream.port", "which port the server should listen on", settings.stream.port, &settings.stream.port);
|
conf.add<Value<size_t>>("", "stream.port", "which port the server should listen on", settings.stream.port, &settings.stream.port);
|
||||||
auto streamValue = conf.add<Value<string>>(
|
// deprecated: stream.stream, use stream.source instead
|
||||||
"", "stream.stream", "URI of the PCM input stream.\nFormat: TYPE://host/path?name=NAME\n[&codec=CODEC]\n[&sampleformat=SAMPLEFORMAT]", pcmStream,
|
auto streamValue = conf.add<Value<string>>("", "stream.stream", "Deprecated: use stream.source", pcmSource, &pcmSource);
|
||||||
&pcmStream);
|
auto sourceValue = conf.add<Value<string>>(
|
||||||
|
"", "stream.source", "URI of the PCM input stream.\nFormat: TYPE://host/path?name=NAME\n[&codec=CODEC]\n[&sampleformat=SAMPLEFORMAT]", pcmSource,
|
||||||
|
&pcmSource);
|
||||||
|
|
||||||
conf.add<Value<string>>("", "stream.sampleformat", "Default sample format", settings.stream.sampleFormat, &settings.stream.sampleFormat);
|
conf.add<Value<string>>("", "stream.sampleformat", "Default sample format", settings.stream.sampleFormat, &settings.stream.sampleFormat);
|
||||||
conf.add<Value<string>>("", "stream.codec", "Default transport codec\n(flac|ogg|opus|pcm)[:options]\nType codec:? to get codec specific options",
|
conf.add<Value<string>>("", "stream.codec", "Default transport codec\n(flac|ogg|opus|pcm)[:options]\nType codec:? to get codec specific options",
|
||||||
|
@ -221,13 +223,18 @@ int main(int argc, char* argv[])
|
||||||
else
|
else
|
||||||
throw SnapException("Invalid log sink: " + settings.logging.sink);
|
throw SnapException("Invalid log sink: " + settings.logging.sink);
|
||||||
|
|
||||||
if (!streamValue->is_set())
|
if (!streamValue->is_set() && !sourceValue->is_set())
|
||||||
settings.stream.pcmStreams.push_back(streamValue->value());
|
settings.stream.sources.push_back(sourceValue->value());
|
||||||
|
|
||||||
for (size_t n = 0; n < streamValue->count(); ++n)
|
for (size_t n = 0; n < streamValue->count(); ++n)
|
||||||
{
|
{
|
||||||
LOG(INFO) << "Adding stream: " << streamValue->value(n) << "\n";
|
LOG(INFO) << "Adding stream: " << streamValue->value(n) << "\n";
|
||||||
settings.stream.pcmStreams.push_back(streamValue->value(n));
|
settings.stream.sources.push_back(streamValue->value(n));
|
||||||
|
}
|
||||||
|
for (size_t n = 0; n < sourceValue->count(); ++n)
|
||||||
|
{
|
||||||
|
LOG(INFO) << "Adding source: " << sourceValue->value(n) << "\n";
|
||||||
|
settings.stream.sources.push_back(sourceValue->value(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_DAEMON
|
#ifdef HAS_DAEMON
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue