mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-28 09:47:09 +02:00
Switch to C++17
This commit is contained in:
parent
3120a18326
commit
2cc9567847
11 changed files with 74 additions and 75 deletions
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
* This project loosely follows the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
|
* This project loosely follows the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
|
||||||
|
|
||||||
* For better compatibility with embedded toolchains, the used C++ standard should be limited to C++14
|
* For better compatibility with embedded toolchains, the used C++ standard should be limited to C++17
|
||||||
|
|
||||||
* Code should be formatted by running `make reformat`
|
* Code should be formatted by running `make reformat`
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ if(NOT ANDROID)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configure compiler options
|
# Configure compiler options
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
# Get arch
|
# Get arch
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/TargetArch.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/TargetArch.cmake)
|
||||||
|
|
|
@ -46,7 +46,7 @@ The following rule governs code contributions:
|
||||||
|
|
||||||
* This project loosely follows the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
|
* This project loosely follows the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
|
||||||
|
|
||||||
* For better compatibility with embedded toolchains, the used C++ standard should be limited to C++14
|
* For better compatibility with embedded toolchains, the used C++ standard should be limited to C++17
|
||||||
|
|
||||||
* Code should be formatted by running `make reformat`
|
* Code should be formatted by running `make reformat`
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ ifneq ($(SANITIZE), )
|
||||||
LDFLAGS += -fsanitize=$(SANITIZE)
|
LDFLAGS += -fsanitize=$(SANITIZE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += $(ADD_CFLAGS) -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-function -DBOOST_ERROR_CODE_HEADER_ONLY -DHAS_FLAC -DHAS_OGG -DHAS_OPUS -DHAS_SOXR -DVERSION=\"$(VERSION)\" -I. -I.. -I../common
|
CXXFLAGS += $(ADD_CFLAGS) -std=c++17 -Wall -Wextra -Wpedantic -Wno-unused-function -DBOOST_ERROR_CODE_HEADER_ONLY -DHAS_FLAC -DHAS_OGG -DHAS_OPUS -DHAS_SOXR -DVERSION=\"$(VERSION)\" -I. -I.. -I../common
|
||||||
LDFLAGS += $(ADD_LDFLAGS) -logg -lFLAC -lopus -lsoxr
|
LDFLAGS += $(ADD_LDFLAGS) -logg -lFLAC -lopus -lsoxr
|
||||||
OBJ = snapclient.o stream.o client_connection.o time_provider.o player/player.o player/file_player.o decoder/pcm_decoder.o decoder/ogg_decoder.o decoder/flac_decoder.o decoder/opus_decoder.o controller.o ../common/sample_format.o ../common/resampler.o
|
OBJ = snapclient.o stream.o client_connection.o time_provider.o player/player.o player/file_player.o decoder/pcm_decoder.o decoder/ogg_decoder.o decoder/flac_decoder.o decoder/opus_decoder.o controller.o ../common/sample_format.o ../common/resampler.o
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
|
||||||
namespace player
|
namespace player
|
||||||
|
@ -83,8 +83,8 @@ private:
|
||||||
std::recursive_mutex mutex_;
|
std::recursive_mutex mutex_;
|
||||||
boost::asio::steady_timer timer_;
|
boost::asio::steady_timer timer_;
|
||||||
|
|
||||||
boost::optional<std::chrono::microseconds> buffer_time_;
|
std::optional<std::chrono::microseconds> buffer_time_;
|
||||||
boost::optional<uint32_t> periods_;
|
std::optional<uint32_t> periods_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace player
|
} // namespace player
|
||||||
|
|
|
@ -136,7 +136,7 @@ vector<PcmDevice> PulsePlayer::pcm_list(const std::string& parameter)
|
||||||
|
|
||||||
PulsePlayer::PulsePlayer(boost::asio::io_context& io_context, const ClientSettings::Player& settings, std::shared_ptr<Stream> stream)
|
PulsePlayer::PulsePlayer(boost::asio::io_context& io_context, const ClientSettings::Player& settings, std::shared_ptr<Stream> stream)
|
||||||
: Player(io_context, settings, stream), latency_(BUFFER_TIME), pa_ml_(nullptr), pa_ctx_(nullptr), playstream_(nullptr), proplist_(nullptr),
|
: Player(io_context, settings, stream), latency_(BUFFER_TIME), pa_ml_(nullptr), pa_ctx_(nullptr), playstream_(nullptr), proplist_(nullptr),
|
||||||
server_(boost::none)
|
server_(std::nullopt)
|
||||||
{
|
{
|
||||||
auto params = utils::string::split_pairs_to_container<std::vector<std::string>>(settings.parameter, ',', '=');
|
auto params = utils::string::split_pairs_to_container<std::vector<std::string>>(settings.parameter, ',', '=');
|
||||||
if (params.find("buffer_time") != params.end())
|
if (params.find("buffer_time") != params.end())
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ protected:
|
||||||
pa_context* pa_ctx_;
|
pa_context* pa_ctx_;
|
||||||
pa_stream* playstream_;
|
pa_stream* playstream_;
|
||||||
pa_proplist* proplist_;
|
pa_proplist* proplist_;
|
||||||
boost::optional<std::string> server_;
|
std::optional<std::string> server_;
|
||||||
std::map<std::string, std::string> properties_;
|
std::map<std::string, std::string> properties_;
|
||||||
|
|
||||||
// cache of the last volume change
|
// cache of the last volume change
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef METATAGS_HPP
|
#ifndef METATAGS_HPP
|
||||||
#define METATAGS_HPP
|
#define METATAGS_HPP
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -41,92 +41,92 @@ public:
|
||||||
|
|
||||||
/// https://www.musicpd.org/doc/html/protocol.html#tags
|
/// https://www.musicpd.org/doc/html/protocol.html#tags
|
||||||
/// the duration of the song
|
/// the duration of the song
|
||||||
boost::optional<float> duration;
|
std::optional<float> duration;
|
||||||
/// the artist name. Its meaning is not well-defined; see “composer” and “performer” for more specific tags.
|
/// the artist name. Its meaning is not well-defined; see “composer” and “performer” for more specific tags.
|
||||||
boost::optional<std::vector<std::string>> artist;
|
std::optional<std::vector<std::string>> artist;
|
||||||
/// same as artist, but for sorting. This usually omits prefixes such as “The”.
|
/// same as artist, but for sorting. This usually omits prefixes such as “The”.
|
||||||
boost::optional<std::vector<std::string>> artist_sort;
|
std::optional<std::vector<std::string>> artist_sort;
|
||||||
/// the album name.
|
/// the album name.
|
||||||
boost::optional<std::string> album;
|
std::optional<std::string> album;
|
||||||
/// same as album, but for sorting.
|
/// same as album, but for sorting.
|
||||||
boost::optional<std::string> album_sort;
|
std::optional<std::string> album_sort;
|
||||||
/// on multi-artist albums, this is the artist name which shall be used for the whole album. The exact meaning of this tag is not well-defined.
|
/// on multi-artist albums, this is the artist name which shall be used for the whole album. The exact meaning of this tag is not well-defined.
|
||||||
boost::optional<std::vector<std::string>> album_artist;
|
std::optional<std::vector<std::string>> album_artist;
|
||||||
/// same as albumartist, but for sorting.
|
/// same as albumartist, but for sorting.
|
||||||
boost::optional<std::vector<std::string>> album_artist_sort;
|
std::optional<std::vector<std::string>> album_artist_sort;
|
||||||
/// a name for this song. This is not the song title. The exact meaning of this tag is not well-defined. It is often used by badly configured internet radio
|
/// a name for this song. This is not the song title. The exact meaning of this tag is not well-defined. It is often used by badly configured internet radio
|
||||||
/// stations with broken tags to squeeze both the artist name and the song title in one tag.
|
/// stations with broken tags to squeeze both the artist name and the song title in one tag.
|
||||||
boost::optional<std::string> name;
|
std::optional<std::string> name;
|
||||||
/// the song’s release date. This is usually a 4-digit year.
|
/// the song’s release date. This is usually a 4-digit year.
|
||||||
boost::optional<std::string> date;
|
std::optional<std::string> date;
|
||||||
/// the song’s original release date.
|
/// the song’s original release date.
|
||||||
boost::optional<std::string> original_date;
|
std::optional<std::string> original_date;
|
||||||
/// the artist who performed the song.
|
/// the artist who performed the song.
|
||||||
boost::optional<std::string> performer;
|
std::optional<std::string> performer;
|
||||||
/// the conductor who conducted the song.
|
/// the conductor who conducted the song.
|
||||||
boost::optional<std::string> conductor;
|
std::optional<std::string> conductor;
|
||||||
/// “a work is a distinct intellectual or artistic creation, which can be expressed in the form of one or more audio recordings”
|
/// “a work is a distinct intellectual or artistic creation, which can be expressed in the form of one or more audio recordings”
|
||||||
boost::optional<std::string> work;
|
std::optional<std::string> work;
|
||||||
/// “used if the sound belongs to a larger category of sounds/music” (from the IDv2.4.0 TIT1 description).
|
/// “used if the sound belongs to a larger category of sounds/music” (from the IDv2.4.0 TIT1 description).
|
||||||
boost::optional<std::string> grouping;
|
std::optional<std::string> grouping;
|
||||||
/// the name of the label or publisher.
|
/// the name of the label or publisher.
|
||||||
boost::optional<std::string> label;
|
std::optional<std::string> label;
|
||||||
/// the artist id in the MusicBrainz database.
|
/// the artist id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_artist_id;
|
std::optional<std::string> musicbrainz_artist_id;
|
||||||
/// the album id in the MusicBrainz database.
|
/// the album id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_album_id;
|
std::optional<std::string> musicbrainz_album_id;
|
||||||
/// the album artist id in the MusicBrainz database.
|
/// the album artist id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_album_artist_id;
|
std::optional<std::string> musicbrainz_album_artist_id;
|
||||||
/// the track id in the MusicBrainz database.
|
/// the track id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_track_id;
|
std::optional<std::string> musicbrainz_track_id;
|
||||||
/// the release track id in the MusicBrainz database.
|
/// the release track id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_release_track_id;
|
std::optional<std::string> musicbrainz_release_track_id;
|
||||||
/// the work id in the MusicBrainz database.
|
/// the work id in the MusicBrainz database.
|
||||||
boost::optional<std::string> musicbrainz_work_id;
|
std::optional<std::string> musicbrainz_work_id;
|
||||||
|
|
||||||
/// https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/
|
/// https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/
|
||||||
/// A unique identity for this track within the context of an MPRIS object (eg: tracklist).
|
/// A unique identity for this track within the context of an MPRIS object (eg: tracklist).
|
||||||
boost::optional<std::string> track_id;
|
std::optional<std::string> track_id;
|
||||||
/// URI: The location of an image representing the track or album. Clients should not assume this will continue to exist when the media player stops giving
|
/// URI: The location of an image representing the track or album. Clients should not assume this will continue to exist when the media player stops giving
|
||||||
/// out the URL
|
/// out the URL
|
||||||
boost::optional<std::string> art_url;
|
std::optional<std::string> art_url;
|
||||||
/// The track lyrics
|
/// The track lyrics
|
||||||
boost::optional<std::string> lyrics;
|
std::optional<std::string> lyrics;
|
||||||
/// The speed of the music, in beats per minute
|
/// The speed of the music, in beats per minute
|
||||||
boost::optional<uint16_t> bpm;
|
std::optional<uint16_t> bpm;
|
||||||
/// Float: An automatically-generated rating, based on things such as how often it has been played. This should be in the range 0.0 to 1.0
|
/// Float: An automatically-generated rating, based on things such as how often it has been played. This should be in the range 0.0 to 1.0
|
||||||
boost::optional<float> auto_rating;
|
std::optional<float> auto_rating;
|
||||||
/// A (list of) freeform comment(s)
|
/// A (list of) freeform comment(s)
|
||||||
boost::optional<std::vector<std::string>> comment;
|
std::optional<std::vector<std::string>> comment;
|
||||||
/// The composer(s) of the track
|
/// The composer(s) of the track
|
||||||
boost::optional<std::vector<std::string>> composer;
|
std::optional<std::vector<std::string>> composer;
|
||||||
/// Date/Time: When the track was created. Usually only the year component will be useful
|
/// Date/Time: When the track was created. Usually only the year component will be useful
|
||||||
boost::optional<std::string> content_created;
|
std::optional<std::string> content_created;
|
||||||
/// Integer: The disc number on the album that this track is from
|
/// Integer: The disc number on the album that this track is from
|
||||||
boost::optional<uint16_t> disc_number;
|
std::optional<uint16_t> disc_number;
|
||||||
/// Date/Time: When the track was first played
|
/// Date/Time: When the track was first played
|
||||||
boost::optional<std::string> first_used;
|
std::optional<std::string> first_used;
|
||||||
/// List of Strings: The genre(s) of the track
|
/// List of Strings: The genre(s) of the track
|
||||||
boost::optional<std::vector<std::string>> genre;
|
std::optional<std::vector<std::string>> genre;
|
||||||
/// Date/Time: When the track was last played
|
/// Date/Time: When the track was last played
|
||||||
boost::optional<std::string> last_used;
|
std::optional<std::string> last_used;
|
||||||
/// List of Strings: The lyricist(s) of the track
|
/// List of Strings: The lyricist(s) of the track
|
||||||
boost::optional<std::vector<std::string>> lyricist;
|
std::optional<std::vector<std::string>> lyricist;
|
||||||
/// String: The track title
|
/// String: The track title
|
||||||
boost::optional<std::string> title;
|
std::optional<std::string> title;
|
||||||
/// Integer: The track number on the album disc
|
/// Integer: The track number on the album disc
|
||||||
boost::optional<uint16_t> track_number;
|
std::optional<uint16_t> track_number;
|
||||||
/// URI: The location of the media file.
|
/// URI: The location of the media file.
|
||||||
boost::optional<std::string> url;
|
std::optional<std::string> url;
|
||||||
/// Integer: The number of times the track has been played.
|
/// Integer: The number of times the track has been played.
|
||||||
boost::optional<uint16_t> use_count;
|
std::optional<uint16_t> use_count;
|
||||||
/// Float: A user-specified rating. This should be in the range 0.0 to 1.0.
|
/// Float: A user-specified rating. This should be in the range 0.0 to 1.0.
|
||||||
boost::optional<float> user_rating;
|
std::optional<float> user_rating;
|
||||||
|
|
||||||
/// Spotify artist id
|
/// Spotify artist id
|
||||||
boost::optional<std::string> spotify_artist_id;
|
std::optional<std::string> spotify_artist_id;
|
||||||
/// Spotify track id
|
/// Spotify track id
|
||||||
boost::optional<std::string> spotify_track_id;
|
std::optional<std::string> spotify_track_id;
|
||||||
|
|
||||||
json toJson() const
|
json toJson() const
|
||||||
{
|
{
|
||||||
|
@ -275,12 +275,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void readTag(const json& j, const std::string& tag, boost::optional<T>& dest) const
|
void readTag(const json& j, const std::string& tag, std::optional<T>& dest) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!j.contains(tag))
|
if (!j.contains(tag))
|
||||||
dest = boost::none;
|
dest = std::nullopt;
|
||||||
else
|
else
|
||||||
dest = j[tag].get<T>();
|
dest = j[tag].get<T>();
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void addTag(json& j, const std::string& tag, const boost::optional<T>& source) const
|
void addTag(json& j, const std::string& tag, const std::optional<T>& source) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
#include "common/aixlog.hpp"
|
#include "common/aixlog.hpp"
|
||||||
#include "common/json.hpp"
|
#include "common/json.hpp"
|
||||||
|
@ -154,22 +154,22 @@ public:
|
||||||
|
|
||||||
/// https://www.musicpd.org/doc/html/protocol.html#tags
|
/// https://www.musicpd.org/doc/html/protocol.html#tags
|
||||||
/// The current playback status
|
/// The current playback status
|
||||||
boost::optional<PlaybackStatus> playback_status;
|
std::optional<PlaybackStatus> playback_status;
|
||||||
/// The current loop / repeat status
|
/// The current loop / repeat status
|
||||||
boost::optional<LoopStatus> loop_status;
|
std::optional<LoopStatus> loop_status;
|
||||||
/// The current playback rate
|
/// The current playback rate
|
||||||
boost::optional<float> rate;
|
std::optional<float> rate;
|
||||||
/// A value of false indicates that playback is progressing linearly through a playlist, while true means playback is progressing through a playlist in some
|
/// A value of false indicates that playback is progressing linearly through a playlist, while true means playback is progressing through a playlist in some
|
||||||
/// other order.
|
/// other order.
|
||||||
boost::optional<bool> shuffle;
|
std::optional<bool> shuffle;
|
||||||
/// The volume level between 0-100
|
/// The volume level between 0-100
|
||||||
boost::optional<int> volume;
|
std::optional<int> volume;
|
||||||
/// The current track position in seconds
|
/// The current track position in seconds
|
||||||
boost::optional<float> position;
|
std::optional<float> position;
|
||||||
/// The minimum value which the Rate property can take. Clients should not attempt to set the Rate property below this value
|
/// The minimum value which the Rate property can take. Clients should not attempt to set the Rate property below this value
|
||||||
boost::optional<float> minimum_rate;
|
std::optional<float> minimum_rate;
|
||||||
/// The maximum value which the Rate property can take. Clients should not attempt to set the Rate property above this value
|
/// The maximum value which the Rate property can take. Clients should not attempt to set the Rate property above this value
|
||||||
boost::optional<float> maximum_rate;
|
std::optional<float> maximum_rate;
|
||||||
/// Whether the client can call the Next method on this interface and expect the current track to change
|
/// Whether the client can call the Next method on this interface and expect the current track to change
|
||||||
bool can_go_next = false;
|
bool can_go_next = false;
|
||||||
/// Whether the client can call the Previous method on this interface and expect the current track to change
|
/// Whether the client can call the Previous method on this interface and expect the current track to change
|
||||||
|
@ -187,9 +187,9 @@ public:
|
||||||
{
|
{
|
||||||
json j;
|
json j;
|
||||||
if (playback_status.has_value())
|
if (playback_status.has_value())
|
||||||
addTag(j, "playbackStatus", boost::optional<std::string>(to_string(playback_status.value())));
|
addTag(j, "playbackStatus", std::optional<std::string>(to_string(playback_status.value())));
|
||||||
if (loop_status.has_value())
|
if (loop_status.has_value())
|
||||||
addTag(j, "loopStatus", boost::optional<std::string>(to_string(loop_status.value())));
|
addTag(j, "loopStatus", std::optional<std::string>(to_string(loop_status.value())));
|
||||||
addTag(j, "rate", rate);
|
addTag(j, "rate", rate);
|
||||||
addTag(j, "shuffle", shuffle);
|
addTag(j, "shuffle", shuffle);
|
||||||
addTag(j, "volume", volume);
|
addTag(j, "volume", volume);
|
||||||
|
@ -218,19 +218,19 @@ public:
|
||||||
LOG(WARNING, LOG_TAG) << "Property not supoorted: " << element.key() << "\n";
|
LOG(WARNING, LOG_TAG) << "Property not supoorted: " << element.key() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> opt;
|
std::optional<std::string> opt;
|
||||||
|
|
||||||
readTag(j, "playbackStatus", opt);
|
readTag(j, "playbackStatus", opt);
|
||||||
if (opt.has_value())
|
if (opt.has_value())
|
||||||
playback_status = playback_status_from_string(opt.value());
|
playback_status = playback_status_from_string(opt.value());
|
||||||
else
|
else
|
||||||
playback_status = boost::none;
|
playback_status = std::nullopt;
|
||||||
|
|
||||||
readTag(j, "loopStatus", opt);
|
readTag(j, "loopStatus", opt);
|
||||||
if (opt.has_value())
|
if (opt.has_value())
|
||||||
loop_status = loop_status_from_string(opt.value());
|
loop_status = loop_status_from_string(opt.value());
|
||||||
else
|
else
|
||||||
loop_status = boost::none;
|
loop_status = std::nullopt;
|
||||||
readTag(j, "rate", rate);
|
readTag(j, "rate", rate);
|
||||||
readTag(j, "shuffle", shuffle);
|
readTag(j, "shuffle", shuffle);
|
||||||
readTag(j, "volume", volume);
|
readTag(j, "volume", volume);
|
||||||
|
@ -253,12 +253,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void readTag(const json& j, const std::string& tag, boost::optional<T>& dest) const
|
void readTag(const json& j, const std::string& tag, std::optional<T>& dest) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!j.contains(tag))
|
if (!j.contains(tag))
|
||||||
dest = boost::none;
|
dest = std::nullopt;
|
||||||
else
|
else
|
||||||
dest = j[tag].get<T>();
|
dest = j[tag].get<T>();
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void readTag(const json& j, const std::string& tag, T& dest, const T& def) const
|
void readTag(const json& j, const std::string& tag, T& dest, const T& def) const
|
||||||
{
|
{
|
||||||
boost::optional<T> val;
|
std::optional<T> val;
|
||||||
readTag(j, tag, val);
|
readTag(j, tag, val);
|
||||||
if (val.has_value())
|
if (val.has_value())
|
||||||
dest = val.value();
|
dest = val.value();
|
||||||
|
@ -280,7 +280,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void addTag(json& j, const std::string& tag, const boost::optional<T>& source) const
|
void addTag(json& j, const std::string& tag, const std::optional<T>& source) const
|
||||||
{
|
{
|
||||||
if (!source.has_value())
|
if (!source.has_value())
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ ifneq ($(SANITIZE), )
|
||||||
LDFLAGS += -fsanitize=$(SANITIZE)
|
LDFLAGS += -fsanitize=$(SANITIZE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += $(ADD_CFLAGS) -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-function -DBOOST_ERROR_CODE_HEADER_ONLY -DHAS_FLAC -DHAS_OGG -DHAS_VORBIS -DHAS_VORBIS_ENC -DHAS_OPUS -DHAS_SOXR -DVERSION=\"$(VERSION)\" -I. -I.. -I../common
|
CXXFLAGS += $(ADD_CFLAGS) -std=c++17 -Wall -Wextra -Wpedantic -Wno-unused-function -DBOOST_ERROR_CODE_HEADER_ONLY -DHAS_FLAC -DHAS_OGG -DHAS_VORBIS -DHAS_VORBIS_ENC -DHAS_OPUS -DHAS_SOXR -DVERSION=\"$(VERSION)\" -I. -I.. -I../common
|
||||||
LDFLAGS += $(ADD_LDFLAGS) -lvorbis -lvorbisenc -logg -lFLAC -lopus -lsoxr
|
LDFLAGS += $(ADD_LDFLAGS) -lvorbis -lvorbisenc -logg -lFLAC -lopus -lsoxr
|
||||||
OBJ = snapserver.o server.o config.o control_server.o control_session_tcp.o control_session_http.o control_session_ws.o stream_server.o stream_session.o stream_session_tcp.o stream_session_ws.o streamreader/stream_uri.o streamreader/base64.o streamreader/stream_manager.o streamreader/pcm_stream.o streamreader/posix_stream.o streamreader/pipe_stream.o streamreader/file_stream.o streamreader/tcp_stream.o streamreader/process_stream.o streamreader/airplay_stream.o streamreader/meta_stream.o streamreader/librespot_stream.o streamreader/watchdog.o encoder/encoder_factory.o encoder/flac_encoder.o encoder/opus_encoder.o encoder/pcm_encoder.o encoder/null_encoder.o encoder/ogg_encoder.o ../common/sample_format.o ../common/resampler.o
|
OBJ = snapserver.o server.o config.o control_server.o control_session_tcp.o control_session_http.o control_session_ws.o stream_server.o stream_session.o stream_session_tcp.o stream_session_ws.o streamreader/stream_uri.o streamreader/base64.o streamreader/stream_manager.o streamreader/pcm_stream.o streamreader/posix_stream.o streamreader/pipe_stream.o streamreader/file_stream.o streamreader/tcp_stream.o streamreader/process_stream.o streamreader/airplay_stream.o streamreader/meta_stream.o streamreader/librespot_stream.o streamreader/watchdog.o encoder/encoder_factory.o encoder/flac_encoder.o encoder/opus_encoder.o encoder/pcm_encoder.o encoder/null_encoder.o encoder/ogg_encoder.o ../common/sample_format.o ../common/resampler.o
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/read_until.hpp>
|
#include <boost/asio/read_until.hpp>
|
||||||
#include <boost/asio/steady_timer.hpp>
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
#include "common/json.hpp"
|
#include "common/json.hpp"
|
||||||
#include "common/metatags.hpp"
|
#include "common/metatags.hpp"
|
||||||
|
|
Loading…
Add table
Reference in a new issue