mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 10:51:45 +02:00
code formatting
This commit is contained in:
parent
b7d4034e43
commit
56389ad202
6 changed files with 114 additions and 107 deletions
|
@ -61,19 +61,21 @@ void BrowseAvahi::resolve_callback(
|
|||
uint16_t port,
|
||||
AvahiStringList *txt,
|
||||
AvahiLookupResultFlags flags,
|
||||
AVAHI_GCC_UNUSED void* userdata) {
|
||||
|
||||
AVAHI_GCC_UNUSED void* userdata)
|
||||
{
|
||||
BrowseAvahi* browseAvahi = static_cast<BrowseAvahi*>(userdata);
|
||||
assert(r);
|
||||
|
||||
/* Called whenever a service has been resolved successfully or timed out */
|
||||
|
||||
switch (event) {
|
||||
switch (event)
|
||||
{
|
||||
case AVAHI_RESOLVER_FAILURE:
|
||||
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: {
|
||||
case AVAHI_RESOLVER_FOUND:
|
||||
{
|
||||
char a[AVAHI_ADDRESS_STR_MAX], *t;
|
||||
|
||||
logO << "Service '" << name << "' of type '" << type << "' in domain '" << domain << "':\n";
|
||||
|
@ -121,9 +123,9 @@ void BrowseAvahi::browse_callback(
|
|||
|
||||
/* Called whenever a new services becomes available on the LAN or is removed from the LAN */
|
||||
|
||||
switch (event) {
|
||||
switch (event)
|
||||
{
|
||||
case AVAHI_BROWSER_FAILURE:
|
||||
|
||||
logE << "(Browser) " << avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))) << "\n";
|
||||
avahi_simple_poll_quit(simple_poll);
|
||||
return;
|
||||
|
@ -159,7 +161,8 @@ void BrowseAvahi::client_callback(AvahiClient *c, AvahiClientState state, AVAHI_
|
|||
/* Called whenever the client or server state changes */
|
||||
// BrowseAvahi* browseAvahi = static_cast<BrowseAvahi*>(userdata);
|
||||
|
||||
if (state == AVAHI_CLIENT_FAILURE) {
|
||||
if (state == AVAHI_CLIENT_FAILURE)
|
||||
{
|
||||
logE << "Server connection failure: " << avahi_strerror(avahi_client_errno(c)) << "\n";
|
||||
avahi_simple_poll_quit(simple_poll);
|
||||
}
|
||||
|
@ -171,7 +174,8 @@ bool BrowseAvahi::browse(const std::string& serviceName, int proto, AvahiResult&
|
|||
int error;
|
||||
|
||||
/* Allocate main loop object */
|
||||
if (!(simple_poll = avahi_simple_poll_new())) {
|
||||
if (!(simple_poll = avahi_simple_poll_new()))
|
||||
{
|
||||
logE << "Failed to create simple poll object.\n";
|
||||
goto fail;
|
||||
}
|
||||
|
@ -180,13 +184,15 @@ bool BrowseAvahi::browse(const std::string& serviceName, int proto, AvahiResult&
|
|||
client_ = avahi_client_new(avahi_simple_poll_get(simple_poll), (AvahiClientFlags)0, client_callback, this, &error);
|
||||
|
||||
/* Check wether creating the client object succeeded */
|
||||
if (!client_) {
|
||||
if (!client_)
|
||||
{
|
||||
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))) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <unistd.h>
|
||||
#include "oggDecoder.h"
|
||||
#include "pcmDecoder.h"
|
||||
#include "flacDecoder.h"
|
||||
|
@ -123,7 +122,7 @@ void Controller::worker()
|
|||
decoder_->setHeader(headerChunk.get());
|
||||
|
||||
msg::Request timeReq(kTime);
|
||||
for (size_t n=0; n<100 && active_; ++n)
|
||||
for (size_t n=0; n<50 && active_; ++n)
|
||||
{
|
||||
shared_ptr<msg::Time> reply = clientConnection_->sendReq<msg::Time>(&timeReq, chronos::msec(2000));
|
||||
if (reply)
|
||||
|
|
|
@ -276,7 +276,10 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
|
|||
}
|
||||
}
|
||||
|
||||
// framesCorrection = number of frames to be read more or less to get in-sync
|
||||
long framesCorrection = correction.count()*format_.usRate();
|
||||
|
||||
// sample rate correction
|
||||
if ((correctAfterXFrames_ != 0) && (playedFrames_ >= (unsigned long)abs(correctAfterXFrames_)))
|
||||
{
|
||||
framesCorrection += (correctAfterXFrames_ > 0)?1:-1;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
USA.
|
||||
***/
|
||||
|
||||
#include <unistd.h>
|
||||
#include "publishAvahi.h"
|
||||
#include "common/log.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue