1 /*
2  * Copyright (c) 2020 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef PROXYMANAGER_H
19 #define PROXYMANAGER_H
20 
21 #include <QDir>
22 #include <QString>
23 #include <QPoint>
24 
25 namespace Mlt {
26     class Producer;
27     class Service;
28 }
29 
30 class ProxyManager
31 {
32 private:
ProxyManager()33     ProxyManager() {};
34 
35 public:
36     enum ScanMode {
37         Automatic,
38         Progressive,
39         InterlacedTopFieldFirst,
40         InterlacedBottomFieldFirst
41     };
42 
43     static QDir dir();
44     static QString resource(Mlt::Service& producer);
45     static void generateVideoProxy(Mlt::Producer& producer, bool fullRange,
46         ScanMode scanMode = Automatic, const QPoint& aspectRatio = QPoint(), bool replace = true);
47     static void generateImageProxy(Mlt::Producer& producer, bool replace = true);
48     static bool filterXML(QString& xml, QString root);
49     static bool fileExists(Mlt::Producer& producer);
50     static bool filePending(Mlt::Producer& producer);
51     static bool isValidImage(Mlt::Producer& producer);
52     static bool isValidVideo(Mlt::Producer producer);
53     static bool generateIfNotExists(Mlt::Producer& producer, bool replace = true);
54     static const char* videoFilenameExtension();
55     static const char* pendingVideoExtension();
56     static const char* imageFilenameExtension();
57     static const char* pendingImageExtension();
58     static int resolution();
59     static void generateIfNotExistsAll(Mlt::Producer& producer);
60     static bool removePending();
61 };
62 
63 #endif // PROXYMANAGER_H
64