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
f6d6110a
Commit
f6d6110a
authored
Mar 27, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: move pcm_export_open() to caller
Give the caller more control, prepare for DSD-over-USB improvements.
parent
a0730cf2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
alsa_output_plugin.c
src/output/alsa_output_plugin.c
+16
-11
No files found.
src/output/alsa_output_plugin.c
View file @
f6d6110a
...
@@ -385,7 +385,7 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams,
...
@@ -385,7 +385,7 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams,
*/
*/
static
bool
static
bool
alsa_setup
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
alsa_setup
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
GError
**
error
)
bool
*
packed_r
,
bool
*
reverse_endian_r
,
GError
**
error
)
{
{
snd_pcm_hw_params_t
*
hwparams
;
snd_pcm_hw_params_t
*
hwparams
;
snd_pcm_sw_params_t
*
swparams
;
snd_pcm_sw_params_t
*
swparams
;
...
@@ -429,9 +429,8 @@ configure_hw:
...
@@ -429,9 +429,8 @@ configure_hw:
ad
->
writei
=
snd_pcm_writei
;
ad
->
writei
=
snd_pcm_writei
;
}
}
bool
packed
,
reverse_endian
;
err
=
alsa_output_setup_format
(
ad
->
pcm
,
hwparams
,
audio_format
,
err
=
alsa_output_setup_format
(
ad
->
pcm
,
hwparams
,
audio_format
,
&
packed
,
&
reverse_endian
);
packed_r
,
reverse_endian_r
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
g_set_error
(
error
,
alsa_output_quark
(),
err
,
g_set_error
(
error
,
alsa_output_quark
(),
err
,
"ALSA device
\"
%s
\"
does not support format %s: %s"
,
"ALSA device
\"
%s
\"
does not support format %s: %s"
,
...
@@ -578,9 +577,6 @@ configure_hw:
...
@@ -578,9 +577,6 @@ configure_hw:
ad
->
period_frames
=
alsa_period_size
;
ad
->
period_frames
=
alsa_period_size
;
ad
->
period_position
=
0
;
ad
->
period_position
=
0
;
pcm_export_open
(
&
ad
->
export
,
audio_format
->
format
,
packed
,
reverse_endian
);
return
true
;
return
true
;
error:
error:
...
@@ -592,7 +588,7 @@ error:
...
@@ -592,7 +588,7 @@ error:
static
bool
static
bool
alsa_setup_dsd
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
alsa_setup_dsd
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
GError
**
error_r
)
bool
*
packed_r
,
bool
*
reverse_endian_r
,
GError
**
error_r
)
{
{
assert
(
ad
->
dsd_usb
);
assert
(
ad
->
dsd_usb
);
assert
(
audio_format
->
format
==
SAMPLE_FORMAT_DSD
);
assert
(
audio_format
->
format
==
SAMPLE_FORMAT_DSD
);
...
@@ -604,7 +600,7 @@ alsa_setup_dsd(struct alsa_data *ad, struct audio_format *audio_format,
...
@@ -604,7 +600,7 @@ alsa_setup_dsd(struct alsa_data *ad, struct audio_format *audio_format,
const
struct
audio_format
check
=
*
audio_format
;
const
struct
audio_format
check
=
*
audio_format
;
if
(
!
alsa_setup
(
ad
,
audio_format
,
error_r
))
if
(
!
alsa_setup
(
ad
,
audio_format
,
packed_r
,
reverse_endian_r
,
error_r
))
return
false
;
return
false
;
if
(
!
audio_format_equals
(
audio_format
,
&
check
))
{
if
(
!
audio_format_equals
(
audio_format
,
&
check
))
{
...
@@ -627,10 +623,19 @@ static bool
...
@@ -627,10 +623,19 @@ static bool
alsa_setup_or_dsd
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
alsa_setup_or_dsd
(
struct
alsa_data
*
ad
,
struct
audio_format
*
audio_format
,
GError
**
error_r
)
GError
**
error_r
)
{
{
if
(
ad
->
dsd_usb
&&
audio_format
->
format
==
SAMPLE_FORMAT_DSD
)
bool
packed
,
reverse_endian
;
return
alsa_setup_dsd
(
ad
,
audio_format
,
error_r
);
const
bool
success
=
ad
->
dsd_usb
&&
audio_format
->
format
==
SAMPLE_FORMAT_DSD
?
alsa_setup_dsd
(
ad
,
audio_format
,
&
packed
,
&
reverse_endian
,
error_r
)
:
alsa_setup
(
ad
,
audio_format
,
&
packed
,
&
reverse_endian
,
error_r
);
if
(
!
success
)
return
false
;
return
alsa_setup
(
ad
,
audio_format
,
error_r
);
pcm_export_open
(
&
ad
->
export
,
audio_format
->
format
,
packed
,
reverse_endian
);
return
true
;
}
}
static
bool
static
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