MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

FilterInternal.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
25 #ifndef MPD_FILTER_INTERNAL_HXX
26 #define MPD_FILTER_INTERNAL_HXX
27
28 #include "AudioFormat.hxx"
29
30 #include <assert.h>
31 #include <stddef.h>
32
33 struct AudioFormat;
34 template<typename T> struct ConstBuffer;
35
36 class Filter {
37 protected:
38 AudioFormat out_audio_format;
39
40 explicit Filter(AudioFormat _out_audio_format)
41 :out_audio_format(_out_audio_format) {
42 assert(out_audio_format.IsValid());
43 }
44
45 public:
46 virtual ~Filter() {}
47
51 const AudioFormat &GetOutAudioFormat() const {
52 return out_audio_format;
53 }
54
58 virtual void Reset() {
59 }
60
71 virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src) = 0;
72 };
73
74 class PreparedFilter {
75 public:
76 virtual ~PreparedFilter() {}
77
87 virtual Filter *Open(AudioFormat &af) = 0;
88 };
89
90 #endif
AudioFormat
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
ConstBuffer< void >
Definition: ConstBuffer.hxx:45
Filter::Filter
Filter(AudioFormat _out_audio_format)
Definition: FilterInternal.hxx:40
AudioFormat.hxx
Filter::Reset
virtual void Reset()
Reset the filter's state, e.g.
Definition: FilterInternal.hxx:58
AudioFormat::IsValid
bool IsValid() const
Returns false if the format is not valid for playback with MPD.
Definition: AudioFormat.hxx:178
Filter::FilterPCM
virtual ConstBuffer< void > FilterPCM(ConstBuffer< void > src)=0
Filters a block of PCM data.
Filter
Definition: FilterInternal.hxx:36
Filter::out_audio_format
AudioFormat out_audio_format
Definition: FilterInternal.hxx:38
PreparedFilter::Open
virtual Filter * Open(AudioFormat &af)=0
Opens the filter, preparing it for FilterPCM().
Filter::~Filter
virtual ~Filter()
Definition: FilterInternal.hxx:46
ConstBuffer
A reference to a memory area that is read-only.
Definition: FlacPcm.hxx:29
PreparedFilter::~PreparedFilter
virtual ~PreparedFilter()
Definition: FilterInternal.hxx:76
PreparedFilter
Definition: FilterInternal.hxx:74
Filter::GetOutAudioFormat
const AudioFormat & GetOutAudioFormat() const
Returns the AudioFormat produced by FilterPCM().
Definition: FilterInternal.hxx:51