2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2013-01-28 20:30:47 +01:00
|
|
|
* Copyright (C) 2003-2013 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-02-24 00:41:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-24 00:41:20 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-12 09:12:38 +01:00
|
|
|
#include "config.h"
|
2013-01-30 21:47:12 +01:00
|
|
|
#include "AudioConfig.hxx"
|
2013-08-03 21:00:50 +02:00
|
|
|
#include "AudioFormat.hxx"
|
2013-01-30 21:47:12 +01:00
|
|
|
#include "AudioParser.hxx"
|
2013-09-05 08:47:10 +02:00
|
|
|
#include "ConfigData.hxx"
|
|
|
|
#include "ConfigGlobal.hxx"
|
|
|
|
#include "ConfigOption.hxx"
|
2013-08-10 18:02:44 +02:00
|
|
|
#include "util/Error.hxx"
|
2013-09-05 18:20:52 +02:00
|
|
|
#include "system/FatalError.hxx"
|
2005-08-23 14:01:37 +02:00
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
static AudioFormat configured_audio_format;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
AudioFormat
|
|
|
|
getOutputAudioFormat(AudioFormat inAudioFormat)
|
2004-05-10 04:20:15 +02:00
|
|
|
{
|
2013-08-03 21:00:50 +02:00
|
|
|
AudioFormat out_audio_format = inAudioFormat;
|
|
|
|
out_audio_format.ApplyMask(configured_audio_format);
|
|
|
|
return out_audio_format;
|
2004-05-10 04:20:15 +02:00
|
|
|
}
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
void initAudioConfig(void)
|
|
|
|
{
|
2009-01-25 16:03:49 +01:00
|
|
|
const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
|
2004-05-10 04:20:15 +02:00
|
|
|
|
2009-10-21 22:22:20 +02:00
|
|
|
if (param == NULL)
|
2006-07-20 18:02:40 +02:00
|
|
|
return;
|
2004-05-10 04:20:15 +02:00
|
|
|
|
2013-08-10 18:02:44 +02:00
|
|
|
Error error;
|
2013-10-15 22:32:39 +02:00
|
|
|
if (!audio_format_parse(configured_audio_format, param->value.c_str(),
|
2013-08-10 18:02:44 +02:00
|
|
|
true, error))
|
2013-09-05 18:20:52 +02:00
|
|
|
FormatFatalError("error parsing line %i: %s",
|
|
|
|
param->line, error.GetMessage());
|
2004-05-10 04:20:15 +02:00
|
|
|
}
|