|
13 | 13 | #include <cstddef> |
14 | 14 | #include <functional> |
15 | 15 | #include <map> |
| 16 | +#include <memory> |
16 | 17 | #include <nlohmann/json.hpp> |
17 | 18 | #include <opencv2/core/mat.hpp> |
18 | 19 | #include <string> |
19 | 20 | #include <vector> |
20 | 21 |
|
21 | | -#include "qboxlayout.h" |
22 | 22 | #include "qlabel.h" |
23 | 23 | #include "qnamespace.h" |
24 | | -#include "qtimer.h" |
| 24 | +#include "vm/AppWindow.hpp" |
25 | 25 | #include "vm/Register.hpp" |
26 | | -#include "vm/WindowEvent.hpp" |
27 | 26 |
|
28 | 27 | #define bindCmd(x) ([this]() { this->x(); }) |
29 | | -#define bindInst(x) ([this](const json::array_t &args) { return this->x(args); }) |
30 | | -#define bindTsf(x) ([this](std::shared_ptr<_IInput> input, const json::array_t &args) { return this->x(input, args); }) |
31 | 28 |
|
32 | 29 | using json = nlohmann::json; |
33 | 30 |
|
34 | | -class LiveWindow |
| 31 | +class VideoCode |
35 | 32 | { |
36 | 33 | public: |
37 | 34 |
|
38 | | - LiveWindow(int &argc, char **argv, int width, int height, std::string &&_sourceFile = "video.py"); |
39 | | - ~LiveWindow(); |
| 35 | + VideoCode(int argc, char **argv, int width, int height, std::string sourceFile, bool generate, std::string outputFile); |
40 | 36 |
|
41 | 37 | ///< Start the program |
42 | 38 | int run(); |
43 | 39 |
|
44 | 40 | ///< Called every loop iteration to update the current frame being displayed |
45 | | - void updateFrame(); |
| 41 | + void updateFrame(QLabel &imageLabel); |
46 | 42 |
|
47 | 43 | ///< Set the index of the timeline to a label |
48 | 44 | void goToLabel(const std::string &label); |
@@ -75,30 +71,15 @@ class LiveWindow |
75 | 71 | const int _frameRate{24}; |
76 | 72 |
|
77 | 73 | ///< Window size |
78 | | - const int _width{1920}; |
79 | | - const int _height{1080}; |
| 74 | + const int _width; |
| 75 | + const int _height; |
80 | 76 |
|
81 | 77 | ///< source file |
82 | 78 | const std::string _sourceFile; |
83 | 79 |
|
84 | 80 | ///< Black frame for empty timelines |
85 | 81 | const cv::Mat _defaultBlackFrame; |
86 | 82 |
|
87 | | - ///< QT app |
88 | | - QApplication _app; |
89 | | - |
90 | | - ///< QT window |
91 | | - WindowEvent _window; |
92 | | - |
93 | | - ///< Label containing the image |
94 | | - QLabel _imageLabel; |
95 | | - |
96 | | - ///< Layout linking the label and the window |
97 | | - QVBoxLayout _imageLayout; |
98 | | - |
99 | | - ///< Main loop updating the current frame |
100 | | - QTimer _timer; |
101 | | - |
102 | 83 | ///< Current index of the frame of the timeline being displayed |
103 | 84 | std::size_t _index{0}; |
104 | 85 |
|
@@ -139,4 +120,10 @@ class LiveWindow |
139 | 120 |
|
140 | 121 | ///< Stack containing the transformations to apply to the Inputs |
141 | 122 | json::array_t _actionStack{}; |
| 123 | + |
| 124 | + ///< Window to modify the video in real time |
| 125 | + std::unique_ptr<AppWindow> _app{nullptr}; |
| 126 | + |
| 127 | + ///< Output File for the generation |
| 128 | + std::string _outputFile; |
142 | 129 | }; |
0 commit comments