1 /*
2  * Cantata
3  *
4  * Copyright (c) 2011-2020 Craig Drummond <craig.p.drummond@gmail.com>
5  *
6  * ----
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef ENCODERS_H
25 #define ENCODERS_H
26 
27 #include <QString>
28 #include <QStringList>
29 #include <QList>
30 
31 namespace Encoders
32 {
33     struct Setting {
SettingSetting34         Setting(const QString &d, int v)
35             : descr(d)
36             , value(v) {
37         }
38         QString descr;
39         int value;
40     };
41 
42     struct Encoder {
EncoderEncoder43         Encoder()
44             : defaultValueIndex(0), ffmpegValueMultiplier(0), transcoder(false) {
45         }
46         Encoder(const QString &n, const QString &d, const QString &t, const QString &e, const QString &a, const QString &c,
47                 const QString &f, const QString &v, const QList<Setting> &vs, const QString &l, const QString &h, int def, int mult=1)
nameEncoder48             : name(n)
49             , description(d)
50             , tooltip(t)
51             , extension(e)
52             , app(a)
53             , codec(c)
54             , param(f)
55             , valueLabel(v)
56             , values(vs)
57             , low(l)
58             , high(h)
59             , defaultValueIndex(def)
60             , ffmpegValueMultiplier(mult)
61             , transcoder(true) {
62         }
isNullEncoder63         bool isNull() { return name.isEmpty(); }
64         bool operator==(const Encoder &o) const { return name==o.name && codec==o.codec; }
65         bool operator<(const Encoder &o) const;
66         QString changeExtension(const QString &file);
67         bool isDifferent(const QString &file);
68         QStringList params(int value, const QString &in, const QString &out) const;
69         QString name;
70         QString description;
71         QString tooltip;
72         QString extension;
73         QString app;
74         QString codec;
75         QString param;
76         QString valueLabel;
77         QList<Setting> values;
78         QString low;
79         QString high;
80         QString outputParam;
81         int defaultValueIndex;
82         int ffmpegValueMultiplier;
83         bool transcoder;
84     };
85 
86     extern QList<Encoder> getAvailable();
87     extern Encoder getEncoder(const QString &codec);
88 };
89 
90 #endif
91