Skip to content

Commit

Permalink
Cleanup Snapclient includes
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Apr 3, 2024
1 parent 241bf49 commit aa82ba8
Show file tree
Hide file tree
Showing 59 changed files with 313 additions and 340 deletions.
10 changes: 6 additions & 4 deletions client/browseZeroConf/browse_avahi.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>


Expand Down
18 changes: 9 additions & 9 deletions client/browseZeroConf/browse_avahi.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
{
Expand All @@ -49,5 +51,3 @@ class BrowseAvahi : public BrowsemDNS
mDNSResult result_;
AvahiServiceBrowser* sb_;
};

#endif
28 changes: 24 additions & 4 deletions client/browseZeroConf/browse_bonjour.cpp
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -11,8 +33,6 @@
#include <sys/socket.h>
#endif

#include "common/aixlog.hpp"
#include "common/snap_exception.hpp"

using namespace std;

Expand Down
27 changes: 23 additions & 4 deletions client/browseZeroConf/browse_bonjour.hpp
Original file line number Diff line number Diff line change
@@ -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
24 changes: 20 additions & 4 deletions client/browseZeroConf/browse_mdns.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,5 +55,3 @@ using BrowseZeroConf = BrowseAvahi;
#include "browse_bonjour.hpp"
using BrowseZeroConf = BrowseBonjour;
#endif

#endif
3 changes: 0 additions & 3 deletions client/client_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +30,6 @@

// standard headers
#include <iostream>
#include <mutex>


using namespace std;
Expand Down
14 changes: 2 additions & 12 deletions client/client_connection.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -159,7 +153,3 @@ class ClientConnection
};
std::deque<PendingMessage> messages_;
};



#endif
15 changes: 7 additions & 8 deletions client/client_settings.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
{
Expand Down Expand Up @@ -79,5 +80,3 @@ struct ClientSettings
Player player;
Logging logging;
};

#endif
12 changes: 3 additions & 9 deletions client/controller.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -31,8 +29,7 @@
// 3rd party headers

// standard headers
#include <atomic>
#include <thread>


using namespace std::chrono_literals;

Expand Down Expand Up @@ -75,6 +72,3 @@ class Controller
std::unique_ptr<msg::ServerSettings> serverSettings_;
std::unique_ptr<msg::CodecHeader> headerChunk_;
};


#endif
8 changes: 6 additions & 2 deletions client/decoder/flac_decoder.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>

Expand Down
13 changes: 7 additions & 6 deletions client/decoder/flac_decoder.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
{

Expand Down Expand Up @@ -60,5 +63,3 @@ class FlacDecoder : public Decoder
};

} // namespace decoder

#endif
5 changes: 1 addition & 4 deletions client/decoder/null_decoder.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
Loading

0 comments on commit aa82ba8

Please sign in to comment.