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
3187eb30
Commit
3187eb30
authored
Jul 19, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s/ad/pd/ in the PluseAudio plugin (I forgot to rename when copying from alsa)
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4404
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
2728853e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
audioOutput_pulse.c
src/audioOutputs/audioOutput_pulse.c
+31
-31
No files found.
src/audioOutputs/audioOutput_pulse.c
View file @
3187eb30
...
...
@@ -56,28 +56,28 @@ static PulseData * newPulseData()
return
ret
;
}
static
void
freePulseData
(
PulseData
*
a
d
)
static
void
freePulseData
(
PulseData
*
p
d
)
{
if
(
ad
->
server
)
free
(
a
d
->
server
);
if
(
ad
->
sink
)
free
(
a
d
->
sink
);
free
(
a
d
);
if
(
pd
->
server
)
free
(
p
d
->
server
);
if
(
pd
->
sink
)
free
(
p
d
->
sink
);
free
(
p
d
);
}
static
int
pulse_initDriver
(
AudioOutput
*
audioOutput
,
ConfigParam
*
param
)
{
BlockParam
*
server
=
NULL
;
BlockParam
*
sink
=
NULL
;
PulseData
*
a
d
;
PulseData
*
p
d
;
if
(
param
)
{
server
=
getBlockParam
(
param
,
"server"
);
sink
=
getBlockParam
(
param
,
"sink"
);
}
a
d
=
newPulseData
();
a
d
->
server
=
server
?
strdup
(
server
->
value
)
:
NULL
;
a
d
->
sink
=
sink
?
strdup
(
sink
->
value
)
:
NULL
;
audioOutput
->
data
=
a
d
;
p
d
=
newPulseData
();
p
d
->
server
=
server
?
strdup
(
server
->
value
)
:
NULL
;
p
d
->
sink
=
sink
?
strdup
(
sink
->
value
)
:
NULL
;
audioOutput
->
data
=
p
d
;
return
0
;
}
...
...
@@ -112,21 +112,21 @@ static int pulse_testDefault()
static
int
pulse_openDevice
(
AudioOutput
*
audioOutput
)
{
PulseData
*
a
d
;
PulseData
*
p
d
;
AudioFormat
*
audioFormat
;
pa_sample_spec
ss
;
time_t
t
;
int
error
;
t
=
time
(
NULL
);
a
d
=
audioOutput
->
data
;
p
d
=
audioOutput
->
data
;
audioFormat
=
&
audioOutput
->
outAudioFormat
;
if
(
a
d
->
connAttempts
!=
0
&&
(
t
-
a
d
->
lastAttempt
)
<
CONN_ATTEMPT_INTERVAL
)
return
-
1
;
if
(
p
d
->
connAttempts
!=
0
&&
(
t
-
p
d
->
lastAttempt
)
<
CONN_ATTEMPT_INTERVAL
)
return
-
1
;
a
d
->
connAttempts
++
;
a
d
->
lastAttempt
=
t
;
p
d
->
connAttempts
++
;
p
d
->
lastAttempt
=
t
;
if
(
audioFormat
->
bits
!=
16
)
{
ERROR
(
"PulseAudio doesn't support %i bit audio
\n
"
,
...
...
@@ -138,17 +138,17 @@ static int pulse_openDevice(AudioOutput * audioOutput)
ss
.
rate
=
audioFormat
->
sampleRate
;
ss
.
channels
=
audioFormat
->
channels
;
ad
->
s
=
pa_simple_new
(
a
d
->
server
,
MPD_PULSE_NAME
,
PA_STREAM_PLAYBACK
,
a
d
->
sink
,
audioOutput
->
name
,
&
ss
,
NULL
,
NULL
,
pd
->
s
=
pa_simple_new
(
p
d
->
server
,
MPD_PULSE_NAME
,
PA_STREAM_PLAYBACK
,
p
d
->
sink
,
audioOutput
->
name
,
&
ss
,
NULL
,
NULL
,
&
error
);
if
(
!
a
d
->
s
)
{
if
(
!
p
d
->
s
)
{
ERROR
(
"Cannot connect to server in PulseAudio output "
\
"
\"
%s
\"
(attempt %i): %s
\n
"
,
audioOutput
->
name
,
a
d
->
connAttempts
,
pa_strerror
(
error
));
p
d
->
connAttempts
,
pa_strerror
(
error
));
return
-
1
;
}
a
d
->
connAttempts
=
0
;
p
d
->
connAttempts
=
0
;
audioOutput
->
open
=
1
;
DEBUG
(
"PulseAudio output
\"
%s
\"
connected and playing %i bit, %i "
\
...
...
@@ -160,23 +160,23 @@ static int pulse_openDevice(AudioOutput * audioOutput)
static
void
pulse_dropBufferedAudio
(
AudioOutput
*
audioOutput
)
{
PulseData
*
a
d
;
PulseData
*
p
d
;
int
error
;
a
d
=
audioOutput
->
data
;
if
(
pa_simple_flush
(
a
d
->
s
,
&
error
)
<
0
)
p
d
=
audioOutput
->
data
;
if
(
pa_simple_flush
(
p
d
->
s
,
&
error
)
<
0
)
WARNING
(
"Flush failed in PulseAudio output
\"
%s
\"
: %s
\n
"
,
audioOutput
->
name
,
pa_strerror
(
error
));
}
static
void
pulse_closeDevice
(
AudioOutput
*
audioOutput
)
{
PulseData
*
a
d
;
PulseData
*
p
d
;
a
d
=
audioOutput
->
data
;
if
(
a
d
->
s
)
{
pa_simple_drain
(
a
d
->
s
,
NULL
);
pa_simple_free
(
a
d
->
s
);
p
d
=
audioOutput
->
data
;
if
(
p
d
->
s
)
{
pa_simple_drain
(
p
d
->
s
,
NULL
);
pa_simple_free
(
p
d
->
s
);
}
audioOutput
->
open
=
0
;
...
...
@@ -185,12 +185,12 @@ static void pulse_closeDevice(AudioOutput * audioOutput)
static
int
pulse_playAudio
(
AudioOutput
*
audioOutput
,
char
*
playChunk
,
int
size
)
{
PulseData
*
a
d
;
PulseData
*
p
d
;
int
error
;
a
d
=
audioOutput
->
data
;
p
d
=
audioOutput
->
data
;
if
(
pa_simple_write
(
a
d
->
s
,
playChunk
,
size
,
&
error
)
<
0
)
{
if
(
pa_simple_write
(
p
d
->
s
,
playChunk
,
size
,
&
error
)
<
0
)
{
ERROR
(
"PulseAudio output
\"
%s
\"
disconnecting due to write "
\
"error: %s
\n
"
,
audioOutput
->
name
,
pa_strerror
(
error
));
pulse_closeDevice
(
audioOutput
);
...
...
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