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
f6f2a3b3
Commit
f6f2a3b3
authored
Oct 28, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: throw C++ exception on init error
parent
d52c7e7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+6
-22
No files found.
src/output/plugins/AlsaOutputPlugin.cxx
View file @
f6f2a3b3
...
...
@@ -78,7 +78,7 @@ struct AlsaOutput {
unsigned
int
period_time
;
/** the mode flags passed to snd_pcm_open */
int
mode
;
int
mode
=
0
;
/** the libasound PCM device handle */
snd_pcm_t
*
pcm
;
...
...
@@ -122,10 +122,7 @@ struct AlsaOutput {
*/
uint8_t
*
silence
;
AlsaOutput
()
:
base
(
alsa_output_plugin
),
mode
(
0
)
{
}
AlsaOutput
(
const
ConfigBlock
&
block
);
~
AlsaOutput
()
{
/* free libasound's config cache */
...
...
@@ -137,7 +134,6 @@ struct AlsaOutput {
return
device
.
empty
()
?
default_device
:
device
.
c_str
();
}
bool
Configure
(
const
ConfigBlock
&
block
,
Error
&
error
);
static
AlsaOutput
*
Create
(
const
ConfigBlock
&
block
,
Error
&
error
);
bool
Enable
(
Error
&
error
);
...
...
@@ -173,12 +169,9 @@ private:
static
constexpr
Domain
alsa_output_domain
(
"alsa_output"
);
inline
bool
AlsaOutput
::
Configure
(
const
ConfigBlock
&
block
,
Error
&
error
)
AlsaOutput
::
AlsaOutput
(
const
ConfigBlock
&
block
)
:
base
(
alsa_output_plugin
,
block
)
{
if
(
!
base
.
Configure
(
block
,
error
))
return
false
;
device
=
block
.
GetBlockValue
(
"device"
,
""
);
#ifdef ENABLE_DSD
...
...
@@ -205,21 +198,12 @@ AlsaOutput::Configure(const ConfigBlock &block, Error &error)
if
(
!
block
.
GetBlockValue
(
"auto_format"
,
true
))
mode
|=
SND_PCM_NO_AUTO_FORMAT
;
#endif
return
true
;
}
inline
AlsaOutput
*
AlsaOutput
::
Create
(
const
ConfigBlock
&
block
,
Error
&
error
)
AlsaOutput
::
Create
(
const
ConfigBlock
&
block
,
Error
&
)
{
AlsaOutput
*
ad
=
new
AlsaOutput
();
if
(
!
ad
->
Configure
(
block
,
error
))
{
delete
ad
;
return
nullptr
;
}
return
ad
;
return
new
AlsaOutput
(
block
);
}
inline
bool
...
...
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