Cleanup Snapclient includes

This commit is contained in:
badaix 2024-04-03 21:50:03 +02:00
parent 241bf4913d
commit aa82ba8397
59 changed files with 317 additions and 344 deletions

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,13 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "browse_avahi.hpp"
// local headers
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
// standard headers
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,19 +15,21 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef BROWSEAVAHI_H
#define BROWSEAVAHI_H
#pragma once
class BrowseAvahi;
// local headers
#include "browse_mdns.hpp"
// 3rd party headers
#include <avahi-client/client.h>
#include <avahi-client/lookup.h>
#include <avahi-common/error.h>
#include <avahi-common/malloc.h>
#include <avahi-common/simple-watch.h>
class BrowseAvahi;
#include "browse_mdns.hpp"
class BrowseAvahi : public BrowsemDNS
{
@ -49,5 +51,3 @@ private:
mDNSResult result_;
AvahiServiceBrowser* sb_;
};
#endif

View file

@ -1,8 +1,30 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "browse_bonjour.hpp"
#include <deque>
// local headers
#include "common/aixlog.hpp"
// standard headers
#include <iostream>
#include <memory>
#ifdef WINDOWS
#include <WinSock2.h>
#include <Ws2tcpip.h>
@ -11,8 +33,6 @@
#include <sys/socket.h>
#endif
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
using namespace std;

View file

@ -1,15 +1,34 @@
#ifndef BROWSEBONJOUR_H
#define BROWSEBONJOUR_H
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
#include <dns_sd.h>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
class BrowseBonjour;
// local headers
#include "browse_mdns.hpp"
// 3rd party headers
#include <dns_sd.h>
class BrowseBonjour : public BrowsemDNS
{
public:
bool browse(const std::string& serviceName, mDNSResult& result, int timeout) override;
};
#endif

View file

@ -1,6 +1,24 @@
#ifndef BROWSEMDNS_H
#define BROWSEMDNS_H
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
// standard headers
#include <string>
enum IPVersion
@ -37,5 +55,3 @@ using BrowseZeroConf = BrowseAvahi;
#include "browse_bonjour.hpp"
using BrowseZeroConf = BrowseBonjour;
#endif
#endif

View file

@ -21,8 +21,6 @@
// local headers
#include "common/aixlog.hpp"
#include "common/message/hello.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
// 3rd party headers
@ -32,7 +30,6 @@
// standard headers
#include <iostream>
#include <mutex>
using namespace std;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CLIENT_CONNECTION_HPP
#define CLIENT_CONNECTION_HPP
#pragma once
// local headers
#include "client_settings.hpp"
@ -32,14 +31,9 @@
#include <boost/asio/strand.hpp>
// standard headers
#include <atomic>
#include <condition_variable>
#include <deque>
#include <memory>
#include <mutex>
#include <set>
#include <string>
#include <thread>
using boost::asio::ip::tcp;
@ -159,7 +153,3 @@ protected:
};
std::deque<PendingMessage> messages_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,15 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CLIENT_SETTINGS_HPP
#define CLIENT_SETTINGS_HPP
#include <string>
#include <vector>
#pragma once
// local headers
#include "common/sample_format.hpp"
#include "player/pcm_device.hpp"
// standard headers
#include <string>
struct ClientSettings
{
@ -79,5 +80,3 @@ struct ClientSettings
Player player;
Logging logging;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,13 +16,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CONTROLLER_HPP
#define CONTROLLER_HPP
#pragma once
// local headers
#include "client_connection.hpp"
#include "client_settings.hpp"
#include "common/message/message.hpp"
#include "common/message/server_settings.hpp"
#include "decoder/decoder.hpp"
#include "player/player.hpp"
@ -31,8 +29,7 @@
// 3rd party headers
// standard headers
#include <atomic>
#include <thread>
using namespace std::chrono_literals;
@ -75,6 +72,3 @@ private:
std::unique_ptr<msg::ServerSettings> serverSettings_;
std::unique_ptr<msg::CodecHeader> headerChunk_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,11 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "flac_decoder.hpp"
// local headers
#include "common/aixlog.hpp"
#include "common/endian.hpp"
#include "common/snap_exception.hpp"
#include <cmath>
// standard headers
#include <cstring>
#include <iostream>

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,15 +16,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef FLAC_DECODER_H
#define FLAC_DECODER_H
#pragma once
// local headers
#include "decoder.hpp"
// 3rd party headers
#include <FLAC/stream_decoder.h>
#include <atomic>
// standard headers
#include <memory>
namespace decoder
{
@ -60,5 +63,3 @@ public:
};
} // namespace decoder
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,9 +20,6 @@
#include "null_decoder.hpp"
// local headers
#include "common/aixlog.hpp"
#include "common/endian.hpp"
#include "common/snap_exception.hpp"
// 3rd party headers

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -28,10 +28,8 @@
// 3rd party headers
// standard headers
#include <cmath>
#include <cstdint>
#include <cstring>
#include <iostream>

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,9 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OGG_DECODER_H
#define OGG_DECODER_H
#pragma once
// local headers
#include "decoder.hpp"
// 3rd party headers
#ifdef HAS_TREMOR
#include <tremor/ivorbiscodec.h>
#else
@ -64,5 +67,3 @@ private:
};
} // namespace decoder
#endif

