From 2d1a3073f63604a452e559ff8322520af98a4b65 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 23 Dec 2013 09:04:31 +0100 Subject: pcm/PcmConvert: move the Domain instance to Domain.cxx Rename pcm_convert_domain to pcm_domain. Move it out so we can use it without depending on the whole PcmConvert library. --- src/pcm/ChannelsConverter.cxx | 4 ++-- src/pcm/Domain.cxx | 23 +++++++++++++++++++++++ src/pcm/Domain.hxx | 27 +++++++++++++++++++++++++++ src/pcm/FormatConverter.cxx | 4 ++-- src/pcm/PcmConvert.cxx | 5 ++--- src/pcm/PcmConvert.hxx | 2 -- 6 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 src/pcm/Domain.cxx create mode 100644 src/pcm/Domain.hxx (limited to 'src') diff --git a/src/pcm/ChannelsConverter.cxx b/src/pcm/ChannelsConverter.cxx index 46197b7e0..8ffcbfe41 100644 --- a/src/pcm/ChannelsConverter.cxx +++ b/src/pcm/ChannelsConverter.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "ChannelsConverter.hxx" #include "PcmChannels.hxx" -#include "PcmConvert.hxx" +#include "Domain.hxx" #include "util/ConstBuffer.hxx" #include "util/Error.hxx" @@ -41,7 +41,7 @@ PcmChannelsConverter::Open(SampleFormat _format, break; default: - error.Format(pcm_convert_domain, + error.Format(pcm_domain, "PCM channel conversion for %s is not implemented", sample_format_to_string(format)); return false; diff --git a/src/pcm/Domain.cxx b/src/pcm/Domain.cxx new file mode 100644 index 000000000..9f07d80dd --- /dev/null +++ b/src/pcm/Domain.cxx @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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. + * + * 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. + */ + +#include "Domain.hxx" +#include "util/Domain.hxx" + +const Domain pcm_domain("pcm"); diff --git a/src/pcm/Domain.hxx b/src/pcm/Domain.hxx new file mode 100644 index 000000000..170d7406d --- /dev/null +++ b/src/pcm/Domain.hxx @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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. + * + * 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. + */ + +#ifndef PCM_DOMAIN_HXX +#define PCM_DOMAIN_HXX + +class Domain; + +extern const Domain pcm_domain; + +#endif diff --git a/src/pcm/FormatConverter.cxx b/src/pcm/FormatConverter.cxx index f3f9c8685..8886a8ab0 100644 --- a/src/pcm/FormatConverter.cxx +++ b/src/pcm/FormatConverter.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "FormatConverter.hxx" #include "PcmFormat.hxx" -#include "PcmConvert.hxx" +#include "Domain.hxx" #include "util/ConstBuffer.hxx" #include "util/Error.hxx" @@ -93,7 +93,7 @@ PcmFormatConverter::Convert(ConstBuffer src, Error &error) } if (result == nullptr) { - error.Format(pcm_convert_domain, + error.Format(pcm_domain, "PCM conversion from %s to %s is not implemented", sample_format_to_string(src_format), sample_format_to_string(dest_format)); diff --git a/src/pcm/PcmConvert.cxx b/src/pcm/PcmConvert.cxx index 5501d8ddf..6eecd3b01 100644 --- a/src/pcm/PcmConvert.cxx +++ b/src/pcm/PcmConvert.cxx @@ -19,6 +19,7 @@ #include "config.h" #include "PcmConvert.hxx" +#include "Domain.hxx" #include "ConfiguredResampler.hxx" #include "AudioFormat.hxx" #include "util/ConstBuffer.hxx" @@ -29,8 +30,6 @@ #include #include -const Domain pcm_convert_domain("pcm_convert"); - bool pcm_convert_global_init(Error &error) { @@ -131,7 +130,7 @@ PcmConvert::Convert(const void *src, size_t src_size, auto d = dsd.ToFloat(format.channels, false, s); if (d.IsNull()) { - error.Set(pcm_convert_domain, + error.Set(pcm_domain, "DSD to PCM conversion failed"); return nullptr; } diff --git a/src/pcm/PcmConvert.hxx b/src/pcm/PcmConvert.hxx index 13dff4427..586c303f2 100644 --- a/src/pcm/PcmConvert.hxx +++ b/src/pcm/PcmConvert.hxx @@ -82,8 +82,6 @@ public: Error &error); }; -extern const Domain pcm_convert_domain; - bool pcm_convert_global_init(Error &error); -- cgit v1.2.3