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
93a14a93
Commit
93a14a93
authored
Nov 04, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: use Error::FormatPrefix()
parent
d6559e2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+21
-12
No files found.
src/output/plugins/AlsaOutputPlugin.cxx
View file @
93a14a93
...
@@ -501,8 +501,7 @@ configure_hw:
...
@@ -501,8 +501,7 @@ configure_hw:
err
=
AlsaSetupFormat
(
ad
->
pcm
,
hwparams
,
audio_format
,
params
);
err
=
AlsaSetupFormat
(
ad
->
pcm
,
hwparams
,
audio_format
,
params
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
error
.
Format
(
alsa_output_domain
,
err
,
error
.
Format
(
alsa_output_domain
,
err
,
"ALSA device
\"
%s
\"
does not support format %s: %s"
,
"Failed to configure format %s: %s"
,
ad
->
GetDevice
(),
sample_format_to_string
(
audio_format
.
format
),
sample_format_to_string
(
audio_format
.
format
),
snd_strerror
(
-
err
));
snd_strerror
(
-
err
));
return
false
;
return
false
;
...
@@ -518,8 +517,8 @@ configure_hw:
...
@@ -518,8 +517,8 @@ configure_hw:
&
channels
);
&
channels
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
error
.
Format
(
alsa_output_domain
,
err
,
error
.
Format
(
alsa_output_domain
,
err
,
"
ALSA device
\"
%s
\"
does not support
%i channels: %s"
,
"
Failed to configure
%i channels: %s"
,
ad
->
GetDevice
(),
(
int
)
audio_format
.
channels
,
(
int
)
audio_format
.
channels
,
snd_strerror
(
-
err
));
snd_strerror
(
-
err
));
return
false
;
return
false
;
}
}
...
@@ -527,12 +526,21 @@ configure_hw:
...
@@ -527,12 +526,21 @@ configure_hw:
err
=
snd_pcm_hw_params_set_rate_near
(
ad
->
pcm
,
hwparams
,
err
=
snd_pcm_hw_params_set_rate_near
(
ad
->
pcm
,
hwparams
,
&
sample_rate
,
nullptr
);
&
sample_rate
,
nullptr
);
if
(
err
<
0
||
sample_rate
==
0
)
{
if
(
err
<
0
)
{
error
.
Format
(
alsa_output_domain
,
err
,
error
.
Format
(
alsa_output_domain
,
err
,
"ALSA device
\"
%s
\"
does not support %u Hz audio"
,
"Failed to configure sample rate %u Hz: %s"
,
ad
->
GetDevice
(),
audio_format
.
sample_rate
);
audio_format
.
sample_rate
,
snd_strerror
(
-
err
));
return
false
;
return
false
;
}
}
if
(
sample_rate
==
0
)
{
error
.
Format
(
alsa_output_domain
,
err
,
"Failed to configure sample rate %u Hz"
,
audio_format
.
sample_rate
);
return
false
;
}
audio_format
.
sample_rate
=
sample_rate
;
audio_format
.
sample_rate
=
sample_rate
;
snd_pcm_uframes_t
buffer_size_min
,
buffer_size_max
;
snd_pcm_uframes_t
buffer_size_min
,
buffer_size_max
;
...
@@ -660,8 +668,8 @@ configure_hw:
...
@@ -660,8 +668,8 @@ configure_hw:
error
:
error
:
error
.
Format
(
alsa_output_domain
,
err
,
error
.
Format
(
alsa_output_domain
,
err
,
"
Error opening ALSA device
\"
%s
\"
(%s)
: %s"
,
"
%s failed
: %s"
,
ad
->
GetDevice
(),
cmd
,
snd_strerror
(
-
err
));
cmd
,
snd_strerror
(
-
err
));
return
false
;
return
false
;
}
}
...
@@ -698,9 +706,8 @@ AlsaOutput::SetupDop(const AudioFormat audio_format,
...
@@ -698,9 +706,8 @@ AlsaOutput::SetupDop(const AudioFormat audio_format,
if
(
dop_format
!=
check
)
{
if
(
dop_format
!=
check
)
{
/* no bit-perfect playback, which is required
/* no bit-perfect playback, which is required
for DSD over USB */
for DSD over USB */
error
.
Format
(
alsa_output_domain
,
error
.
Set
(
alsa_output_domain
,
"Failed to configure DSD-over-PCM on ALSA device
\"
%s
\"
"
,
"Failed to configure DSD-over-PCM"
);
GetDevice
());
delete
[]
silence
;
delete
[]
silence
;
return
false
;
return
false
;
}
}
...
@@ -757,6 +764,8 @@ AlsaOutput::Open(AudioFormat &audio_format, Error &error)
...
@@ -757,6 +764,8 @@ AlsaOutput::Open(AudioFormat &audio_format, Error &error)
if
(
!
SetupOrDop
(
audio_format
,
params
,
error
))
{
if
(
!
SetupOrDop
(
audio_format
,
params
,
error
))
{
snd_pcm_close
(
pcm
);
snd_pcm_close
(
pcm
);
error
.
FormatPrefix
(
"Error opening ALSA device
\"
%s
\"
: "
,
GetDevice
());
return
false
;
return
false
;
}
}
...
...
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