View file

@ -1,7 +1,7 @@
/***
This file is part of snapcast
Copyright (C) 2015 Hannes Ellinger
Copyright (C) 2016-2021 Johannes Pohl
Copyright (C) 2016-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -17,10 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "opus_decoder.hpp"
// local headers
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
namespace decoder
{

View file

@ -1,6 +1,7 @@
/***
This file is part of snapcast
Copyright (C) 2015 Hannes Ellinger
Copyright (C) 2016-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -18,9 +19,16 @@
#pragma once
// local headers
#include "decoder/decoder.hpp"
// 3rd party headers
#include <opus/opus.h>
// standard headers
#include <vector>
namespace decoder
{

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,11 +16,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "pcm_decoder.hpp"
#include "common/aixlog.hpp"
// local headers
#include "common/endian.hpp"
#include "common/snap_exception.hpp"
namespace decoder
{

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,8 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef PCM_DECODER_H
#define PCM_DECODER_H
#pragma once
// local headers
#include "decoder.hpp"
@ -33,5 +34,3 @@ public:
};
} // namespace decoder
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -22,6 +22,8 @@
// standard headers
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <deque>

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,11 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef METADATA_H
#define METADATA_H
#pragma once
// local headers
#include "common/json.hpp"
// standard headers
#include <iostream>
// Prefix used in output
#define METADATA std::string("metadata")
@ -99,5 +103,3 @@ public:
return 0;
}
};
#endif

View file

@ -29,6 +29,8 @@
// 3rd party headers
// standard headers
#include <chrono>
using namespace std::chrono_literals;
using namespace std;

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef ALSA_PLAYER_HPP
#define ALSA_PLAYER_HPP
#pragma once
// local headers
#include "player.hpp"
@ -30,6 +29,7 @@
// standard headers
#include <chrono>
#include <optional>
#include <vector>
namespace player
@ -94,5 +94,3 @@ private:
};
} // namespace player
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -28,8 +28,7 @@
// 3rd party headers
// standard headers
#include <cassert>
#include <iostream>
using namespace std;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -21,13 +21,10 @@
// local headers
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
// 3rd party headers
// standard headers
#include <cassert>
#include <iostream>

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -27,7 +27,6 @@
// 3rd party headers
// standard headers
#include <cassert>
#include <iostream>

View file

@ -16,12 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef PLAYER_HPP
#define PLAYER_HPP
#pragma once
// local headers
#include "client_settings.hpp"
#include "common/aixlog.hpp"
#include "common/endian.hpp"
#include "stream.hpp"
@ -32,9 +30,8 @@
#include <atomic>
#include <functional>
#include <mutex>
#include <string>
#include <thread>
#include <vector>
#if !defined(WINDOWS)
#define SUPPORTS_VOLUME_SCRIPT
@ -137,5 +134,3 @@ inline bool operator!=(const Player::Volume& lhs, const Player::Volume& rhs)
}
} // namespace player
#endif

View file

@ -30,7 +30,6 @@
#include <pulse/proplist.h>
// standard headers
#include <cassert>
#include <iostream>

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef PULSE_PLAYER_HPP
#define PULSE_PLAYER_HPP
#pragma once
// local headers
#include "player.hpp"
@ -91,5 +90,3 @@ protected:
};
} // namespace player
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -26,7 +26,6 @@
// 3rd party headers
#include <initguid.h>
#include <mmdeviceapi.h>
//#include <functiondiscoverykeys_devpkey.h>
// standard headers
#include <audioclient.h>
@ -37,10 +36,7 @@
#include <mmdeviceapi.h>
#include <cassert>
#include <chrono>
#include <codecvt>
#include <functional>
#include <locale>
using namespace std;
using namespace std::chrono;

View file

@ -37,7 +37,6 @@
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
#include "common/utils.hpp"
#include "common/version.hpp"
// 3rd party headers
@ -45,7 +44,6 @@
#include <boost/asio/signal_set.hpp>
// standard headers
#include <chrono>
#include <iostream>
#ifndef WINDOWS
#include <csignal>

View file

@ -408,7 +408,7 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
auto miniMedian = miniBuffer_.median();
if ((cs::usec(shortMedian_) > kCorrectionBegin) && (cs::usec(miniMedian) > cs::usec(50)) && (cs::usec(age) > cs::usec(50)))
{
double rate = (shortMedian_ / 100) * 0.00005;
double rate = (shortMedian_ / 100.) * 0.00005;
rate = 1.0 - std::min(rate, 0.0005);
// LOG(INFO, LOG_TAG) << "Rate: " << rate << "\n";
// we are late (age > 0), this means we are not playing fast enough
@ -417,7 +417,7 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
}
else if ((cs::usec(shortMedian_) < -kCorrectionBegin) && (cs::usec(miniMedian) < -cs::usec(50)) && (cs::usec(age) < -cs::usec(50)))
{
double rate = (-shortMedian_ / 100) * 0.00005;
double rate = (-shortMedian_ / 100.) * 0.00005;
rate = 1.0 + std::min(rate, 0.0005);
// LOG(INFO, LOG_TAG) << "Rate: " << rate << "\n";
// we are early (age > 0), this means we are playing too fast

View file

@ -16,29 +16,26 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef STREAM_HPP
#define STREAM_HPP
#pragma once
// local headers
#include "common/message/message.hpp"
#include "common/message/pcm_chunk.hpp"
#include "common/queue.h"
#include "common/queue.hpp"
#include "common/resampler.hpp"
#include "common/sample_format.hpp"
#include "common/utils/logging.hpp"
#include "double_buffer.hpp"
// 3rd party headers
// standard headers
#include <atomic>
#include <deque>
#include <memory>
#ifdef HAS_SOXR
#include <soxr.h>
#endif
// standard headers
#include <atomic>
#include <memory>
/// Time synchronized audio stream
/**
@ -139,7 +136,3 @@ private:
/// Log "failed to get chunk" only once per second
utils::logging::TimeConditional time_cond_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,9 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "time_provider.hpp"
// local headers
#include "common/aixlog.hpp"
// standard headers
#include <chrono>
static constexpr auto LOG_TAG = "TimeProvider";

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,17 +16,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "daemon.hpp"
// local headers
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
#include "common/utils.hpp"
#include "common/utils/file_utils.hpp"
// standard headers
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <grp.h>
#include <iostream>
#include <pwd.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -102,14 +104,14 @@ void Daemon::daemonize()
if (user_gid != static_cast<gid_t>(-1) && user_gid != getgid() && setgid(user_gid) == -1)
throw SnapException("Failed to set group " + cpt::to_string(static_cast<int>(user_gid)));
//#if defined(FREEBSD) && !defined(MACOS)
//#ifdef FREEBSD
// #if defined(FREEBSD) && !defined(MACOS)
// #ifdef FREEBSD
/// init supplementary groups
/// (must be done before we change our uid)
/// no need to set the new user's supplementary groups if we are already this user
// if (!had_group && user_uid != getuid() && initgroups(user_name, user_gid) == -1)
// throw SnapException("Failed to set supplementary groups of user \"" + user + "\"");
//#endif
// #endif
/// set uid
if (user_uid != static_cast<uid_t>(-1) && user_uid != getuid() && setuid(user_uid) == -1)
throw SnapException("Failed to set user " + user_);

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,9 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef DAEMON_H
#define DAEMON_H
#pragma once
// standard headers
#include <string>
@ -36,6 +37,3 @@ private:
std::string group_;
std::string pidfile_;
};
#endif // DAEMON_H

View file

@ -1,6 +1,24 @@
#ifndef ENDIAN_HPP
#define ENDIAN_HPP
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
// standard headers
#include <cstdint>
#ifdef IS_BIG_ENDIAN
@ -43,5 +61,3 @@ inline int64_t swap(const int64_t& val)
return SWAP_64(val);
}
} // namespace endian
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,10 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef ERROR_CODE_HPP
#define ERROR_CODE_HPP
#pragma once
// standard headers
#include <optional>
#include <string>
#include <system_error>
@ -55,7 +54,3 @@ private:
} // namespace snapcast
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,23 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MESSAGE_FACTORY_HPP
#define MESSAGE_FACTORY_HPP
#pragma once
// local headers
#include "client_info.hpp"
#include "codec_header.hpp"
#include "common/str_compat.hpp"
#include "common/utils.hpp"
#include "hello.hpp"
#include "json_message.hpp"
#include "pcm_chunk.hpp"
#include "server_settings.hpp"
#include "time.hpp"
// standard headers
#include <string>
namespace msg
{
@ -91,5 +84,3 @@ static std::unique_ptr<BaseMessage> createMessage(const BaseMessage& base_messag
} // namespace factory
} // namespace msg
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MESSAGE_MESSAGE_HPP
#define MESSAGE_MESSAGE_HPP
#pragma once
// local headers
#include "common/endian.hpp"
@ -32,7 +31,6 @@
#include <sys/time.h>
#endif
#include <memory>
#include <vector>
/*
template<typename CharT, typename TraitsT = std::char_traits<CharT> >
@ -344,5 +342,3 @@ protected:
};
} // namespace msg
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MESSAGE_WIRE_CHUNK_HPP
#define MESSAGE_WIRE_CHUNK_HPP
#pragma once
// local headers
#include "common/time_defs.hpp"
@ -28,8 +27,6 @@
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <streambuf>
#include <vector>
namespace msg
@ -95,6 +92,3 @@ protected:
}
};
} // namespace msg
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,14 +16,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef QUEUE_H
#define QUEUE_H
#pragma once
// standard headers
#include <atomic>
#include <condition_variable>
#include <deque>
#include <mutex>
#include <thread>
template <typename T>
class Queue
@ -164,6 +164,3 @@ private:
mutable std::mutex mutex_;
mutable std::condition_variable cond_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,12 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "resampler.hpp"
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
// local headers
#include "common/aixlog.hpp"
// standard headers
#include <cmath>
using namespace std;
static constexpr auto LOG_TAG = "Resampler";

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,17 +16,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef RESAMPLER_HPP
#define RESAMPLER_HPP
#pragma once
// local headers
#include "common/message/pcm_chunk.hpp"
#include "common/sample_format.hpp"
#include <deque>
#include <vector>
// 3rd party headers
#ifdef HAS_SOXR
#include <soxr.h>
#endif
// standard headers
#include <vector>
class Resampler
{
@ -48,5 +52,3 @@ private:
soxr_t soxr_{nullptr};
#endif
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,17 +16,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// local headers
#include "sample_format.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
#include "common/utils/string_utils.hpp"
// standard headers
#include <iostream>
#include <sstream>
#include <vector>
#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"
#include "common/str_compat.hpp"
#include "common/utils.hpp"
#include "common/utils/string_utils.hpp"
#include "sample_format.hpp"
using namespace std;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,9 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SAMPLE_FORMAT_H
#define SAMPLE_FORMAT_H
#pragma once
// standard headers
#include <cstdint>
#include <string>
@ -101,6 +101,3 @@ private:
uint16_t bits_;
uint16_t channels_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,10 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SNAP_EXCEPTION_HPP
#define SNAP_EXCEPTION_HPP
#pragma once
#include <cstring> // std::strlen, std::strcpy
// standard headers
#include <exception>
#include <string>
@ -50,6 +49,3 @@ public:
return text_.c_str();
}
};
#endif

View file

@ -1,7 +1,25 @@
#ifndef COMPAT_H
#define COMPAT_H
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
// standard headers
#include <clocale>
#include <string>
@ -114,6 +132,3 @@ static float strtof(const char* str, char** endptr)
#endif
}
} // namespace cpt
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,9 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TIME_DEFS_H
#define TIME_DEFS_H
#pragma once
// standard headers
#include <chrono>
#include <thread>
#ifdef MACOS
@ -34,6 +35,7 @@
#include <winsock2.h>
#endif
namespace chronos
{
using clk =
@ -159,6 +161,3 @@ inline void usleep(const int32_t& microseconds)
sleep(usec(microseconds));
}
} // namespace chronos
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2020 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,21 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef UTILS_H
#define UTILS_H
#pragma once
#include "common/str_compat.hpp"
// local headers
#include "common/utils/string_utils.hpp"
#include <cctype>
#include <cerrno>
// #include <chrono>
// standard headers
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iterator>
#include <locale>
#include <memory>
#ifndef WINDOWS
#include <net/if.h>
@ -43,7 +38,6 @@
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <vector>
#if !defined(WINDOWS) && !defined(FREEBSD)
#include <sys/sysinfo.h>
#endif
@ -463,6 +457,3 @@ static std::string getHostId(const std::string& defaultId = "")
/// The host name should be unique enough in a LAN
return getHostName();
}
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,11 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef VERSION_HPP
#define VERSION_HPP
#pragma once
// standard headers
#include <string>
namespace version
{
@ -46,5 +48,3 @@ static std::string rev(std::size_t len = 0)
}
} // namespace version
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,15 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CONTROL_SERVER_HPP
#define CONTROL_SERVER_HPP
#pragma once
// local headers
#include "common/message/codec_header.hpp"
#include "common/message/message.hpp"
#include "common/message/server_settings.hpp"
#include "common/queue.h"
#include "common/sample_format.hpp"
#include "control_session.hpp"
#include "server_settings.hpp"
@ -35,7 +29,6 @@
// standard headers
#include <memory>
#include <mutex>
#include <set>
#include <vector>
@ -82,7 +75,3 @@ private:
ServerSettings::Http http_settings_;
ControlMessageReceiver* controlMessageReceiver_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,21 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CONTROL_SESSION_HPP
#define CONTROL_SESSION_HPP
#pragma once
// local headers
#include "common/message/message.hpp"
#include "common/queue.h"
#include "server_settings.hpp"
// 3rd party headers
// standard headers
#include <atomic>
#include <condition_variable>
#include <functional>
#include <memory>
#include <set>
#include <string>
@ -72,7 +66,3 @@ public:
protected:
ControlMessageReceiver* message_receiver_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,11 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef CONTROL_SESSION_HTTP_HPP
#define CONTROL_SESSION_HTTP_HPP
#pragma once
// local headers
#include "control_session.hpp"
#include "server_settings.hpp"
// 3rd party headers
#include <boost/beast/core.hpp>
@ -77,7 +78,3 @@ protected:
ServerSettings::Http settings_;
std::deque<std::string> messages_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
// prototype/interface header file
#include "control_session_tcp.hpp"
@ -25,7 +26,6 @@
// local headers
#include "common/aixlog.hpp"
#include "common/message/pcm_chunk.hpp"
using namespace std;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,15 +23,16 @@
#include "common/aixlog.hpp"
#include "common/message/client_info.hpp"
#include "common/message/hello.hpp"
#include "common/message/server_settings.hpp"
#include "common/message/time.hpp"
#include "config.hpp"
#include "stream_session_tcp.hpp"
// 3rd party headers
// standard headers
#include <iostream>
using namespace std;
using namespace streamreader;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,15 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SERVER_HPP
#define SERVER_HPP
#pragma once
// local headers
#include "common/message/codec_header.hpp"
#include "common/message/message.hpp"
#include "common/message/server_settings.hpp"
#include "common/queue.h"
#include "common/sample_format.hpp"
#include "common/queue.hpp"
#include "control_server.hpp"
#include "jsonrpcpp.hpp"
#include "server_settings.hpp"
@ -38,10 +35,6 @@
// standard headers
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <vector>
using namespace streamreader;
@ -102,7 +95,3 @@ private:
std::unique_ptr<StreamServer> streamServer_;
std::unique_ptr<StreamManager> streamManager_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2021 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,14 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SERVER_SETTINGS_HPP
#define SERVER_SETTINGS_HPP
#pragma once
// local headers
#include "image_cache.hpp"
// standard headers
#include <string>
#include <vector>
#include "image_cache.hpp"
struct ServerSettings
{
@ -83,5 +85,3 @@ struct ServerSettings
StreamingClient streamingclient;
Logging logging;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,20 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef STREAM_SERVER_HPP
#define STREAM_SERVER_HPP
#pragma once
// local headers
#include "common/message/codec_header.hpp"
#include "common/message/message.hpp"
#include "common/message/server_settings.hpp"
#include "common/queue.h"
#include "common/sample_format.hpp"
#include "common/queue.hpp"
#include "control_server.hpp"
#include "jsonrpcpp.hpp"
#include "server_settings.hpp"
#include "stream_session.hpp"
#include "streamreader/stream_manager.hpp"
// 3rd party headers
#include <boost/asio/io_context.hpp>
@ -38,8 +33,6 @@
// standard headers
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <vector>
@ -94,7 +87,3 @@ private:
Queue<std::shared_ptr<msg::BaseMessage>> messages_;
StreamMessageReceiver* messageReceiver_;
};
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2024 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,12 +16,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef STREAM_SESSION_HPP
#define STREAM_SESSION_HPP
#pragma once
// local headers
#include "common/message/message.hpp"
#include "common/queue.h"
#include "streamreader/stream_manager.hpp"
// 3rd party headers
@ -30,12 +29,9 @@
#include <boost/asio/strand.hpp>
// standard headers
#include <atomic>
#include <condition_variable>
#include <deque>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <vector>
@ -166,7 +162,3 @@ protected:
std::deque<shared_const_buffer> messages_;
mutable std::mutex mutex_;
};
#endif