AudioFormat: move MAX_CHANNELS to pcm/ChannelDefs.hxx
Reduce header dependencies.
This commit is contained in:
parent
47bb1cd8b5
commit
458a1beed9
@ -21,6 +21,7 @@
|
||||
#define MPD_AUDIO_FORMAT_HXX
|
||||
|
||||
#include "pcm/SampleFormat.hxx"
|
||||
#include "pcm/ChannelDefs.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <chrono>
|
||||
@ -30,8 +31,6 @@
|
||||
|
||||
template<size_t CAPACITY> class StringBuffer;
|
||||
|
||||
static constexpr unsigned MAX_CHANNELS = 8;
|
||||
|
||||
/**
|
||||
* This structure describes the format of a raw PCM stream.
|
||||
*/
|
||||
@ -184,15 +183,6 @@ audio_valid_sample_rate(unsigned sample_rate) noexcept
|
||||
return sample_rate > 0 && sample_rate < (1 << 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the number of channels is valid.
|
||||
*/
|
||||
constexpr bool
|
||||
audio_valid_channel_count(unsigned channels) noexcept
|
||||
{
|
||||
return channels >= 1 && channels <= MAX_CHANNELS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the format is not valid for playback with MPD.
|
||||
* This function performs some basic validity checks.
|
||||
|
34
src/pcm/ChannelDefs.hxx
Normal file
34
src/pcm/ChannelDefs.hxx
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2003-2019 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 MPD_PCM_CHANNEL_DEFS_HXX
|
||||
#define MPD_PCM_CHANNEL_DEFS_HXX
|
||||
|
||||
static constexpr unsigned MAX_CHANNELS = 8;
|
||||
|
||||
/**
|
||||
* Checks whether the number of channels is valid.
|
||||
*/
|
||||
constexpr bool
|
||||
audio_valid_channel_count(unsigned channels) noexcept
|
||||
{
|
||||
return channels >= 1 && channels <= MAX_CHANNELS;
|
||||
}
|
||||
|
||||
#endif
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "Dop.hxx"
|
||||
#include "Buffer.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "ChannelDefs.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
#include "PcmChannels.hxx"
|
||||
#include "ChannelDefs.hxx"
|
||||
#include "Buffer.hxx"
|
||||
#include "Silence.hxx"
|
||||
#include "Traits.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/WritableBuffer.hxx"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define MPD_PCM_DSD_HXX
|
||||
|
||||
#include "Buffer.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "ChannelDefs.hxx"
|
||||
|
||||
#include <array>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user