summaryrefslogtreecommitdiff
path: root/src/lib/filter.h
blob: d755ab25cefa7d348e0d4d494c98a3cc24f0f365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>

    This file is part of DCP-o-matic.

    DCP-o-matic is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    DCP-o-matic is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.

*/


/** @file src/filter.h
 *  @brief A class to describe one of FFmpeg's video or audio filters.
 */


#ifndef DCPOMATIC_FILTER_H
#define DCPOMATIC_FILTER_H


#include <string>
#include <vector>
#include <boost/optional.hpp>


/** @class Filter
 *  @brief A class to describe one of FFmpeg's video or audio filters.
 *
 *  We don't support FFmpeg's post-processing filters here as they cannot cope with greater than
 *  8bpp.  FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which
 *  we don't really want to do.
 */
class Filter
{
public:
	Filter(std::string id, std::string name, std::string category, std::string ffmpeg_string);

	/** @return our id */
	std::string id() const {
		return _id;
	}

	/** @return user-visible name */
	std::string name() const {
		return _name;
	}

	/** @return string for a FFmpeg filter descriptor */
	std::string ffmpeg() const {
		return _ffmpeg;
	}

	std::string category() const {
		return _category;
	}

	static std::vector<Filter> all();
	static boost::optional<Filter> from_id(std::string d);
	static void setup_filters();
	static std::string ffmpeg_string(std::vector<Filter> const& filters);

private:

	/** our id */
	std::string _id;
	/** user-visible name */
	std::string _name;
	std::string _category;
	/** string for a FFmpeg filter descriptor */
	std::string _ffmpeg;

	/** all available filters */
	static std::vector<Filter> _filters;
};


bool operator==(Filter const& a, Filter const& b);
bool operator!=(Filter const& a, Filter const& b);
bool operator<(Filter const& a, Filter const& b);


#endif