renamed command line parameters

This commit is contained in:
badaix 2016-01-24 15:12:27 +01:00
parent a9015edb22
commit f89ae0d501
5 changed files with 31 additions and 25 deletions

View file

@ -159,9 +159,9 @@ void Controller::worker()
else if (headerChunk->codec == "flac") else if (headerChunk->codec == "flac")
decoder_ = new FlacDecoder(); decoder_ = new FlacDecoder();
sampleFormat_ = decoder_->setHeader(headerChunk.get()); sampleFormat_ = decoder_->setHeader(headerChunk.get());
logO << "sample rate : " << sampleFormat_.rate << "Hz\n"; logO << "sample rate: " << sampleFormat_.rate << "Hz\n";
logO << "bits per sample: " << sampleFormat_.bits << "\n"; logO << "bits/sample: " << sampleFormat_.bits << "\n";
logO << "channels : " << sampleFormat_.channels << "\n"; logO << "channels : " << sampleFormat_.channels << "\n";
msg::Request timeReq(kTime); msg::Request timeReq(kTime);
for (size_t n=0; n<50 && active_; ++n) for (size_t n=0; n<50 && active_; ++n)

View file

@ -2,12 +2,16 @@ snapserver (0.5.0-beta-1) unstable; urgency=low
* Features * Features
-Added .default file -Added .default file
-Remote control API -Remote control API (JSON)
-Android Snapclient with remote control -Android Snapclient with remote control
-PCM reader is configured by URI: path, name, codec, sample format, ...
* Bugfixes * Bugfixes
-TODO -TODO
* General * General
-TODO -SnapCast is renamed to Snapcast, SnapClient => Snapclient, SnapServer => Snapserver
-Snapcast protocol:
Less messaging: SampleFormat, Command, Ack, String
-Removed dependency to boost
-- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200 -- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200

View file

@ -49,28 +49,30 @@ int main(int argc, char* argv[])
std::string pcmStream = "pipe:///tmp/snapfifo?name=default"; std::string pcmStream = "pipe:///tmp/snapfifo?name=default";
int processPriority(-3); int processPriority(-3);
Switch helpSwitch("h", "help", "produce help message"); Switch helpSwitch("h", "help", "Produce help message");
Switch versionSwitch("v", "version", "show version number"); Switch versionSwitch("v", "version", "Show version number");
Value<size_t> portValue("p", "port", "server port", settings.port, &settings.port); Value<size_t> portValue("p", "port", "Server port", settings.port, &settings.port);
Value<size_t> controlPortValue("", "controlPort", "Remote control port", settings.controlPort, &settings.controlPort); Value<size_t> controlPortValue("", "controlPort", "Remote control port", settings.controlPort, &settings.controlPort);
Value<string> sampleFormatValue("s", "sampleformat", "sample format", settings.sampleFormat); Value<string> streamValue("s", "stream", "URI of the PCM input stream.\nFormat: TYPE://host/path?name=NAME\n[&codec=CODEC]\n[&sampleformat=SAMPLEFORMAT]", pcmStream, &pcmStream);
Value<string> codecValue("c", "codec", "transport codec [flac|ogg|pcm][:options]\nType codec:? to get codec specific options", settings.codec, &settings.codec);
Value<string> fifoValue("f", "fifo", "name of the input fifo file", pcmStream, &pcmStream); Value<string> sampleFormatValue("", "sampleformat", "Default sample format", settings.sampleFormat);
Implicit<int> daemonOption("d", "daemon", "daemonize\noptional process priority [-20..19]", 0, &processPriority); Value<string> codecValue("", "codec", "Default transport codec\n(flac|ogg|pcm)[:options]\nType codec:? to get codec specific options", settings.codec, &settings.codec);
Value<int> bufferValue("b", "buffer", "buffer [ms]", settings.bufferMs, &settings.bufferMs); Value<size_t> streamBufferValue("", "streamBuffer", "Default stream read buffer [ms]", settings.streamReadMs, &settings.streamReadMs);
Value<size_t> pipeBufferValue("", "pipeReadBuffer", "pipe read buffer [ms]", settings.pipeReadMs, &settings.pipeReadMs);
Value<int> bufferValue("b", "buffer", "Buffer [ms]", settings.bufferMs, &settings.bufferMs);
Implicit<int> daemonOption("d", "daemon", "Daemonize\noptional process priority [-20..19]", 0, &processPriority);
OptionParser op("Allowed options"); OptionParser op("Allowed options");
op.add(helpSwitch) op.add(helpSwitch)
.add(versionSwitch) .add(versionSwitch)
.add(portValue) .add(portValue)
.add(controlPortValue) .add(controlPortValue)
.add(streamValue)
.add(sampleFormatValue) .add(sampleFormatValue)
.add(codecValue) .add(codecValue)
.add(fifoValue) .add(streamBufferValue)
.add(daemonOption)
.add(bufferValue) .add(bufferValue)
.add(pipeBufferValue); .add(daemonOption);
try try
{ {
@ -100,13 +102,13 @@ int main(int argc, char* argv[])
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
if (!fifoValue.isSet()) if (!streamValue.isSet())
settings.pcmStreams.push_back(fifoValue.getValue()); settings.pcmStreams.push_back(streamValue.getValue());
for (size_t n=0; n<fifoValue.count(); ++n) for (size_t n=0; n<streamValue.count(); ++n)
{ {
cout << fifoValue.getValue(n) << "\n"; cout << streamValue.getValue(n) << "\n";
settings.pcmStreams.push_back(fifoValue.getValue(n)); settings.pcmStreams.push_back(streamValue.getValue(n));
} }
if (settings.codec.find(":?") != string::npos) if (settings.codec.find(":?") != string::npos)

View file

@ -343,7 +343,7 @@ void StreamServer::start()
for (auto& streamUri: settings_.pcmStreams) for (auto& streamUri: settings_.pcmStreams)
{ {
shared_ptr<PcmReader> reader(PcmReaderFactory::createPcmReader(this, streamUri, settings_.sampleFormat, settings_.codec, settings_.pipeReadMs)); shared_ptr<PcmReader> reader(PcmReaderFactory::createPcmReader(this, streamUri, settings_.sampleFormat, settings_.codec, settings_.streamReadMs));
pcmReader_.push_back(reader); pcmReader_.push_back(reader);
pcmReader_.back()->start(); pcmReader_.back()->start();
} }

View file

@ -49,7 +49,7 @@ struct StreamServerSettings
codec("flac"), codec("flac"),
bufferMs(1000), bufferMs(1000),
sampleFormat("48000:16:2"), sampleFormat("48000:16:2"),
pipeReadMs(20) streamReadMs(20)
{ {
} }
size_t port; size_t port;
@ -58,7 +58,7 @@ struct StreamServerSettings
std::string codec; std::string codec;
int32_t bufferMs; int32_t bufferMs;
std::string sampleFormat; std::string sampleFormat;
size_t pipeReadMs; size_t streamReadMs;
}; };