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.
This commit is contained in:
Max Kellermann 2013-12-23 09:04:31 +01:00
parent d7b9886387
commit 2d1a3073f6
7 changed files with 57 additions and 9 deletions

View File

@ -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 \

View File

@ -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;

23
src/pcm/Domain.cxx Normal file
View File

@ -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");

27
src/pcm/Domain.hxx Normal file
View File

@ -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

View File

@ -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));

View File

@ -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;
}

View File

@ -82,8 +82,6 @@ public:
Error &error);
};
extern const Domain pcm_convert_domain;
bool
pcm_convert_global_init(Error &error);