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