MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

PcmExport.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef PCM_EXPORT_HXX
21 #define PCM_EXPORT_HXX
22
23 #include "check.h"
24 #include "SampleFormat.hxx"
25 #include "PcmBuffer.hxx"
26
27 template<typename T> struct ConstBuffer;
28 struct AudioFormat;
29
35 class PcmExport {
41 PcmBuffer order_buffer;
42
43 #ifdef ENABLE_DSD
44
50 PcmBuffer dop_buffer;
51 #endif
52
58 PcmBuffer pack_buffer;
59
65 PcmBuffer reverse_buffer;
66
70 uint8_t channels;
71
80 SampleFormat alsa_channel_order;
81
82 #ifdef ENABLE_DSD
83
86 bool dsd_u16;
87
91 bool dsd_u32;
92
98 bool dop;
99 #endif
100
105 bool shift8;
106
110 bool pack24;
111
117 uint8_t reverse_endian;
118
119 public:
120 struct Params {
121 bool alsa_channel_order = false;
122 #ifdef ENABLE_DSD
123 bool dsd_u16 = false;
124 bool dsd_u32 = false;
125 bool dop = false;
126 #endif
127 bool shift8 = false;
128 bool pack24 = false;
129 bool reverse_endian = false;
130
137 gcc_pure
138 unsigned CalcOutputSampleRate(unsigned input_sample_rate) const;
139
143 gcc_pure
144 unsigned CalcInputSampleRate(unsigned output_sample_rate) const;
145 };
146
157 void Open(SampleFormat sample_format, unsigned channels,
158 Params params);
159
163 void Reset() {
164 }
165
169 gcc_pure
170 size_t GetFrameSize(const AudioFormat &audio_format) const;
171
178 ConstBuffer<void> Export(ConstBuffer<void> src);
179
185 gcc_pure
186 size_t CalcSourceSize(size_t dest_size) const;
187 };
188
189 #endif
check.h
AudioFormat
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
ConstBuffer< void >
Definition: ConstBuffer.hxx:45
PcmExport::Reset
void Reset()
Reset the filter's state, e.g.
Definition: PcmExport.hxx:163
PcmExport::Params::CalcInputSampleRate
gcc_pure unsigned CalcInputSampleRate(unsigned output_sample_rate) const
The inverse of CalcOutputSampleRate().
PcmExport::CalcSourceSize
gcc_pure size_t CalcSourceSize(size_t dest_size) const
Converts the number of consumed bytes from the pcm_export() destination buffer to the according numbe...
PcmBuffer.hxx
PcmExport::Params
Definition: PcmExport.hxx:120
PcmExport::Export
ConstBuffer< void > Export(ConstBuffer< void > src)
Export a PCM buffer.
PcmExport
An object that handles export of PCM samples to some instance outside of MPD.
Definition: PcmExport.hxx:35
PcmBuffer
Manager for a temporary buffer which grows as needed.
Definition: PcmBuffer.hxx:33
SampleFormat
SampleFormat
Definition: SampleFormat.hxx:33
SampleFormat.hxx
ConstBuffer
A reference to a memory area that is read-only.
Definition: FlacPcm.hxx:29
PcmExport::Params::CalcOutputSampleRate
gcc_pure unsigned CalcOutputSampleRate(unsigned input_sample_rate) const
Calculate the output sample rate, given a specific input sample rate.
PcmExport::Open
void Open(SampleFormat sample_format, unsigned channels, Params params)
Open the object.
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
PcmExport::GetFrameSize
gcc_pure size_t GetFrameSize(const AudioFormat &audio_format) const
Calculate the size of one output frame.