diff options
author | Max Kellermann <max@duempel.org> | 2013-12-23 09:04:31 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-23 10:35:19 +0100 |
commit | 2d1a3073f63604a452e559ff8322520af98a4b65 (patch) | |
tree | 55e8892ec78eda8023f4434f3bafb4ab977c8fa5 | |
parent | d7b988638722d245152b108456af1aad8fc9b8a0 (diff) |
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.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/pcm/ChannelsConverter.cxx | 4 | ||||
-rw-r--r-- | src/pcm/Domain.cxx | 23 | ||||
-rw-r--r-- | src/pcm/Domain.hxx | 27 | ||||
-rw-r--r-- | src/pcm/FormatConverter.cxx | 4 | ||||
-rw-r--r-- | src/pcm/PcmConvert.cxx | 5 | ||||
-rw-r--r-- | src/pcm/PcmConvert.hxx | 2 |
7 files changed, 57 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index 78a5afeb5..93bc71351 100644 --- a/Makefile.am +++ b/Makefile.am @@ -331,6 +331,7 @@ libevent_a_SOURCES = \ # PCM library libpcm_a_SOURCES = \ + src/pcm/Domain.cxx src/pcm/Domain.hxx \ src/pcm/Traits.hxx \ src/pcm/PcmBuffer.cxx src/pcm/PcmBuffer.hxx \ src/pcm/PcmExport.cxx src/pcm/PcmExport.hxx \ 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<void> 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 <assert.h> #include <math.h> -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); |