aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-20 15:47:50 +0100
committerMax Kellermann <max@duempel.org>2009-03-20 15:47:50 +0100
commite6c753a474bcf1d81127f74762f8b7f913dd3160 (patch)
tree37bce87b2de1f2ee7d40c28074a53c423c7a6789 /src/output_control.c
parent67e65a7959be0e3dee2fd2023a2c23217c50c1d8 (diff)
downloadmpd-e6c753a474bcf1d81127f74762f8b7f913dd3160.tar.gz
mpd-e6c753a474bcf1d81127f74762f8b7f913dd3160.tar.xz
mpd-e6c753a474bcf1d81127f74762f8b7f913dd3160.zip
output: convert audio_output.config_audio_format to boolean
The config_audio_format used to contain the configured audio format, which is copied to out_audio_format. Let's convert the former to a boolean, which indicates whether out_audio_format was already set. This simplifies some code and saves a few bytes.
Diffstat (limited to 'src/output_control.c')
-rw-r--r--src/output_control.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/output_control.c b/src/output_control.c
index 25365d324..9a240ffe4 100644
--- a/src/output_control.c
+++ b/src/output_control.c
@@ -78,16 +78,12 @@ audio_output_open(struct audio_output *ao,
ao->in_audio_format = *audio_format;
ao->chunk = NULL;
- if (audio_format_defined(&ao->config_audio_format)) {
- /* copy config_audio_format to out_audio_format only if the
- device is not yet open; if it is already open,
- plugin->open() may have modified out_audio_format,
- and the value is already ok */
- if (!ao->open)
- ao->out_audio_format =
- ao->config_audio_format;
- } else {
+ if (!ao->config_audio_format) {
+ /* no audio format is configured: copy in->out, let
+ the output's open() method determine the effective
+ out_audio_format */
ao->out_audio_format = ao->in_audio_format;
+
if (ao->open)
audio_output_close(ao);
}