diff --git a/client/Makefile b/client/Makefile index 2f4ff6fe..4479f360 100644 --- a/client/Makefile +++ b/client/Makefile @@ -1,4 +1,11 @@ -VERSION = 0.1 +VERSION = 0.2 +TARGET = snapclient +ifdef DESTDIR +# dh_auto_install (Debian) sets this variable + TARGET_DIR = $(DESTDIR)/usr +else + TARGET_DIR ?= /usr/local +endif CC = /usr/bin/g++ CFLAGS = -std=gnu++0x -static-libgcc -static-libstdc++ -Wall -Wno-unused-function -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\" -I.. LDFLAGS = -lrt -lpthread -lboost_system -lboost_program_options -lasound -logg -lvorbis -lvorbisenc -lFLAC -lavahi-client -lavahi-common @@ -6,9 +13,9 @@ LDFLAGS = -lrt -lpthread -lboost_system -lboost_program_options -lasound -logg - OBJ = snapClient.o stream.o alsaPlayer.o clientConnection.o timeProvider.o oggDecoder.o pcmDecoder.o flacDecoder.o controller.o browseAvahi.o ../message/pcmChunk.o ../common/log.o ../message/sampleFormat.o BIN = snapclient -all: client +all: $(TARGET) -client: $(OBJ) +$(TARGET): $(OBJ) $(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS) strip $(BIN) @@ -18,7 +25,8 @@ client: $(OBJ) clean: rm -rf $(BIN) $(OBJ) *~ -install: uninstall +install: $(TARGET) uninstall +# install -D -g root -o root $(TARGET) $(TARGET_DIR)/sbin/$(TARGET) @cp ./snapclient /usr/sbin/snapclient cp ../init.d/snapclient /etc/init.d/snapclient; \ update-rc.d snapclient defaults; \ diff --git a/client/alsaPlayer.cpp b/client/alsaPlayer.cpp index 4a4801dc..c85f878f 100644 --- a/client/alsaPlayer.cpp +++ b/client/alsaPlayer.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "alsaPlayer.h" #include "common/log.h" #include diff --git a/client/alsaPlayer.h b/client/alsaPlayer.h index 7356305f..61c5025c 100644 --- a/client/alsaPlayer.h +++ b/client/alsaPlayer.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef PLAYER_H #define PLAYER_H diff --git a/client/browseAvahi.cpp b/client/browseAvahi.cpp index 941c0435..52f70796 100644 --- a/client/browseAvahi.cpp +++ b/client/browseAvahi.cpp @@ -18,8 +18,13 @@ ***/ #include "browseAvahi.h" +#include +#include +#include +#include #include #include +#include "common/log.h" static AvahiSimplePoll *simple_poll = NULL; @@ -65,13 +70,13 @@ void BrowseAvahi::resolve_callback( switch (event) { case AVAHI_RESOLVER_FAILURE: - fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); + logE << "(Resolver) Failed to resolve service '" << name << "' of type '" << type << "' in domain '" << domain << "': " << avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))) << "\n"; break; case AVAHI_RESOLVER_FOUND: { char a[AVAHI_ADDRESS_STR_MAX], *t; - fprintf(stderr, "Service '%s' of type '%s' in domain '%s':\n", name, type, domain); + logO << "Service '" << name << "' of type '" << type << "' in domain '" << domain << "':\n"; avahi_address_snprint(a, sizeof(a), address); browseAvahi->result_.host_ = host_name; @@ -81,26 +86,16 @@ void BrowseAvahi::resolve_callback( browseAvahi->result_.valid_ = true; t = avahi_string_list_to_string(txt); - fprintf(stderr, - "\t%s:%u (%s)\n" - "\tTXT=%s\n" - "\tProto=%i\n" - "\tcookie is %u\n" - "\tis_local: %i\n" - "\tour_own: %i\n" - "\twide_area: %i\n" - "\tmulticast: %i\n" - "\tcached: %i\n", - host_name, port, a, - t, - (int)protocol, - avahi_string_list_get_service_cookie(txt), - !!(flags & AVAHI_LOOKUP_RESULT_LOCAL), - !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN), - !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA), - !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST), - !!(flags & AVAHI_LOOKUP_RESULT_CACHED)); - + logO + << "\t" << host_name << ":" << port << "(" << a << ")\n" + << "\tTXT=" << t << "\n" + << "\tProto=" << (int)protocol << "\n" + << "\tcookie is " << avahi_string_list_get_service_cookie(txt) << "\n" + << "\tis_local: " << !!(flags & AVAHI_LOOKUP_RESULT_LOCAL) << "\n" + << "\tour_own: " << !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN) << "\n" + << "\twide_area: " << !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA) << "\n" + << "\tmulticast: " << !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST) << "\n" + << "\tcached: " << !!(flags & AVAHI_LOOKUP_RESULT_CACHED) << "\n"; avahi_free(t); } } @@ -129,12 +124,12 @@ void BrowseAvahi::browse_callback( switch (event) { case AVAHI_BROWSER_FAILURE: - fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); + logE << "(Browser) " << avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))) << "\n"; avahi_simple_poll_quit(simple_poll); return; case AVAHI_BROWSER_NEW: - fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain); + logO << "(Browser) NEW: service '" << name << "' of type '" << type << "' in domain '" << domain << "'\n"; /* We ignore the returned resolver object. In the callback function we free it. If the server is terminated before @@ -142,17 +137,17 @@ void BrowseAvahi::browse_callback( the resolver for us. */ if (!(avahi_service_resolver_new(browseAvahi->client_, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, (AvahiLookupFlags)0, resolve_callback, userdata))) - fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_client_errno(browseAvahi->client_))); + logE << "Failed to resolve service '" << name << "': " << avahi_strerror(avahi_client_errno(browseAvahi->client_)) << "\n"; break; case AVAHI_BROWSER_REMOVE: - fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain); + logO << "(Browser) REMOVE: service '" << name << "' of type '" << type << "' in domain '" << domain << "'\n"; break; case AVAHI_BROWSER_ALL_FOR_NOW: case AVAHI_BROWSER_CACHE_EXHAUSTED: - fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW"); + logO << "(Browser) " << (event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW") << "\n"; break; } } @@ -165,7 +160,7 @@ void BrowseAvahi::client_callback(AvahiClient *c, AvahiClientState state, AVAHI_ // BrowseAvahi* browseAvahi = static_cast(userdata); if (state == AVAHI_CLIENT_FAILURE) { - fprintf(stderr, "Server connection failure: %s\n", avahi_strerror(avahi_client_errno(c))); + logE << "Server connection failure: " << avahi_strerror(avahi_client_errno(c)) << "\n"; avahi_simple_poll_quit(simple_poll); } } @@ -177,7 +172,7 @@ bool BrowseAvahi::browse(const std::string& serviceName, int proto, AvahiResult& /* Allocate main loop object */ if (!(simple_poll = avahi_simple_poll_new())) { - fprintf(stderr, "Failed to create simple poll object.\n"); + logE << "Failed to create simple poll object.\n"; goto fail; } @@ -186,13 +181,13 @@ bool BrowseAvahi::browse(const std::string& serviceName, int proto, AvahiResult& /* Check wether creating the client object succeeded */ if (!client_) { - fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error)); + logE << "Failed to create client: " << avahi_strerror(error) << "\n"; goto fail; } /* Create the service browser */ - if (!(sb_ = avahi_service_browser_new(client_, AVAHI_IF_UNSPEC, proto, serviceName.c_str(), NULL, (AvahiLookupFlags)0, browse_callback, this))) { - fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client_))); + if (!(sb_ = avahi_service_browser_new(client_, AVAHI_IF_UNSPEC, proto, serviceName.c_str(), NULL, (AvahiLookupFlags)0, browse_callback, this))) { + logE << "Failed to create service browser: " << avahi_strerror(avahi_client_errno(client_)) << "\n"; goto fail; } @@ -213,20 +208,5 @@ fail: } -/* -int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) -{ - std::string ip; - size_t port; - BrowseAvahi browseAvahi; - if (browseAvahi.browse("_snapcast._tcp", AVAHI_PROTO_INET, ip, port, 5000)) - std::cout << ip << ":" << port << "\n"; - - return 0; -} -*/ - - - diff --git a/client/browseAvahi.h b/client/browseAvahi.h index 9ba61e85..598b686e 100644 --- a/client/browseAvahi.h +++ b/client/browseAvahi.h @@ -1,27 +1,21 @@ /*** - This file is part of avahi. + This file is part of snapcast + Copyright (C) 2015 Johannes Pohl - avahi is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. + 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. - avahi 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 Lesser General - Public License for more details. + 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 Lesser General Public - License along with avahi; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . ***/ -#include -#include -#include -#include - #include #include @@ -30,8 +24,6 @@ #include #include -#include -#include struct AvahiResult diff --git a/client/clientConnection.cpp b/client/clientConnection.cpp index 7c194172..74473414 100644 --- a/client/clientConnection.cpp +++ b/client/clientConnection.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include #include #include diff --git a/client/clientConnection.h b/client/clientConnection.h index db5e6c42..853bf0c1 100644 --- a/client/clientConnection.h +++ b/client/clientConnection.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef CLIENT_CONNECTION_H #define CLIENT_CONNECTION_H diff --git a/client/controller.cpp b/client/controller.cpp index ce011d86..9b89d079 100644 --- a/client/controller.cpp +++ b/client/controller.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "controller.h" #include #include diff --git a/client/controller.h b/client/controller.h index 8d0f5e24..682ffa29 100644 --- a/client/controller.h +++ b/client/controller.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef CONTROLLER_H #define CONTROLLER_H diff --git a/client/decoder.h b/client/decoder.h index ca83281a..a2184a8f 100644 --- a/client/decoder.h +++ b/client/decoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef DECODER_H #define DECODER_H #include "message/pcmChunk.h" diff --git a/client/doubleBuffer.h b/client/doubleBuffer.h index 8a5b14e2..669f126f 100644 --- a/client/doubleBuffer.h +++ b/client/doubleBuffer.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef DOUBLE_BUFFER_H #define DOUBLE_BUFFER_H diff --git a/client/flacDecoder.cpp b/client/flacDecoder.cpp index 216dc3f2..937bbfd3 100644 --- a/client/flacDecoder.cpp +++ b/client/flacDecoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "flacDecoder.h" #include #include diff --git a/client/flacDecoder.h b/client/flacDecoder.h index 0f358439..4e7b0849 100644 --- a/client/flacDecoder.h +++ b/client/flacDecoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef FLAC_DECODER_H #define FLAC_DECODER_H #include "decoder.h" diff --git a/client/oggDecoder.cpp b/client/oggDecoder.cpp index b204eab2..7a7e9090 100644 --- a/client/oggDecoder.cpp +++ b/client/oggDecoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "oggDecoder.h" #include #include diff --git a/client/oggDecoder.h b/client/oggDecoder.h index 8994b332..3c8c371b 100644 --- a/client/oggDecoder.h +++ b/client/oggDecoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef OGG_DECODER_H #define OGG_DECODER_H #include "decoder.h" diff --git a/client/pcmDecoder.cpp b/client/pcmDecoder.cpp index 1bf38b49..190b012f 100644 --- a/client/pcmDecoder.cpp +++ b/client/pcmDecoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "pcmDecoder.h" PcmDecoder::PcmDecoder() : Decoder() diff --git a/client/pcmDecoder.h b/client/pcmDecoder.h index 799373f2..cc423881 100644 --- a/client/pcmDecoder.h +++ b/client/pcmDecoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef PCM_DECODER_H #define PCM_DECODER_H #include "decoder.h" diff --git a/client/pcmDevice.h b/client/pcmDevice.h index 7158d8b0..745c3ca3 100644 --- a/client/pcmDevice.h +++ b/client/pcmDevice.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef PCM_DEVICE_H #define PCM_DEVICE_H diff --git a/client/snapClient.cpp b/client/snapClient.cpp index 6c579cca..6b9f800a 100644 --- a/client/snapClient.cpp +++ b/client/snapClient.cpp @@ -1,10 +1,21 @@ -// -// Weather update client in C++ -// Connects SUB socket to tcp://localhost:5556 -// Collects weather updates and finds avg temp in zipcode -// -// Olivier Chamoux -// +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include #include #include diff --git a/client/stream.cpp b/client/stream.cpp index 327018c3..da9836c9 100644 --- a/client/stream.cpp +++ b/client/stream.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "stream.h" #include #include diff --git a/client/stream.h b/client/stream.h index f0bce3bb..4c1f05b6 100644 --- a/client/stream.h +++ b/client/stream.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef STREAM_H #define STREAM_H diff --git a/client/timeProvider.cpp b/client/timeProvider.cpp index 5cdf0038..7d6d0d0f 100644 --- a/client/timeProvider.cpp +++ b/client/timeProvider.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "timeProvider.h" diff --git a/client/timeProvider.h b/client/timeProvider.h index 2188646b..679d8629 100644 --- a/client/timeProvider.h +++ b/client/timeProvider.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef TIME_PROVIDER_H #define TIME_PROVIDER_H diff --git a/common/avahiService.h b/common/avahiService.h index dcd66ed8..af03aeba 100644 --- a/common/avahiService.h +++ b/common/avahiService.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef AVAHI_SERVICE_H #define AVAHI_SERVICE_H diff --git a/common/daemon.h b/common/daemon.h index 081b3cca..3bac3f2c 100644 --- a/common/daemon.h +++ b/common/daemon.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef DAEMONIZE_H #define DAEMONIZE_H diff --git a/common/log.cpp b/common/log.cpp index be5740a6..7019d5c2 100644 --- a/common/log.cpp +++ b/common/log.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "log.h" #include #include diff --git a/common/log.h b/common/log.h index 269115f2..e40d0a48 100644 --- a/common/log.h +++ b/common/log.h @@ -1,3 +1,22 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + + #ifndef LOG_H #define LOG_H diff --git a/common/queue.h b/common/queue.h index a1268f9e..802844a6 100644 --- a/common/queue.h +++ b/common/queue.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef QUEUE_H #define QUEUE_H diff --git a/common/signalHandler.h b/common/signalHandler.h index 36bc2c0a..8e8c79d7 100644 --- a/common/signalHandler.h +++ b/common/signalHandler.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef SIGNAL_HANDLER_H #define SIGNAL_HANDLER_H diff --git a/common/snapException.h b/common/snapException.h index d54bb8c2..0cc8cb7e 100644 --- a/common/snapException.h +++ b/common/snapException.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef SNAP_EXCEPTION_H #define SNAP_EXCEPTION_H diff --git a/common/timeDefs.h b/common/timeDefs.h index a37e7f92..fcb46e6a 100644 --- a/common/timeDefs.h +++ b/common/timeDefs.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef TIME_DEFS_H #define TIME_DEFS_H diff --git a/common/utils.h b/common/utils.h index 16ba52bd..d00e98ac 100644 --- a/common/utils.h +++ b/common/utils.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef UTILS_H #define UTILS_H diff --git a/message/ack.h b/message/ack.h index f26abfff..f61ed57f 100644 --- a/message/ack.h +++ b/message/ack.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef ACK_MSG_H #define ACK_MSG_H diff --git a/message/command.h b/message/command.h index 04fba587..365bc77b 100644 --- a/message/command.h +++ b/message/command.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef COMMAND_MSG_H #define COMMAND_MSG_H diff --git a/message/header.h b/message/header.h index 7a3c731c..4ae169b5 100644 --- a/message/header.h +++ b/message/header.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef HEADER_MESSAGE_H #define HEADER_MESSAGE_H diff --git a/message/message.h b/message/message.h index cdcf2af0..8b8d0b08 100644 --- a/message/message.h +++ b/message/message.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef MESSAGE_H #define MESSAGE_H diff --git a/message/pcmChunk.cpp b/message/pcmChunk.cpp index 34c5ced4..32c0c14a 100644 --- a/message/pcmChunk.cpp +++ b/message/pcmChunk.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "pcmChunk.h" #include #include diff --git a/message/pcmChunk.h b/message/pcmChunk.h index 79143b6b..8f543468 100644 --- a/message/pcmChunk.h +++ b/message/pcmChunk.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef PCM_CHUNK_H #define PCM_CHUNK_H diff --git a/message/request.h b/message/request.h index 13b1638e..18133441 100644 --- a/message/request.h +++ b/message/request.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef REQUEST_MSG_H #define REQUEST_MSG_H diff --git a/message/sampleFormat.cpp b/message/sampleFormat.cpp index 5ac79446..a481e9cd 100644 --- a/message/sampleFormat.cpp +++ b/message/sampleFormat.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "sampleFormat.h" #include #include diff --git a/message/sampleFormat.h b/message/sampleFormat.h index c25aa8a7..aa65c426 100644 --- a/message/sampleFormat.h +++ b/message/sampleFormat.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef SAMPLE_FORMAT_H #define SAMPLE_FORMAT_H diff --git a/message/serverSettings.h b/message/serverSettings.h index a1b4c8c4..95ca069d 100644 --- a/message/serverSettings.h +++ b/message/serverSettings.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef SERVER_SETTINGS_H #define SERVER_SETTINGS_H diff --git a/message/time.h b/message/time.h index 7d2bc25a..4b5442c5 100644 --- a/message/time.h +++ b/message/time.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef TIME_MSG_H #define TIME_MSG_H diff --git a/message/wireChunk.h b/message/wireChunk.h index 2b825e30..3c923ff9 100644 --- a/message/wireChunk.h +++ b/message/wireChunk.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef WIRE_CHUNK_H #define WIRE_CHUNK_H diff --git a/server/Makefile b/server/Makefile index 82d71027..27ad269f 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,4 +1,4 @@ -VERSION = 0.1 +VERSION = 0.2 CC = /usr/bin/g++ CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\" -I.. LDFLAGS = -lrt -lpthread -lboost_system -lboost_program_options -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common diff --git a/server/controlServer.cpp b/server/controlServer.cpp index 42cf74dc..f977e408 100644 --- a/server/controlServer.cpp +++ b/server/controlServer.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "controlServer.h" #include "message/time.h" #include "message/ack.h" diff --git a/server/controlServer.h b/server/controlServer.h index 246e7607..6518cfe9 100644 --- a/server/controlServer.h +++ b/server/controlServer.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef CONTROL_SERVER_H #define CONTROL_SERVER_H diff --git a/server/encoder.h b/server/encoder.h index 73062518..920c058f 100644 --- a/server/encoder.h +++ b/server/encoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef ENCODER_H #define ENCODER_H #include "message/pcmChunk.h" diff --git a/server/flacEncoder.cpp b/server/flacEncoder.cpp index a3c23fb4..bbeae66b 100644 --- a/server/flacEncoder.cpp +++ b/server/flacEncoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "flacEncoder.h" #include "common/log.h" #include diff --git a/server/flacEncoder.h b/server/flacEncoder.h index 5a1469c4..62bcdd67 100644 --- a/server/flacEncoder.h +++ b/server/flacEncoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef FLAC_ENCODER_H #define FLAC_ENCODER_H #include "encoder.h" diff --git a/server/oggEncoder.cpp b/server/oggEncoder.cpp index 6a2b7519..f3f2408d 100644 --- a/server/oggEncoder.cpp +++ b/server/oggEncoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "oggEncoder.h" #include "common/log.h" #include diff --git a/server/oggEncoder.h b/server/oggEncoder.h index 0b91bc5f..dc1ffc08 100644 --- a/server/oggEncoder.h +++ b/server/oggEncoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef OGG_ENCODER_H #define OGG_ENCODER_H #include "encoder.h" diff --git a/server/pcmEncoder.cpp b/server/pcmEncoder.cpp index 7ab360e2..2f7eb7b6 100644 --- a/server/pcmEncoder.cpp +++ b/server/pcmEncoder.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "pcmEncoder.h" PcmEncoder::PcmEncoder(const msg::SampleFormat& format) : Encoder(format) diff --git a/server/pcmEncoder.h b/server/pcmEncoder.h index d53061e3..adf8df26 100644 --- a/server/pcmEncoder.h +++ b/server/pcmEncoder.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef PCM_ENCODER_H #define PCM_ENCODER_H #include "encoder.h" diff --git a/server/publishAvahi.cpp b/server/publishAvahi.cpp index 13ea3338..901057b1 100644 --- a/server/publishAvahi.cpp +++ b/server/publishAvahi.cpp @@ -17,21 +17,9 @@ USA. ***/ -#include -#include -#include #include - -#include -#include - -#include -#include -#include -#include -#include - #include "publishAvahi.h" +#include "common/log.h" static AvahiEntryGroup *group; @@ -56,7 +44,7 @@ void PublishAvahi::publish(const std::vector& services) /* Allocate main loop object */ if (!(simple_poll = avahi_simple_poll_new())) { - fprintf(stderr, "Failed to create simple poll object.\n"); + logE << "Failed to create simple poll object.\n"; } /* Allocate a new client */ @@ -65,7 +53,7 @@ void PublishAvahi::publish(const std::vector& services) /* Check wether creating the client object succeeded */ if (!client) { - fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error)); + logE << "Failed to create client: " << avahi_strerror(error) << "\n"; } active_ = true; @@ -103,7 +91,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState switch (state) { case AVAHI_ENTRY_GROUP_ESTABLISHED : /* The entry group has been established successfully */ - fprintf(stderr, "Service '%s' successfully established.\n", name); + logO << "Service '" << name << "' successfully established.\n"; break; case AVAHI_ENTRY_GROUP_COLLISION : { @@ -115,7 +103,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState avahi_free(name); name = n; - fprintf(stderr, "Service name collision, renaming service to '%s'\n", name); + logO << "Service name collision, renaming service to '" << name << "'\n"; /* And recreate the services */ static_cast(userdata)->create_services(avahi_entry_group_get_client(g)); @@ -124,7 +112,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState case AVAHI_ENTRY_GROUP_FAILURE : - fprintf(stderr, "Entry group failure: %s\n", avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); + logE << "Entry group failure: " << avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))) << "\n"; /* Some kind of failure happened while we were registering our services */ avahi_simple_poll_quit(simple_poll); @@ -147,7 +135,7 @@ void PublishAvahi::create_services(AvahiClient *c) { if (!group) { if (!(group = avahi_entry_group_new(c, entry_group_callback, NULL))) { - fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_client_errno(c))); + logE << "avahi_entry_group_new() failed: " << avahi_strerror(avahi_client_errno(c)) << "\n"; goto fail; } } @@ -155,7 +143,7 @@ void PublishAvahi::create_services(AvahiClient *c) { * because it was reset previously, add our entries. */ if (avahi_entry_group_is_empty(group)) { - fprintf(stderr, "Adding service '%s'\n", name); + logO << "Adding service '" << name << "'\n"; /* Create some random TXT data */ snprintf(r, sizeof(r), "random=%i", rand()); @@ -184,7 +172,7 @@ void PublishAvahi::create_services(AvahiClient *c) { if (ret == AVAHI_ERR_COLLISION) goto collision; - fprintf(stderr, "Failed to add _snapcast._tcp service: %s\n", avahi_strerror(ret)); + logE << "Failed to add " << services[n].name_ << " service: " << avahi_strerror(ret) << "\n"; goto fail; } } @@ -197,7 +185,7 @@ void PublishAvahi::create_services(AvahiClient *c) { */ /* Tell the server to register the service */ if ((ret = avahi_entry_group_commit(group)) < 0) { - fprintf(stderr, "Failed to commit entry group: %s\n", avahi_strerror(ret)); + logE << "Failed to commit entry group: " << avahi_strerror(ret) << "\n"; goto fail; } } @@ -212,7 +200,7 @@ collision: avahi_free(name); name = n; - fprintf(stderr, "Service name collision, renaming service to '%s'\n", name); + logO << "Service name collision, renaming service to '" << name << "'\n"; avahi_entry_group_reset(group); @@ -239,7 +227,7 @@ void PublishAvahi::client_callback(AvahiClient *c, AvahiClientState state, AVAHI case AVAHI_CLIENT_FAILURE: - fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c))); + logE << "Client failure: " << avahi_strerror(avahi_client_errno(c)) << "\n"; avahi_simple_poll_quit(simple_poll); break; @@ -267,17 +255,5 @@ void PublishAvahi::client_callback(AvahiClient *c, AvahiClientState state, AVAHI } } -/* -int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) -{ - PublishAvahi publishAvahi("SnapCast"); - std::vector services; - services.push_back(AvahiService("_snapcast._tcp", 123)); - publishAvahi.publish(services); - while (true) - usleep(100000); - return 0; -} -*/ diff --git a/server/publishAvahi.h b/server/publishAvahi.h index 4e39c1c9..64c358f7 100644 --- a/server/publishAvahi.h +++ b/server/publishAvahi.h @@ -1,3 +1,22 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + + #ifndef PUBLISH_AVAHI_H #define PUBLISH_AVAHI_H @@ -33,7 +52,6 @@ public: PublishAvahi(const std::string& serviceName); ~PublishAvahi(); void publish(const std::vector& services); - std::vector services; private: static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata); @@ -44,6 +62,7 @@ private: std::thread pollThread_; void worker(); std::atomic active_; + std::vector services; }; diff --git a/server/serverSession.cpp b/server/serverSession.cpp index 2dbb4eff..726b4a5b 100644 --- a/server/serverSession.cpp +++ b/server/serverSession.cpp @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #include "serverSession.h" #include #include diff --git a/server/serverSession.h b/server/serverSession.h index e663f20e..298de25f 100644 --- a/server/serverSession.h +++ b/server/serverSession.h @@ -1,3 +1,21 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + #ifndef SERVER_CONNECTION_H #define SERVER_CONNECTION_H diff --git a/server/snapServer.cpp b/server/snapServer.cpp index 1d075e56..b53d0c4e 100644 --- a/server/snapServer.cpp +++ b/server/snapServer.cpp @@ -1,3 +1,22 @@ +/*** + This file is part of snapcast + Copyright (C) 2015 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 . +***/ + + #include #include #include