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
2c054300
Commit
2c054300
authored
Oct 21, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: convert config_audio_format to an audio_format struct
This allows more sophisticated audio format selection.
parent
643650db
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
output_init.c
src/output_init.c
+7
-6
output_internal.h
src/output_internal.h
+5
-6
output_thread.c
src/output_thread.c
+4
-2
No files found.
src/output_init.c
View file @
2c054300
...
@@ -154,14 +154,14 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
...
@@ -154,14 +154,14 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
p
=
config_get_block_string
(
param
,
AUDIO_OUTPUT_FORMAT
,
p
=
config_get_block_string
(
param
,
AUDIO_OUTPUT_FORMAT
,
NULL
);
NULL
);
ao
->
config_audio_format
=
p
!=
NULL
;
if
(
p
!=
NULL
)
{
if
(
p
!=
NULL
)
{
bool
success
=
bool
success
=
audio_format_parse
(
&
ao
->
out
_audio_format
,
audio_format_parse
(
&
ao
->
config
_audio_format
,
p
,
error_r
);
p
,
error_r
);
if
(
!
success
)
if
(
!
success
)
return
false
;
return
false
;
}
}
else
audio_format_clear
(
&
ao
->
config_audio_format
);
}
else
{
}
else
{
g_warning
(
"No
\"
%s
\"
defined in config file
\n
"
,
g_warning
(
"No
\"
%s
\"
defined in config file
\n
"
,
CONF_AUDIO_OUTPUT
);
CONF_AUDIO_OUTPUT
);
...
@@ -174,7 +174,8 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
...
@@ -174,7 +174,8 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
plugin
->
name
);
plugin
->
name
);
ao
->
name
=
"default detected output"
;
ao
->
name
=
"default detected output"
;
ao
->
config_audio_format
=
false
;
audio_format_clear
(
&
ao
->
config_audio_format
);
}
}
ao
->
plugin
=
plugin
;
ao
->
plugin
=
plugin
;
...
@@ -194,8 +195,8 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
...
@@ -194,8 +195,8 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
ao
->
mutex
=
g_mutex_new
();
ao
->
mutex
=
g_mutex_new
();
ao
->
data
=
ao_plugin_init
(
plugin
,
ao
->
data
=
ao_plugin_init
(
plugin
,
a
o
->
config_audio_format
a
udio_format_defined
(
&
ao
->
config_audio_format
)
?
&
ao
->
out
_audio_format
:
NULL
,
?
&
ao
->
config
_audio_format
:
NULL
,
param
,
error_r
);
param
,
error_r
);
if
(
ao
->
data
==
NULL
)
if
(
ao
->
data
==
NULL
)
return
false
;
return
false
;
...
...
src/output_internal.h
View file @
2c054300
...
@@ -66,12 +66,6 @@ struct audio_output {
...
@@ -66,12 +66,6 @@ struct audio_output {
struct
mixer
*
mixer
;
struct
mixer
*
mixer
;
/**
/**
* This flag is true, when the audio_format of this device is
* configured in mpd.conf.
*/
bool
config_audio_format
;
/**
* Has the user enabled this device?
* Has the user enabled this device?
*/
*/
bool
enabled
;
bool
enabled
;
...
@@ -100,6 +94,11 @@ struct audio_output {
...
@@ -100,6 +94,11 @@ struct audio_output {
GTimer
*
fail_timer
;
GTimer
*
fail_timer
;
/**
/**
* The configured audio format.
*/
struct
audio_format
config_audio_format
;
/**
* The audio_format in which audio data is received from the
* The audio_format in which audio data is received from the
* player thread (which in turn receives it from the decoder).
* player thread (which in turn receives it from the decoder).
*/
*/
...
...
src/output_thread.c
View file @
2c054300
...
@@ -67,7 +67,9 @@ ao_open(struct audio_output *ao)
...
@@ -67,7 +67,9 @@ ao_open(struct audio_output *ao)
return
;
return
;
}
}
if
(
!
ao
->
config_audio_format
)
if
(
audio_format_defined
(
&
ao
->
config_audio_format
))
ao
->
out_audio_format
=
ao
->
config_audio_format
;
else
ao
->
out_audio_format
=
*
filter_audio_format
;
ao
->
out_audio_format
=
*
filter_audio_format
;
success
=
ao_plugin_open
(
ao
->
plugin
,
ao
->
data
,
success
=
ao_plugin_open
(
ao
->
plugin
,
ao
->
data
,
...
@@ -164,7 +166,7 @@ ao_reopen_filter(struct audio_output *ao)
...
@@ -164,7 +166,7 @@ ao_reopen_filter(struct audio_output *ao)
static
void
static
void
ao_reopen
(
struct
audio_output
*
ao
)
ao_reopen
(
struct
audio_output
*
ao
)
{
{
if
(
!
a
o
->
config_audio_format
)
{
if
(
!
a
udio_format_defined
(
&
ao
->
config_audio_format
)
)
{
if
(
ao
->
open
)
{
if
(
ao
->
open
)
{
const
struct
music_pipe
*
mp
=
ao
->
pipe
;
const
struct
music_pipe
*
mp
=
ao
->
pipe
;
ao_close
(
ao
);
ao_close
(
ao
);
...
...
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