MPD  0.20.6
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:
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 
72 };
73 
75 public:
76  virtual ~PreparedFilter() {}
77 
87  virtual Filter *Open(AudioFormat &af) = 0;
88 };
89 
90 #endif
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
Filter(AudioFormat _out_audio_format)
virtual void Reset()
Reset the filter's state, e.g.
bool IsValid() const
Returns false if the format is not valid for playback with MPD.
virtual ConstBuffer< void > FilterPCM(ConstBuffer< void > src)=0
Filters a block of PCM data.
AudioFormat out_audio_format
virtual Filter * Open(AudioFormat &af)=0
Opens the filter, preparing it for FilterPCM().
virtual ~Filter()
A reference to a memory area that is read-only.
Definition: FlacPcm.hxx:29
virtual ~PreparedFilter()
const AudioFormat & GetOutAudioFormat() const
Returns the AudioFormat produced by FilterPCM().