2009-03-13 18:43:16 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003-2009 The Music Player Daemon Project
|
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
|
|
|
#include "audio.h"
|
2008-09-07 19:19:55 +02:00
|
|
|
#include "audio_format.h"
|
2009-02-11 18:00:41 +01:00
|
|
|
#include "audio_parser.h"
|
2008-09-24 07:20:55 +02:00
|
|
|
#include "output_internal.h"
|
2009-02-16 01:51:50 +01:00
|
|
|
#include "output_plugin.h"
|
2009-02-10 18:51:49 +01:00
|
|
|
#include "output_all.h"
|
2009-02-16 18:40:04 +01:00
|
|
|
#include "conf.h"
|
2005-08-23 14:01:37 +02:00
|
|
|
|
2008-10-28 20:33:56 +01:00
|
|
|
#include <glib.h>
|
|
|
|
|
2008-12-29 17:28:32 +01:00
|
|
|
#include <assert.h>
|
2009-01-03 13:36:20 +01:00
|
|
|
#include <stdlib.h>
|
2008-12-29 17:28:32 +01:00
|
|
|
|
2008-10-12 01:00:00 +02:00
|
|
|
static struct audio_format configured_audio_format;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-09-07 19:19:55 +02:00
|
|
|
void getOutputAudioFormat(const struct audio_format *inAudioFormat,
|
|
|
|
struct audio_format *outAudioFormat)
|
2004-05-10 04:20:15 +02:00
|
|
|
{
|
2009-10-21 23:01:04 +02:00
|
|
|
*outAudioFormat = *inAudioFormat;
|
|
|
|
audio_format_mask_apply(outAudioFormat, &configured_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);
|
2009-02-11 18:00:41 +01:00
|
|
|
GError *error = NULL;
|
|
|
|
bool ret;
|
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
|
|
|
|
2009-02-11 18:00:41 +01:00
|
|
|
ret = audio_format_parse(&configured_audio_format, param->value,
|
2009-10-21 23:01:04 +02:00
|
|
|
true, &error);
|
2009-02-11 18:00:41 +01:00
|
|
|
if (!ret)
|
|
|
|
g_error("error parsing \"%s\" at line %i: %s",
|
|
|
|
CONF_AUDIO_OUTPUT_FORMAT, param->line, error->message);
|
2004-05-10 04:20:15 +02:00
|
|
|
}
|