Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / lib / audio_processor.h
1 /*
2     Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 /** @file  src/lib/audio_processor.h
22  *  @brief AudioProcessor class.
23  */
24
25 #ifndef DCPOMATIC_AUDIO_PROCESSOR_H
26 #define DCPOMATIC_AUDIO_PROCESSOR_H
27
28 #include <boost/shared_ptr.hpp>
29 #include <list>
30 #include <string>
31 #include <vector>
32
33 class AudioBuffers;
34 class AudioMapping;
35
36 /** @class AudioProcessor
37  *  @brief A parent class for processors of audio data.
38  *
39  *  These are used to process data before it goes into the DCP, for things like
40  *  stereo -> 5.1 upmixing.
41  */
42 class AudioProcessor
43 {
44 public:
45         virtual ~AudioProcessor () {}
46
47         /** @return User-visible (translated) name */
48         virtual std::string name () const = 0;
49         /** @return An internal identifier */
50         virtual std::string id () const = 0;
51         /** @return Number of output channels */
52         virtual int out_channels () const = 0;
53         /** @return A clone of this AudioProcessor for operation at the specified sampling rate */
54         virtual boost::shared_ptr<AudioProcessor> clone (int sampling_rate) const = 0;
55         /** Process some data, returning the processed result truncated or padded to `channels' */
56         virtual boost::shared_ptr<AudioBuffers> run (boost::shared_ptr<const AudioBuffers>, int channels) = 0;
57         virtual void flush () {}
58         /** Make the supplied audio mapping into a sensible default for this processor */
59         virtual void make_audio_mapping_default (AudioMapping& mapping) const = 0;
60         /** @return the user-visible (translated) names of each of our inputs, in order */
61         virtual std::vector<std::string> input_names () const = 0;
62
63         static std::list<AudioProcessor const *> all ();
64         static std::list<AudioProcessor const *> visible ();
65         static void setup_audio_processors ();
66         static AudioProcessor const * from_id (std::string);
67
68 private:
69         static std::list<AudioProcessor const *> _all;
70         static std::list<AudioProcessor const *> _non_experimental;
71 };
72
73 #endif