OpenShot Library | libopenshot  0.4.0
ClipProcessingJobs.h
Go to the documentation of this file.
1 
10 // Copyright (c) 2008-2019 OpenShot Studios, LLC
11 //
12 // SPDX-License-Identifier: LGPL-3.0-or-later
13 
14 #ifdef USE_OPENCV
15  #define int64 opencv_broken_int
16  #define uint64 opencv_broken_uint
17  #include <opencv2/opencv.hpp>
18  #include <opencv2/core.hpp>
19  #undef uint64
20  #undef int64
21 
22  #include "CVStabilization.h"
23  #include "CVTracker.h"
24  #include "CVObjectDetection.h"
25 #endif
26 
27 #include <thread>
28 #include "ProcessingController.h"
29 #include "Clip.h"
30 
31 namespace openshot {
32 
33 // Constructor responsible to choose processing type and apply to clip
35  private:
36  std::string processInfoJson;
37  std::string processingType;
38 
39  bool processingDone = false;
40  bool stopProcessing = false;
41  uint processingProgress = 0;
42 
43  std::thread t;
44 
46  ProcessingController processingController;
47 
48  // Apply object tracking to clip
49  void trackClip(Clip& clip, ProcessingController& controller);
50  // Apply stabilization to clip
51  void stabilizeClip(Clip& clip, ProcessingController& controller);
52  // Apply object detection to clip
53  void detectObjectsClip(Clip& clip, ProcessingController& controller);
54 
55 
56  public:
57  // Constructor
58  ClipProcessingJobs(std::string processingType, std::string processInfoJson);
59  // Process clip accordingly to processingType
60  void processClip(Clip& clip, std::string json);
61 
62  // Thread related variables and methods
63  int GetProgress();
64  bool IsDone();
65  void CancelProcessing();
66  bool GetError();
67  std::string GetErrorMessage();
68 };
69 
70 } // namespace openshot
CVObjectDetection.h
Header file for CVObjectDetection class.
openshot::ClipProcessingJobs::processClip
void processClip(Clip &clip, std::string json)
Definition: ClipProcessingJobs.cpp:23
Clip.h
Header file for Clip class.
CVTracker.h
Track an object selected by the user.
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Clip
This class represents a clip (used to arrange readers on the timeline)
Definition: Clip.h:89
openshot::ClipProcessingJobs::IsDone
bool IsDone()
Definition: ClipProcessingJobs.cpp:109
openshot::ClipProcessingJobs::ClipProcessingJobs
ClipProcessingJobs(std::string processingType, std::string processInfoJson)
Definition: ClipProcessingJobs.cpp:19
CVStabilization.h
Header file for CVStabilization class.
openshot::ClipProcessingJobs::GetError
bool GetError()
Definition: ClipProcessingJobs.cpp:123
openshot::ClipProcessingJobs::GetProgress
int GetProgress()
Definition: ClipProcessingJobs.cpp:103
ProcessingController.h
This is a message class for thread safe comunication between ClipProcessingJobs and OpenCV classes.
openshot::ClipProcessingJobs::CancelProcessing
void CancelProcessing()
Definition: ClipProcessingJobs.cpp:118
openshot::ClipProcessingJobs::GetErrorMessage
std::string GetErrorMessage()
Definition: ClipProcessingJobs.cpp:128
ProcessingController
Definition: ProcessingController.h:20
openshot::ClipProcessingJobs
Definition: ClipProcessingJobs.h:34