OpenShot Library | libopenshot  0.2.7
ClipProcessingJobs.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header for ClipProcessingJobs class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  * @author Brenno Caldato <brenno.caldato@outlook.com>
6  *
7  * @ref License
8  */
9 
10 /* LICENSE
11  *
12  * Copyright (c) 2008-2019 OpenShot Studios, LLC
13  * <http://www.openshotstudios.com/>. This file is part of
14  * OpenShot Library (libopenshot), an open-source project dedicated to
15  * delivering high quality video editing and animation solutions to the
16  * world. For more information visit <http://www.openshot.org/>.
17  *
18  * OpenShot Library (libopenshot) is free software: you can redistribute it
19  * and/or modify it under the terms of the GNU Lesser General Public License
20  * as published by the Free Software Foundation, either version 3 of the
21  * License, or (at your option) any later version.
22  *
23  * OpenShot Library (libopenshot) is distributed in the hope that it will be
24  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU Lesser General Public License for more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public License
29  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
30  */
31 
32 
33 #ifdef USE_OPENCV
34  #define int64 opencv_broken_int
35  #define uint64 opencv_broken_uint
36  #include <opencv2/opencv.hpp>
37  #include <opencv2/core.hpp>
38  #undef uint64
39  #undef int64
40 
41  #include "CVStabilization.h"
42  #include "CVTracker.h"
43  #include "CVObjectDetection.h"
44 #endif
45 
46 #include <thread>
47 #include "ProcessingController.h"
48 #include "Clip.h"
49 
50 namespace openshot {
51 
52 // Constructor responsible to choose processing type and apply to clip
54  private:
55  std::string processInfoJson;
56  std::string processingType;
57 
58  bool processingDone = false;
59  bool stopProcessing = false;
60  uint processingProgress = 0;
61 
62  std::thread t;
63 
64  /// Will handle a Thread safely comutication between ClipProcessingJobs and the processing effect classes
65  ProcessingController processingController;
66 
67  // Apply object tracking to clip
68  void trackClip(Clip& clip, ProcessingController& controller);
69  // Apply stabilization to clip
70  void stabilizeClip(Clip& clip, ProcessingController& controller);
71  // Apply object detection to clip
72  void detectObjectsClip(Clip& clip, ProcessingController& controller);
73 
74 
75  public:
76  // Constructor
77  ClipProcessingJobs(std::string processingType, std::string processInfoJson);
78  // Process clip accordingly to processingType
79  void processClip(Clip& clip, std::string json);
80 
81  // Thread related variables and methods
82  int GetProgress();
83  bool IsDone();
84  void CancelProcessing();
85  bool GetError();
86  std::string GetErrorMessage();
87 };
88 
89 } // namespace openshot
Header file for CVObjectDetection class.
Header file for CVStabilization class.
Track an object selected by the user.
Header file for Clip class.
This is a message class for thread safe comunication between ClipProcessingJobs and OpenCV classes.
void processClip(Clip &clip, std::string json)
ClipProcessingJobs(std::string processingType, std::string processInfoJson)
This class represents a clip (used to arrange readers on the timeline)
Definition: Clip.h:109
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47