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
#ifndef SHORTCLIPCREATOR_H
#define SHORTCLIPCREATOR_H
#include <QThread>
#include "nwutils.h"
class AvconvConfig;
class ShortClipCreator : public QThread
{
Q_OBJECT
public:
class Config {
public:
Config();
virtual ~Config();
// concrete case data TODO may move to different container
// but I'm planning to make all other settings changable for 1 case, too
// so maybe, don't move it
QString videoPath;
QString outputPath;
float startSec;
float endSec;
QString dir;
QString name;
std::pair<int,int> resolution;
float maxSizeMib;
virtual void describe(nw::Describer& de);
bool isValid() const;
float timeSpan() const;
std::pair<int, int> adaptRatio(const std::pair<int, int> resolution) const;
std::pair<int, int> adaptRatio(int originalW, int originalH) const;
private:
void fixInvalidMembers();
};
class ApiData {
public:
enum OutputType {
gif,
webm
};
ApiData();
float start;
float end;
float maxSizeMib;
OutputType outputType;
float audioRateKib;
void describe(nw::Descriptor& de);
};
ShortClipCreator(ShortClipCreator::Config* config, const AvconvConfig& avconvConfig, QObject* parent = NULL);
virtual bool generate() = 0;
void run();
signals:
void done(bool);
protected:
const Config* config;
const AvconvConfig& avconvConfig;
};
#endif // SHORTCLIPCREATOR_H