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
6a0a5f96
Commit
6a0a5f96
authored
Dec 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pulse: move SetError() to lib/pulse/Error.cxx
parent
fe9db8b3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
17 deletions
+76
-17
Makefile.am
Makefile.am
+1
-0
Error.cxx
src/lib/pulse/Error.cxx
+33
-0
Error.hxx
src/lib/pulse/Error.hxx
+29
-0
PulseOutputPlugin.cxx
src/output/plugins/PulseOutputPlugin.cxx
+13
-17
No files found.
Makefile.am
View file @
6a0a5f96
...
...
@@ -1351,6 +1351,7 @@ libmixer_plugins_a_SOURCES += \
noinst_LIBRARIES
+=
libpulse.a
libpulse_a_SOURCES
=
\
src/lib/pulse/Error.cxx src/lib/pulse/Error.hxx
\
src/lib/pulse/Domain.cxx src/lib/pulse/Domain.hxx
libpulse_a_CPPFLAGS
=
$(AM_CPPFLAGS)
$(PULSE_CFLAGS)
PULSE_LIBS2
=
libpulse.a
$(PULSE_LIBS)
...
...
src/lib/pulse/Error.cxx
0 → 100644
View file @
6a0a5f96
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Error.hxx"
#include "Domain.hxx"
#include "util/Error.hxx"
#include <pulse/context.h>
#include <pulse/error.h>
void
SetPulseError
(
Error
&
error
,
pa_context
*
context
,
const
char
*
prefix
)
{
const
int
e
=
pa_context_errno
(
context
);
error
.
Format
(
pulse_domain
,
e
,
"%s: %s"
,
prefix
,
pa_strerror
(
e
));
}
src/lib/pulse/Error.hxx
0 → 100644
View file @
6a0a5f96
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_PULSE_ERROR_HXX
#define MPD_PULSE_ERROR_HXX
class
Error
;
struct
pa_context
;
void
SetPulseError
(
Error
&
error
,
pa_context
*
context
,
const
char
*
prefix
);
#endif
src/output/plugins/PulseOutputPlugin.cxx
View file @
6a0a5f96
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "PulseOutputPlugin.hxx"
#include "lib/pulse/Domain.hxx"
#include "lib/pulse/Error.hxx"
#include "../OutputAPI.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/plugins/PulseMixerPlugin.hxx"
...
...
@@ -31,7 +32,6 @@
#include <pulse/stream.h>
#include <pulse/introspect.h>
#include <pulse/subscribe.h>
#include <pulse/error.h>
#include <pulse/version.h>
#include <assert.h>
...
...
@@ -59,13 +59,6 @@ struct PulseOutput {
:
base
(
pulse_output_plugin
)
{}
};
static
void
SetError
(
Error
&
error
,
pa_context
*
context
,
const
char
*
msg
)
{
const
int
e
=
pa_context_errno
(
context
);
error
.
Format
(
pulse_domain
,
e
,
"%s: %s"
,
msg
,
pa_strerror
(
e
));
}
void
pulse_output_lock
(
PulseOutput
&
po
)
{
...
...
@@ -126,7 +119,7 @@ pulse_output_set_volume(PulseOutput &po, const pa_cvolume *volume,
pa_stream_get_index
(
po
.
stream
),
volume
,
nullptr
,
nullptr
);
if
(
o
==
nullptr
)
{
SetError
(
error
,
po
.
context
,
Set
Pulse
Error
(
error
,
po
.
context
,
"failed to set PulseAudio volume"
);
return
false
;
}
...
...
@@ -237,7 +230,7 @@ pulse_output_connect(PulseOutput *po, Error &error)
if
(
pa_context_connect
(
po
->
context
,
po
->
server
,
(
pa_context_flags_t
)
0
,
nullptr
)
<
0
)
{
SetError
(
error
,
po
->
context
,
Set
Pulse
Error
(
error
,
po
->
context
,
"pa_context_connect() has failed"
);
return
false
;
}
...
...
@@ -437,7 +430,7 @@ pulse_output_wait_connection(PulseOutput *po, Error &error)
case
PA_CONTEXT_TERMINATED
:
case
PA_CONTEXT_FAILED
:
/* failure */
SetError
(
error
,
po
->
context
,
"failed to connect"
);
Set
Pulse
Error
(
error
,
po
->
context
,
"failed to connect"
);
pulse_output_delete_context
(
po
);
return
false
;
...
...
@@ -527,7 +520,8 @@ pulse_output_setup_stream(PulseOutput *po, const pa_sample_spec *ss,
PA_CHANNEL_MAP_WAVEEX
);
po
->
stream
=
pa_stream_new
(
po
->
context
,
po
->
name
,
ss
,
&
chan_map
);
if
(
po
->
stream
==
nullptr
)
{
SetError
(
error
,
po
->
context
,
"pa_stream_new() has failed"
);
SetPulseError
(
error
,
po
->
context
,
"pa_stream_new() has failed"
);
return
false
;
}
...
...
@@ -599,7 +593,7 @@ pulse_output_open(AudioOutput *ao, AudioFormat &audio_format,
nullptr
,
nullptr
)
<
0
)
{
pulse_output_delete_stream
(
po
);
SetError
(
error
,
po
->
context
,
Set
Pulse
Error
(
error
,
po
->
context
,
"pa_stream_connect_playback() has failed"
);
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
return
false
;
...
...
@@ -657,7 +651,7 @@ pulse_output_wait_stream(PulseOutput *po, Error &error)
case
PA_STREAM_FAILED
:
case
PA_STREAM_TERMINATED
:
case
PA_STREAM_UNCONNECTED
:
SetError
(
error
,
po
->
context
,
Set
Pulse
Error
(
error
,
po
->
context
,
"failed to connect the stream"
);
return
false
;
...
...
@@ -684,12 +678,14 @@ pulse_output_stream_pause(PulseOutput *po, bool pause,
o
=
pa_stream_cork
(
po
->
stream
,
pause
,
pulse_output_stream_success_cb
,
po
);
if
(
o
==
nullptr
)
{
SetError
(
error
,
po
->
context
,
"pa_stream_cork() has failed"
);
SetPulseError
(
error
,
po
->
context
,
"pa_stream_cork() has failed"
);
return
false
;
}
if
(
!
pulse_wait_for_operation
(
po
->
mainloop
,
o
))
{
SetError
(
error
,
po
->
context
,
"pa_stream_cork() has failed"
);
SetPulseError
(
error
,
po
->
context
,
"pa_stream_cork() has failed"
);
return
false
;
}
...
...
@@ -772,7 +768,7 @@ pulse_output_play(AudioOutput *ao, const void *chunk, size_t size,
0
,
PA_SEEK_RELATIVE
);
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
if
(
result
<
0
)
{
SetError
(
error
,
po
->
context
,
"pa_stream_write() failed"
);
Set
Pulse
Error
(
error
,
po
->
context
,
"pa_stream_write() failed"
);
return
0
;
}
...
...
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