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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "config.hpp"
#include "input.hpp"
#include "plugin.hpp"
#include <string>
#include <vector>
namespace VideoStitch {
namespace Core {
class ReaderInputDefinition;
}
namespace Input {
/**
* The result of probing for reader information.
*
* Default values should be false, false, -1, -1, -1, -1.
*/
struct ProbeResult {
/**
* Whether the probe result is valid.
*/
bool valid;
/**
* Whether the filename is a template, i.e. it takes a frame as parameter.
*/
bool filenameIsTemplate;
/**
* The first available frame.
*/
frameid_t firstFrame;
/**
* The last available frame, inclusive.
*/
frameid_t lastFrame;
/**
* The input width
*/
int64_t width;
/**
* The input height.
*/
int64_t height;
/**
* Wether the input has audio or not
*/
bool hasAudio;
/**
* Wether the input has video or not
*/
bool hasVideo;
};
/**
* @brief A Reader factory class used to create readers for use by the stitcher depending on file type.
*/
class VS_EXPORT ReaderFactory {
public:
virtual ~ReaderFactory() {}
/**
* Creates a reader.
* @param id The index of this input among the list of all inputs.
* @param def The configuration of the input.
*/
virtual Potential<Reader> create(readerid_t id, const Core::ReaderInputDefinition& def) const = 0;
/**
* Analyzes the given reader config to guess the underlying info.
* @param config Reader config. See ReaderFactory::create.
*/
virtual ProbeResult probe(const Ptv::Value& config) const = 0;
/**
* Same as above, but works with a filename.
* @param filename THis wil lbe converted into a string config.
*/
ProbeResult probe(const std::string& filename) const;
/**
* Returns the first frames the the readers from this factory will be able to generate.
*/
virtual frameid_t getFirstFrame() const = 0;
/**
* Returns the number of frames the the readers from this factory will be able to generate.
*/
virtual frameid_t getNumFrames() const = 0;
};
/**
* @brief The default reader factory.
*/
class VS_EXPORT DefaultReaderFactory : public ReaderFactory {
public:
/**
* Create a DefaultReaderFactory.
* @param firstFrame Expected first frame. Must be >= 0.
* @param lastFrame Expected last frame. If -1, the reader will try to detect the end.
*/
DefaultReaderFactory(frameid_t firstFrame, frameid_t lastFrame);
virtual ~DefaultReaderFactory();
virtual Potential<Reader> create(readerid_t id, const Core::ReaderInputDefinition& def) const;
virtual ProbeResult probe(const Ptv::Value& config) const;
virtual frameid_t getFirstFrame() const;
virtual frameid_t getNumFrames() const;
private:
DefaultReaderFactory(const DefaultReaderFactory&) = delete;
DefaultReaderFactory& operator=(const DefaultReaderFactory&) = delete;
const frameid_t firstFrame;
const frameid_t lastFrame;
};
} // namespace Input
} // namespace VideoStitch