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
d692e925
Commit
d692e925
authored
Oct 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pulse: use GLib instead of util.h/log.h
Use GLib allocation and logging functions.
parent
38df1754
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
pulse_plugin.c
src/output/pulse_plugin.c
+13
-16
No files found.
src/output/pulse_plugin.c
View file @
d692e925
...
...
@@ -17,9 +17,8 @@
*/
#include "../output_api.h"
#include "../utils.h"
#include "../log.h"
#include <glib.h>
#include <pulse/simple.h>
#include <pulse/error.h>
...
...
@@ -40,7 +39,7 @@ static struct pulse_data *pulse_new_data(void)
{
struct
pulse_data
*
ret
;
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
ret
=
g_new
(
struct
pulse_data
,
1
);
ret
->
s
=
NULL
;
ret
->
server
=
NULL
;
...
...
@@ -53,11 +52,9 @@ static struct pulse_data *pulse_new_data(void)
static
void
pulse_free_data
(
struct
pulse_data
*
pd
)
{
if
(
pd
->
server
)
free
(
pd
->
server
);
if
(
pd
->
sink
)
free
(
pd
->
sink
);
free
(
pd
);
g_free
(
pd
->
server
);
g_free
(
pd
->
sink
);
g_free
(
pd
);
}
static
void
*
...
...
@@ -76,8 +73,8 @@ pulse_init(struct audio_output *ao,
pd
=
pulse_new_data
();
pd
->
ao
=
ao
;
pd
->
server
=
server
?
xstrdup
(
server
->
value
)
:
NULL
;
pd
->
sink
=
sink
?
xstrdup
(
sink
->
value
)
:
NULL
;
pd
->
server
=
g_strdup
(
server
->
value
)
;
pd
->
sink
=
g_strdup
(
sink
->
value
)
;
return
pd
;
}
...
...
@@ -102,7 +99,7 @@ static int pulse_test_default_device(void)
s
=
pa_simple_new
(
NULL
,
MPD_PULSE_NAME
,
PA_STREAM_PLAYBACK
,
NULL
,
MPD_PULSE_NAME
,
&
ss
,
NULL
,
NULL
,
&
error
);
if
(
!
s
)
{
WARNING
(
"Cannot connect to default PulseAudio server: %s
\n
"
,
g_message
(
"Cannot connect to default PulseAudio server: %s
\n
"
,
pa_strerror
(
error
));
return
-
1
;
}
...
...
@@ -142,7 +139,7 @@ pulse_open(void *data, struct audio_format *audio_format)
&
ss
,
NULL
,
NULL
,
&
error
);
if
(
!
pd
->
s
)
{
ERROR
(
"Cannot connect to server in PulseAudio output "
g_warning
(
"Cannot connect to server in PulseAudio output "
"
\"
%s
\"
(attempt %i): %s
\n
"
,
audio_output_get_name
(
pd
->
ao
),
pd
->
num_connect_attempts
,
pa_strerror
(
error
));
...
...
@@ -151,7 +148,7 @@ pulse_open(void *data, struct audio_format *audio_format)
pd
->
num_connect_attempts
=
0
;
DEBUG
(
"PulseAudio output
\"
%s
\"
connected and playing %i bit, %i "
g_debug
(
"PulseAudio output
\"
%s
\"
connected and playing %i bit, %i "
"channel audio at %i Hz
\n
"
,
audio_output_get_name
(
pd
->
ao
),
audio_format
->
bits
,
...
...
@@ -166,7 +163,7 @@ static void pulse_cancel(void *data)
int
error
;
if
(
pa_simple_flush
(
pd
->
s
,
&
error
)
<
0
)
WARNING
(
"Flush failed in PulseAudio output
\"
%s
\"
: %s
\n
"
,
g_warning
(
"Flush failed in PulseAudio output
\"
%s
\"
: %s
\n
"
,
audio_output_get_name
(
pd
->
ao
),
pa_strerror
(
error
));
}
...
...
@@ -188,8 +185,8 @@ static int pulse_play(void *data,
int
error
;
if
(
pa_simple_write
(
pd
->
s
,
playChunk
,
size
,
&
error
)
<
0
)
{
ERROR
(
"PulseAudio output
\"
%s
\"
disconnecting due to write
"
"
error: %s
\n
"
,
g_warning
(
"PulseAudio output
\"
%s
\"
disconnecting due to
"
"write
error: %s
\n
"
,
audio_output_get_name
(
pd
->
ao
),
pa_strerror
(
error
));
pulse_close
(
pd
);
...
...
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