iVS3D v2.0.9
Loading...
Searching...
No Matches
videoplayercontroller.h
1#ifndef VIDEOPLAYERCONTROLLER_H
2#define VIDEOPLAYERCONTROLLER_H
3
4#include <QObject> // used for signals and slots
5#include <QTimer> // used for periodic timer events to update displayed image
6#include <QMessageBox> // used to display error messages
7
8#include <set>
9#include <memory>
10
11#include "DataManager.h" // used to access image data for displaying and manipulation
12
13#include "view/videoplayer.h" // used to display images
14#include "view/timeline.h" // used to visualize keyframe distribution
15
16#include "controller/ModelInputIterator.h" // used to iterate over given image data
17
18#include "controller/imageiterator.h"
19#include "controller/modelinputiteratorfactory.h"
20#include "view/reallydeletedialog.h"
21
22#include "model/asyncimageloader.h"
23#include "plugin/pluginthread.h"
24
25#include "ipreview.h"
26
27#include "cvmat_qmetadata.h"
28
29#define ERROR_MSG_APPROX_COUNT 5
30#define BOUDNARY_STATIONARY_DURATION 1000 // in ms
31
47class VideoPlayerController : public QObject
48{
49 Q_OBJECT // used to enable signals and slots for this class
50
51public:
62 explicit VideoPlayerController(QObject *parent = nullptr, VideoPlayer *player = nullptr, Timeline *timeline = nullptr, DataManager *dataManager = nullptr, std::shared_ptr<PluginThread> pluginThread = nullptr);
63
68
73 unsigned int getImageIndexOnScreen();
74
75 void resetLayout();
76
77 void setPreviewPlugin(const QString& previewPluginName);
78
79 void clearPreviewPlugin();
80
81public slots:
85 void slot_play();
86
91
95 void slot_showLastImage();
96
102
107 void slot_showNextImage();
108
112 void slot_toggleKeyframe();
113
118 void slot_toggleKeyframesOnly(bool checked);
119
124 void slot_changeStepSize(unsigned int stepsize);
125
130 void slot_changeIndex(unsigned int index);
131
135 void slot_mipChanged();
136
141
146
150 void slot_stopPlay();
151
155 void slot_updateBoundaries(QPoint boundaries);
156
161
165 void slot_redraw();
166
170 void slot_refreshPreview(bool clearOldPreview);
171
172signals:
173
178 void sig_hasStatusMessage(QString message);
179
185 void sig_toggleKeyframe(uint idx, bool isNowKeyframe);
186
191
196
197 void sig_disablePreview();
198
199private slots:
200 void slot_timerNextImage();
201 void slot_boundaryStopped();
202 void slot_receiveImage(const ImageRequest &request, const ImageResult &result);
203 void slot_receiveVisualization(const PreviewResult& result);
204
205private:
206 VideoPlayer *m_videoPlayer;
207 Timeline *m_timeline;
208 DataManager *m_dataManager;
209 QTimer *m_frametimer;
210 QTimer *m_boundaryMoveTimer;
211
212 // current image data
213 cv::Mat m_currentImage;
214 QRect m_roi;
215 QRect m_sceneBoundaries;
216
217 unsigned int m_imageIndex;
218 unsigned int m_imageIndexOnScreen;
219 unsigned int m_stepsize;
220 bool m_keyframesOnly;
221 bool m_playing;
222 ModelInputIterator *m_iterator;
223
224 const int m_frametime = 33; //ms between frames
225
226 std::set<int> m_foundCorruptedFrames = {};
227
228 void showImage();
229
230 std::unique_ptr<AsyncImageLoader> m_asyncImageLoader;
231 std::shared_ptr<PluginThread> m_pluginThread;
232 std::optional<QString> m_currentPreviewPlugin;
233
234};
235
236#endif // VIDEOPLAYERCONTROLLER_H
The DataManager class is a Facade for the data holding classes in the model. It delegates most of it'...
Definition DataManager.h:29
The ModelInputIterator class handles iteration over given ModelInputPictures. Handles boundarys and a...
Definition ModelInputIterator.h:18
The Timeline class is the class wich coordinates and manages all timeline events and elements.
Definition timeline.h:30
The VideoPlayerController class manages visualization of image data and manual changes to keyframes.
Definition videoplayercontroller.h:48
void slot_updateBoundaries(QPoint boundaries)
[slot] slot_updateBoundaries() updates the mip so that the boundaries are up to date
Definition videoplayercontroller.cpp:322
void slot_mipChanged()
[slot] slot_mipChanged() is called when image data changed. VideoPlayer and Timeline are updated.
Definition videoplayercontroller.cpp:271
~VideoPlayerController()
disconnects signals, deletes timer and VideoPlayerController instance.
Definition videoplayercontroller.cpp:98
void sig_deleteAllKeyframes()
[signal] sig_deleteAllKeyframes is emitted when frames are reseted to be keyframes
void slot_play()
[slot] slot_play() toggles automatic iteration over image sequence.
Definition videoplayercontroller.cpp:148
void sig_deleteKeyframes()
[signal] sig_deleteKeyframes is emitted when all keyframes are deleted
void slot_refreshPreview(bool clearOldPreview)
[slot] slot_refreshPreview() updates the visualization for the currently displayed image by requestin...
Definition videoplayercontroller.cpp:437
void sig_hasStatusMessage(QString message)
[signal] sig_hasStatusMessage(...) is emitted when VideoPlayerController has a status message to disp...
void slot_showLastImage()
[slot] slot_showLastImage() displays last image.
Definition videoplayercontroller.cpp:167
void slot_deleteAllKeyframes()
[slot] slot_deleteAllKeyframes() deletes all keyframes.
Definition videoplayercontroller.cpp:293
void sig_toggleKeyframe(uint idx, bool isNowKeyframe)
[signal] sig_toggleKeyframe notifies about a manual keyframe change by clicking Add keyframe/Remove k...
void slot_stopPlay()
[slot] slot_stopPlay() stops running videoPlayer.
Definition videoplayercontroller.cpp:317
void slot_redraw()
[slot] slot_redraw() draws selected image again.
Definition videoplayercontroller.cpp:353
void slot_changeIndex(unsigned int index)
[slot] slot_changeIndex(...) displays the image from DataManager referenced by given index.
Definition videoplayercontroller.cpp:263
void slot_deleteKeyframes()
[slot] slot_deleteKeyframes() deletes all selected keyframes.
Definition videoplayercontroller.cpp:282
void slot_showNextImage()
[slot] slot_showNextImage() displays image going one or more steps forward from current image.
Definition videoplayercontroller.cpp:186
void slot_resetBoundaries()
[slot] slot_resetBoundaries() updates the mip so that the boundaries are back to default
Definition videoplayercontroller.cpp:349
void slot_changeStepSize(unsigned int stepsize)
[slot] slot_changeStepSize(...) changes stepsize for iterating the images.
Definition videoplayercontroller.cpp:259
void slot_toggleKeyframesOnly(bool checked)
[slot] slot_toggleKeyframesOnly(...) switches between displaying all images or keyframes only.
Definition videoplayercontroller.cpp:226
unsigned int getImageIndexOnScreen()
getImageIndexOnScreen getter for m_imageIndexOnScreen (only used in tests for now)
Definition videoplayercontroller.cpp:131
void slot_showFirstImage()
[slot] slot_showFirstImage() displays first image.
Definition videoplayercontroller.cpp:158
void slot_showPreviousImage()
[slot] slot_showPreviousImage() displays image going one or more steps backward from current image.
Definition videoplayercontroller.cpp:176
void slot_toggleKeyframe()
[slot] slot_toggleKeyframe() toggles keyframe-state for currently displayed image.
Definition videoplayercontroller.cpp:196
The VideoPlayer class provides a view to display images and holds buttons to interact with image sequ...
Definition videoplayer.h:50
Definition asyncimageloader.h:11
Definition asyncimageloader.h:16
Definition pluginthread.h:23