Supporters update.
[dcpomatic.git] / src / lib / filter.h
1 /*
2     Copyright (C) 2012-2021 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
22 /** @file src/filter.h
23  *  @brief A class to describe one of FFmpeg's video or audio filters.
24  */
25
26
27 #ifndef DCPOMATIC_FILTER_H
28 #define DCPOMATIC_FILTER_H
29
30
31 #include <boost/optional.hpp>
32 #include <string>
33 #include <vector>
34
35
36 /** @class Filter
37  *  @brief A class to describe one of FFmpeg's video or audio filters.
38  *
39  *  We don't support FFmpeg's post-processing filters here as they cannot cope with greater than
40  *  8bpp.  FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which
41  *  we don't really want to do.
42  */
43 class Filter
44 {
45 public:
46         Filter(std::string id, std::string name, std::string category, std::string ffmpeg_string);
47
48         /** @return our id */
49         std::string id () const {
50                 return _id;
51         }
52
53         /** @return user-visible name */
54         std::string name () const {
55                 return _name;
56         }
57
58         /** @return string for a FFmpeg filter descriptor */
59         std::string ffmpeg () const {
60                 return _ffmpeg;
61         }
62
63         std::string category () const {
64                 return _category;
65         }
66
67         static std::vector<Filter> all ();
68         static boost::optional<Filter> from_id(std::string d);
69         static void setup_filters ();
70         static std::string ffmpeg_string(std::vector<Filter> const& filters);
71
72 private:
73
74         /** our id */
75         std::string _id;
76         /** user-visible name */
77         std::string _name;
78         std::string _category;
79         /** string for a FFmpeg filter descriptor */
80         std::string _ffmpeg;
81
82         /** all available filters */
83         static std::vector<Filter> _filters;
84 };
85
86
87 bool operator==(Filter const& a, Filter const& b);
88 bool operator!=(Filter const& a, Filter const& b);
89 bool operator<(Filter const& a, Filter const& b);
90
91
92 #endif