Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e0fe4eb7
Commit
e0fe4eb7
authored
Dec 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm: use GLib logging
parent
f4ce43b9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
48 deletions
+57
-48
pcm_channels.c
src/pcm_channels.c
+7
-3
pcm_resample_libsamplerate.c
src/pcm_resample_libsamplerate.c
+11
-7
pcm_utils.c
src/pcm_utils.c
+8
-6
zeroconf.c
src/zeroconf.c
+31
-32
No files found.
src/pcm_channels.c
View file @
e0fe4eb7
...
@@ -18,10 +18,14 @@
...
@@ -18,10 +18,14 @@
#include "pcm_channels.h"
#include "pcm_channels.h"
#include "utils.h"
#include "utils.h"
#include "log.h"
#include <glib.h>
#include <assert.h>
#include <assert.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "pcm"
static
void
static
void
pcm_convert_channels_16_1_to_2
(
int16_t
*
dest
,
const
int16_t
*
src
,
pcm_convert_channels_16_1_to_2
(
int16_t
*
dest
,
const
int16_t
*
src
,
unsigned
num_frames
)
unsigned
num_frames
)
...
@@ -93,7 +97,7 @@ pcm_convert_channels_16(int8_t dest_channels,
...
@@ -93,7 +97,7 @@ pcm_convert_channels_16(int8_t dest_channels,
pcm_convert_channels_16_n_to_2
(
buf
,
src_channels
,
src
,
pcm_convert_channels_16_n_to_2
(
buf
,
src_channels
,
src
,
num_frames
);
num_frames
);
else
{
else
{
ERROR
(
"conversion %u->%u channels is not supported
\n
"
,
g_warning
(
"conversion %u->%u channels is not supported
"
,
src_channels
,
dest_channels
);
src_channels
,
dest_channels
);
return
NULL
;
return
NULL
;
}
}
...
@@ -172,7 +176,7 @@ pcm_convert_channels_24(int8_t dest_channels,
...
@@ -172,7 +176,7 @@ pcm_convert_channels_24(int8_t dest_channels,
pcm_convert_channels_24_n_to_2
(
buf
,
src_channels
,
src
,
pcm_convert_channels_24_n_to_2
(
buf
,
src_channels
,
src
,
num_frames
);
num_frames
);
else
{
else
{
ERROR
(
"conversion %u->%u channels is not supported
\n
"
,
g_warning
(
"conversion %u->%u channels is not supported
"
,
src_channels
,
dest_channels
);
src_channels
,
dest_channels
);
return
NULL
;
return
NULL
;
}
}
...
...
src/pcm_resample_libsamplerate.c
View file @
e0fe4eb7
...
@@ -19,13 +19,17 @@
...
@@ -19,13 +19,17 @@
#include "pcm_resample.h"
#include "pcm_resample.h"
#include "conf.h"
#include "conf.h"
#include "log.h"
#include "utils.h"
#include "utils.h"
#include <glib.h>
#include <assert.h>
#include <assert.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "pcm"
static
int
pcm_resample_get_converter
(
void
)
static
int
pcm_resample_get_converter
(
void
)
{
{
const
char
*
conf
=
getConfigParamValue
(
CONF_SAMPLERATE_CONVERTER
);
const
char
*
conf
=
getConfigParamValue
(
CONF_SAMPLERATE_CONVERTER
);
...
@@ -54,9 +58,9 @@ static int pcm_resample_get_converter(void)
...
@@ -54,9 +58,9 @@ static int pcm_resample_get_converter(void)
goto
out
;
goto
out
;
}
}
ERROR
(
"unknown samplerate converter
\"
%s
\"\n
"
,
conf
);
g_warning
(
"unknown samplerate converter
\"
%s
\"
"
,
conf
);
out:
out:
DEBUG
(
"selecting samplerate converter
\"
%s
\"\n
"
,
g_debug
(
"selecting samplerate converter
\"
%s
\"
"
,
src_get_name
(
convalgo
));
src_get_name
(
convalgo
));
return
convalgo
;
return
convalgo
;
...
@@ -89,14 +93,14 @@ pcm_resample_set(struct pcm_resample_state *state,
...
@@ -89,14 +93,14 @@ pcm_resample_set(struct pcm_resample_state *state,
state
->
state
=
src_new
(
convalgo
,
channels
,
&
error
);
state
->
state
=
src_new
(
convalgo
,
channels
,
&
error
);
if
(
!
state
->
state
)
{
if
(
!
state
->
state
)
{
ERROR
(
"cannot create new libsamplerate state: %s
\n
"
,
g_warning
(
"cannot create new libsamplerate state: %s
"
,
src_strerror
(
error
));
src_strerror
(
error
));
state
->
error
=
true
;
state
->
error
=
true
;
return
;
return
;
}
}
data
->
src_ratio
=
(
double
)
dest_rate
/
(
double
)
src_rate
;
data
->
src_ratio
=
(
double
)
dest_rate
/
(
double
)
src_rate
;
DEBUG
(
"setting samplerate conversion ratio to %.2lf
\n
"
,
g_debug
(
"setting samplerate conversion ratio to %.2lf
"
,
data
->
src_ratio
);
data
->
src_ratio
);
src_set_ratio
(
state
->
state
,
data
->
src_ratio
);
src_set_ratio
(
state
->
state
,
data
->
src_ratio
);
}
}
...
@@ -142,7 +146,7 @@ pcm_resample_16(uint8_t channels,
...
@@ -142,7 +146,7 @@ pcm_resample_16(uint8_t channels,
error
=
src_process
(
state
->
state
,
data
);
error
=
src_process
(
state
->
state
,
data
);
if
(
error
)
{
if
(
error
)
{
ERROR
(
"error processing samples with libsamplerate: %s
\n
"
,
g_warning
(
"error processing samples with libsamplerate: %s
"
,
src_strerror
(
error
));
src_strerror
(
error
));
state
->
error
=
true
;
state
->
error
=
true
;
return
0
;
return
0
;
...
@@ -215,7 +219,7 @@ pcm_resample_24(uint8_t channels,
...
@@ -215,7 +219,7 @@ pcm_resample_24(uint8_t channels,
error
=
src_process
(
state
->
state
,
data
);
error
=
src_process
(
state
->
state
,
data
);
if
(
error
)
{
if
(
error
)
{
ERROR
(
"error processing samples with libsamplerate: %s
\n
"
,
g_warning
(
"error processing samples with libsamplerate: %s
"
,
src_strerror
(
error
));
src_strerror
(
error
));
state
->
error
=
true
;
state
->
error
=
true
;
return
0
;
return
0
;
...
...
src/pcm_utils.c
View file @
e0fe4eb7
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include "pcm_utils.h"
#include "pcm_utils.h"
#include "pcm_channels.h"
#include "pcm_channels.h"
#include "log.h"
#include "utils.h"
#include "utils.h"
#include "conf.h"
#include "conf.h"
#include "audio_format.h"
#include "audio_format.h"
...
@@ -28,6 +27,9 @@
...
@@ -28,6 +27,9 @@
#include <math.h>
#include <math.h>
#include <glib.h>
#include <glib.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "pcm"
static
inline
int
static
inline
int
pcm_dither
(
void
)
pcm_dither
(
void
)
{
{
...
@@ -118,7 +120,7 @@ void pcm_volume(char *buffer, int bufferSize,
...
@@ -118,7 +120,7 @@ void pcm_volume(char *buffer, int bufferSize,
break
;
break
;
default:
default:
FATAL
(
"%u bits not supported by pcm_volume!
\n
"
,
g_error
(
"%u bits not supported by pcm_volume!
\n
"
,
format
->
bits
);
format
->
bits
);
}
}
}
}
...
@@ -193,7 +195,7 @@ static void pcm_add(char *buffer1, const char *buffer2, size_t size,
...
@@ -193,7 +195,7 @@ static void pcm_add(char *buffer1, const char *buffer2, size_t size,
break
;
break
;
default:
default:
FATAL
(
"%u bits not supported by pcm_add!
\n
"
,
format
->
bits
);
g_error
(
"%u bits not supported by pcm_add!
\n
"
,
format
->
bits
);
}
}
}
}
...
@@ -278,7 +280,7 @@ pcm_convert_to_16(struct pcm_convert_state *convert,
...
@@ -278,7 +280,7 @@ pcm_convert_to_16(struct pcm_convert_state *convert,
return
buf
;
return
buf
;
}
}
ERROR
(
"only 8 or 16 bits are supported for conversion!
\n
"
);
g_warning
(
"only 8 or 16 bits are supported for conversion!
\n
"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -340,7 +342,7 @@ pcm_convert_to_24(uint8_t bits, const void *src,
...
@@ -340,7 +342,7 @@ pcm_convert_to_24(uint8_t bits, const void *src,
return
src
;
return
src
;
}
}
ERROR
(
"only 8 or 24 bits are supported for conversion!
\n
"
);
g_warning
(
"only 8 or 24 bits are supported for conversion!
\n
"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -442,7 +444,7 @@ size_t pcm_convert(const struct audio_format *inFormat,
...
@@ -442,7 +444,7 @@ size_t pcm_convert(const struct audio_format *inFormat,
convState
);
convState
);
default:
default:
FATAL
(
"cannot convert to %u bit
\n
"
,
outFormat
->
bits
);
g_error
(
"cannot convert to %u bit
\n
"
,
outFormat
->
bits
);
}
}
}
}
...
...
src/zeroconf.c
View file @
e0fe4eb7
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include "zeroconf.h"
#include "zeroconf.h"
#include "conf.h"
#include "conf.h"
#include "log.h"
#include "listen.h"
#include "listen.h"
#include "ioops.h"
#include "ioops.h"
#include "utils.h"
#include "utils.h"
...
@@ -206,12 +205,12 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -206,12 +205,12 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
char
*
n
;
char
*
n
;
assert
(
g
);
assert
(
g
);
DEBUG
(
"Avahi: Service group changed to state %d
\n
"
,
state
);
g_debug
(
"Avahi: Service group changed to state %d
"
,
state
);
switch
(
state
)
{
switch
(
state
)
{
case
AVAHI_ENTRY_GROUP_ESTABLISHED
:
case
AVAHI_ENTRY_GROUP_ESTABLISHED
:
/* The entry group has been established successfully */
/* The entry group has been established successfully */
LOG
(
"Avahi: Service '%s' successfully established.
\n
"
,
g_message
(
"Avahi: Service '%s' successfully established.
"
,
avahiName
);
avahiName
);
break
;
break
;
...
@@ -221,7 +220,7 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -221,7 +220,7 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
avahi_free
(
avahiName
);
avahi_free
(
avahiName
);
avahiName
=
n
;
avahiName
=
n
;
LOG
(
"Avahi: Service name collision, renaming service to '%s'
\n
"
,
g_message
(
"Avahi: Service name collision, renaming service to '%s'
"
,
avahiName
);
avahiName
);
/* And recreate the services */
/* And recreate the services */
...
@@ -229,7 +228,7 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -229,7 +228,7 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
break
;
break
;
case
AVAHI_ENTRY_GROUP_FAILURE
:
case
AVAHI_ENTRY_GROUP_FAILURE
:
ERROR
(
"Avahi: Entry group failure: %s
\n
"
,
g_warning
(
"Avahi: Entry group failure: %s
"
,
avahi_strerror
(
avahi_client_errno
avahi_strerror
(
avahi_client_errno
(
avahi_entry_group_get_client
(
g
))));
(
avahi_entry_group_get_client
(
g
))));
/* Some kind of failure happened while we were registering our services */
/* Some kind of failure happened while we were registering our services */
...
@@ -237,10 +236,10 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -237,10 +236,10 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
break
;
break
;
case
AVAHI_ENTRY_GROUP_UNCOMMITED
:
case
AVAHI_ENTRY_GROUP_UNCOMMITED
:
DEBUG
(
"Avahi: Service group is UNCOMMITED
\n
"
);
g_debug
(
"Avahi: Service group is UNCOMMITED
"
);
break
;
break
;
case
AVAHI_ENTRY_GROUP_REGISTERING
:
case
AVAHI_ENTRY_GROUP_REGISTERING
:
DEBUG
(
"Avahi: Service group is REGISTERING
\n
"
);
g_debug
(
"Avahi: Service group is REGISTERING
"
);
}
}
}
}
...
@@ -249,14 +248,14 @@ static void avahiRegisterService(AvahiClient * c)
...
@@ -249,14 +248,14 @@ static void avahiRegisterService(AvahiClient * c)
{
{
int
ret
;
int
ret
;
assert
(
c
);
assert
(
c
);
DEBUG
(
"Avahi: Registering service %s/%s
\n
"
,
SERVICE_TYPE
,
avahiName
);
g_debug
(
"Avahi: Registering service %s/%s
"
,
SERVICE_TYPE
,
avahiName
);
/* If this is the first time we're called,
/* If this is the first time we're called,
* let's create a new entry group */
* let's create a new entry group */
if
(
!
avahiGroup
)
{
if
(
!
avahiGroup
)
{
avahiGroup
=
avahi_entry_group_new
(
c
,
avahiGroupCallback
,
NULL
);
avahiGroup
=
avahi_entry_group_new
(
c
,
avahiGroupCallback
,
NULL
);
if
(
!
avahiGroup
)
{
if
(
!
avahiGroup
)
{
ERROR
(
"Avahi: Failed to create avahi EntryGroup: %s
\n
"
,
g_warning
(
"Avahi: Failed to create avahi EntryGroup: %s
"
,
avahi_strerror
(
avahi_client_errno
(
c
)));
avahi_strerror
(
avahi_client_errno
(
c
)));
goto
fail
;
goto
fail
;
}
}
...
@@ -271,7 +270,7 @@ static void avahiRegisterService(AvahiClient * c)
...
@@ -271,7 +270,7 @@ static void avahiRegisterService(AvahiClient * c)
0
,
avahiName
,
SERVICE_TYPE
,
NULL
,
0
,
avahiName
,
SERVICE_TYPE
,
NULL
,
NULL
,
boundPort
,
NULL
);
NULL
,
boundPort
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Avahi: Failed to add service %s: %s
\n
"
,
SERVICE_TYPE
,
g_warning
(
"Avahi: Failed to add service %s: %s
"
,
SERVICE_TYPE
,
avahi_strerror
(
ret
));
avahi_strerror
(
ret
));
goto
fail
;
goto
fail
;
}
}
...
@@ -279,7 +278,7 @@ static void avahiRegisterService(AvahiClient * c)
...
@@ -279,7 +278,7 @@ static void avahiRegisterService(AvahiClient * c)
/* Tell the server to register the service group */
/* Tell the server to register the service group */
ret
=
avahi_entry_group_commit
(
avahiGroup
);
ret
=
avahi_entry_group_commit
(
avahiGroup
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Avahi: Failed to commit service group: %s
\n
"
,
g_warning
(
"Avahi: Failed to commit service group: %s
"
,
avahi_strerror
(
ret
));
avahi_strerror
(
ret
));
goto
fail
;
goto
fail
;
}
}
...
@@ -297,11 +296,11 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
...
@@ -297,11 +296,11 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
assert
(
c
);
assert
(
c
);
/* Called whenever the client or server state changes */
/* Called whenever the client or server state changes */
DEBUG
(
"Avahi: Client changed to state %d
\n
"
,
state
);
g_debug
(
"Avahi: Client changed to state %d
"
,
state
);
switch
(
state
)
{
switch
(
state
)
{
case
AVAHI_CLIENT_S_RUNNING
:
case
AVAHI_CLIENT_S_RUNNING
:
DEBUG
(
"Avahi: Client is RUNNING
\n
"
);
g_debug
(
"Avahi: Client is RUNNING
"
);
/* The server has startup successfully and registered its host
/* The server has startup successfully and registered its host
* name on the network, so it's time to create our services */
* name on the network, so it's time to create our services */
...
@@ -312,8 +311,8 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
...
@@ -312,8 +311,8 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
case
AVAHI_CLIENT_FAILURE
:
case
AVAHI_CLIENT_FAILURE
:
reason
=
avahi_client_errno
(
c
);
reason
=
avahi_client_errno
(
c
);
if
(
reason
==
AVAHI_ERR_DISCONNECTED
)
{
if
(
reason
==
AVAHI_ERR_DISCONNECTED
)
{
LOG
(
"Avahi: Client Disconnected, "
g_message
(
"Avahi: Client Disconnected, "
"will reconnect shortly
\n
"
);
"will reconnect shortly
"
);
if
(
avahiGroup
)
{
if
(
avahiGroup
)
{
avahi_entry_group_free
(
avahiGroup
);
avahi_entry_group_free
(
avahiGroup
);
avahiGroup
=
NULL
;
avahiGroup
=
NULL
;
...
@@ -326,43 +325,43 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
...
@@ -326,43 +325,43 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
avahiClientCallback
,
NULL
,
avahiClientCallback
,
NULL
,
&
reason
);
&
reason
);
if
(
!
avahiClient
)
{
if
(
!
avahiClient
)
{
ERROR
(
"Avahi: Could not reconnect: %s
\n
"
,
g_warning
(
"Avahi: Could not reconnect: %s
"
,
avahi_strerror
(
reason
));
avahi_strerror
(
reason
));
avahiRunning
=
0
;
avahiRunning
=
0
;
}
}
}
else
{
}
else
{
ERROR
(
"Avahi: Client failure: %s (terminal)
\n
"
,
g_warning
(
"Avahi: Client failure: %s (terminal)
"
,
avahi_strerror
(
reason
));
avahi_strerror
(
reason
));
avahiRunning
=
0
;
avahiRunning
=
0
;
}
}
break
;
break
;
case
AVAHI_CLIENT_S_COLLISION
:
case
AVAHI_CLIENT_S_COLLISION
:
DEBUG
(
"Avahi: Client is COLLISION
\n
"
);
g_debug
(
"Avahi: Client is COLLISION
"
);
/* Let's drop our registered services. When the server is back
/* Let's drop our registered services. When the server is back
* in AVAHI_SERVER_RUNNING state we will register them
* in AVAHI_SERVER_RUNNING state we will register them
* again with the new host name. */
* again with the new host name. */
if
(
avahiGroup
)
{
if
(
avahiGroup
)
{
DEBUG
(
"Avahi: Resetting group
\n
"
);
g_debug
(
"Avahi: Resetting group
"
);
avahi_entry_group_reset
(
avahiGroup
);
avahi_entry_group_reset
(
avahiGroup
);
}
}
case
AVAHI_CLIENT_S_REGISTERING
:
case
AVAHI_CLIENT_S_REGISTERING
:
DEBUG
(
"Avahi: Client is REGISTERING
\n
"
);
g_debug
(
"Avahi: Client is REGISTERING
"
);
/* The server records are now being established. This
/* The server records are now being established. This
* might be caused by a host name change. We need to wait
* might be caused by a host name change. We need to wait
* for our own records to register until the host name is
* for our own records to register until the host name is
* properly esatblished. */
* properly esatblished. */
if
(
avahiGroup
)
{
if
(
avahiGroup
)
{
DEBUG
(
"Avahi: Resetting group
\n
"
);
g_debug
(
"Avahi: Resetting group
"
);
avahi_entry_group_reset
(
avahiGroup
);
avahi_entry_group_reset
(
avahiGroup
);
}
}
break
;
break
;
case
AVAHI_CLIENT_CONNECTING
:
case
AVAHI_CLIENT_CONNECTING
:
DEBUG
(
"Avahi: Client is CONNECTING
\n
"
);
g_debug
(
"Avahi: Client is CONNECTING
"
);
}
}
}
}
...
@@ -383,7 +382,7 @@ static int avahiFdset(fd_set * rfds, fd_set * wfds, fd_set * efds)
...
@@ -383,7 +382,7 @@ static int avahiFdset(fd_set * rfds, fd_set * wfds, fd_set * efds)
FD_SET
(
w
->
fd
,
efds
);
FD_SET
(
w
->
fd
,
efds
);
}
}
if
(
w
->
requestedEvent
&
AVAHI_WATCH_HUP
)
{
if
(
w
->
requestedEvent
&
AVAHI_WATCH_HUP
)
{
ERROR
(
"Avahi: No support for HUP events! (ignoring)
\n
"
);
g_warning
(
"Avahi: No support for HUP events! (ignoring)
"
);
}
}
if
(
w
->
fd
>
maxfd
)
if
(
w
->
fd
>
maxfd
)
...
@@ -447,13 +446,13 @@ static int avahiFdconsume(int fdCount, fd_set * rfds, fd_set * wfds,
...
@@ -447,13 +446,13 @@ static int avahiFdconsume(int fdCount, fd_set * rfds, fd_set * wfds,
static
void
init_avahi
(
const
char
*
serviceName
)
static
void
init_avahi
(
const
char
*
serviceName
)
{
{
int
error
;
int
error
;
DEBUG
(
"Avahi: Initializing interface
\n
"
);
g_debug
(
"Avahi: Initializing interface
"
);
if
(
avahi_is_valid_service_name
(
serviceName
))
{
if
(
avahi_is_valid_service_name
(
serviceName
))
{
avahiName
=
avahi_strdup
(
serviceName
);
avahiName
=
avahi_strdup
(
serviceName
);
}
else
{
}
else
{
ERROR
(
"Invalid zeroconf_name
\"
%s
\"
, defaulting to "
g_warning
(
"Invalid zeroconf_name
\"
%s
\"
, defaulting to "
"
\"
%s
\"
instead.
\n
"
,
"
\"
%s
\"
instead.
"
,
serviceName
,
SERVICE_NAME
);
serviceName
,
SERVICE_NAME
);
avahiName
=
avahi_strdup
(
SERVICE_NAME
);
avahiName
=
avahi_strdup
(
SERVICE_NAME
);
}
}
...
@@ -473,7 +472,7 @@ static void init_avahi(const char *serviceName)
...
@@ -473,7 +472,7 @@ static void init_avahi(const char *serviceName)
avahiClientCallback
,
NULL
,
&
error
);
avahiClientCallback
,
NULL
,
&
error
);
if
(
!
avahiClient
)
{
if
(
!
avahiClient
)
{
ERROR
(
"Avahi: Failed to create client: %s
\n
"
,
g_warning
(
"Avahi: Failed to create client: %s
"
,
avahi_strerror
(
error
));
avahi_strerror
(
error
));
goto
fail
;
goto
fail
;
}
}
...
@@ -535,13 +534,13 @@ static void dnsRegisterCallback(DNSServiceRef sdRef, DNSServiceFlags flags,
...
@@ -535,13 +534,13 @@ static void dnsRegisterCallback(DNSServiceRef sdRef, DNSServiceFlags flags,
void
*
context
)
void
*
context
)
{
{
if
(
errorCode
!=
kDNSServiceErr_NoError
)
{
if
(
errorCode
!=
kDNSServiceErr_NoError
)
{
ERROR
(
"Failed to register zeroconf service.
\n
"
);
g_warning
(
"Failed to register zeroconf service.
"
);
DNSServiceRefDeallocate
(
dnsReference
);
DNSServiceRefDeallocate
(
dnsReference
);
dnsReference
=
NULL
;
dnsReference
=
NULL
;
deregisterIO
(
&
zeroConfIo
);
deregisterIO
(
&
zeroConfIo
);
}
else
{
}
else
{
DEBUG
(
"Registered zeroconf service with name '%s'
\n
"
,
name
);
g_debug
(
"Registered zeroconf service with name '%s'
"
,
name
);
}
}
}
}
...
@@ -556,7 +555,7 @@ static void init_zeroconf_osx(const char *serviceName)
...
@@ -556,7 +555,7 @@ static void init_zeroconf_osx(const char *serviceName)
NULL
);
NULL
);
if
(
error
!=
kDNSServiceErr_NoError
)
{
if
(
error
!=
kDNSServiceErr_NoError
)
{
ERROR
(
"Failed to register zeroconf service.
\n
"
);
g_warning
(
"Failed to register zeroconf service.
"
);
if
(
dnsReference
)
{
if
(
dnsReference
)
{
DNSServiceRefDeallocate
(
dnsReference
);
DNSServiceRefDeallocate
(
dnsReference
);
...
@@ -603,7 +602,7 @@ void finishZeroconf(void)
...
@@ -603,7 +602,7 @@ void finishZeroconf(void)
return
;
return
;
#ifdef HAVE_AVAHI
#ifdef HAVE_AVAHI
DEBUG
(
"Avahi: Shutting down interface
\n
"
);
g_debug
(
"Avahi: Shutting down interface
"
);
deregisterIO
(
&
zeroConfIo
);
deregisterIO
(
&
zeroConfIo
);
if
(
avahiGroup
)
{
if
(
avahiGroup
)
{
...
@@ -625,7 +624,7 @@ void finishZeroconf(void)
...
@@ -625,7 +624,7 @@ void finishZeroconf(void)
if
(
dnsReference
!=
NULL
)
{
if
(
dnsReference
!=
NULL
)
{
DNSServiceRefDeallocate
(
dnsReference
);
DNSServiceRefDeallocate
(
dnsReference
);
dnsReference
=
NULL
;
dnsReference
=
NULL
;
DEBUG
(
"Deregistered Zeroconf service.
\n
"
);
g_debug
(
"Deregistered Zeroconf service.
"
);
}
}
#endif
#endif
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment