Allow building server and client without FLAC support

Allows building the server and the client without FLAC support:

```
readelf -d ./bin/snapserver | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libjsonrpcpp.so]
 0x00000001 (NEEDED)                     Shared library: [libavahi-common.so.3]
 0x00000001 (NEEDED)                     Shared library: [libavahi-client.so.3]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so]
```

Note, that the current client and server Makefiles always enable FLAC
support.
This commit is contained in:
Jörg Krause 2017-03-15 13:11:23 +01:00 committed by badaix
parent a5ffa356fe
commit 9abeac8365
3 changed files with 13 additions and 5 deletions

View file

@ -20,11 +20,13 @@
#include <string>
#include <memory>
#include "controller.h"
#include "decoder/pcmDecoder.h"
#if defined(HAS_OGG) && (defined(HAS_TREMOR) || defined(HAS_VORBIS))
#include "decoder/oggDecoder.h"
#endif
#include "decoder/pcmDecoder.h"
#if defined(HAS_FLAC)
#include "decoder/flacDecoder.h"
#endif
#include "timeProvider.h"
#include "message/time.h"
#include "message/hello.h"
@ -110,8 +112,10 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
else if (headerChunk_->codec == "ogg")
decoder_.reset(new OggDecoder());
#endif
#if defined(HAS_FLAC)
else if (headerChunk_->codec == "flac")
decoder_.reset(new FlacDecoder());
#endif
else
throw SnapException("codec not supported: \"" + headerChunk_->codec + "\"");