Skip to content

Commit d6eef8f

Browse files
authored
Merge branch 'develop' into develop
2 parents c54a370 + eaac2db commit d6eef8f

26 files changed

+180
-50
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ Generating build files for OpenShot
7575
SO/API/ABI Version: ${SO_VERSION}
7676
")
7777

78+
#### Work around a GCC < 9 bug with handling of _Pragma() in macros
79+
#### See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578
80+
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
81+
(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.0.0"))
82+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-integrated-cpp")
83+
endif()
84+
7885
#### Enable C++11 (for std::shared_ptr support)
7986
set(CMAKE_CXX_STANDARD 11)
8087
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include/CacheBase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ namespace openshot {
6060
/// @param max_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
6161
CacheBase(int64_t max_bytes);
6262

63+
virtual ~CacheBase();
64+
6365
/// @brief Add a Frame to the cache
6466
/// @param frame The openshot::Frame object needing to be cached.
6567
virtual void Add(std::shared_ptr<Frame> frame) = 0;

include/CacheMemory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace openshot {
7171
CacheMemory(int64_t max_bytes);
7272

7373
// Default destructor
74-
~CacheMemory();
74+
virtual ~CacheMemory();
7575

7676
/// @brief Add a Frame to the cache
7777
/// @param frame The openshot::Frame object needing to be cached.

include/Clip.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ namespace openshot {
112112

113113
// File Reader object
114114
ReaderBase* reader;
115-
bool manage_reader;
115+
116+
/// If we allocated a reader, we store it here to free it later
117+
/// (reader member variable itself may have been replaced)
118+
ReaderBase* allocated_reader;
116119

117120
/// Adjust frame number minimum value
118121
int64_t adjust_frame_number_minimum(int64_t frame_number);
@@ -160,7 +163,7 @@ namespace openshot {
160163
Clip(ReaderBase* new_reader);
161164

162165
/// Destructor
163-
~Clip();
166+
virtual ~Clip();
164167

165168
/// @brief Add an effect to the clip
166169
/// @param effect Add an effect to the clip. An effect can modify the audio or video of an openshot::Frame.

include/ClipBase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ namespace openshot {
6969

7070
/// Constructor for the base clip
7171
ClipBase() { };
72+
virtual ~ClipBase();
7273

7374
// Compare a clip using the Position() property
7475
bool operator< ( ClipBase& a) { return (Position() < a.Position()); }

include/DummyReader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ namespace openshot
6464
/// Constructor for DummyReader.
6565
DummyReader(Fraction fps, int width, int height, int sample_rate, int channels, float duration);
6666

67+
virtual ~DummyReader();
68+
6769
/// Close File
6870
void Close();
6971

include/FFmpegReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ namespace openshot {
243243
FFmpegReader(string path, bool inspect_reader);
244244

245245
/// Destructor
246-
~FFmpegReader();
246+
virtual ~FFmpegReader();
247247

248248
/// Close File
249249
void Close();

include/Frame.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ namespace openshot
159159
Frame& operator= (const Frame& other);
160160

161161
/// Destructor
162-
~Frame();
162+
virtual ~Frame();
163163

164164
/// Add (or replace) pixel data to the frame (based on a solid color)
165165
void AddColor(int new_width, int new_height, string new_color);
@@ -249,6 +249,9 @@ namespace openshot
249249
/// Get pixel data (for only a single scan-line)
250250
const unsigned char* GetPixels(int row);
251251

252+
/// Check a specific pixel color value (returns True/False)
253+
bool CheckPixel(int row, int col, int red, int green, int blue, int alpha, int threshold);
254+
252255
/// Get height of image
253256
int GetHeight();
254257

include/FrameMapper.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ namespace openshot
170170
FrameMapper(ReaderBase *reader, Fraction target_fps, PulldownType target_pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout);
171171

172172
/// Destructor
173-
~FrameMapper();
173+
virtual ~FrameMapper();
174174

175175
/// Change frame rate or audio mapping details
176176
void ChangeMapping(Fraction target_fps, PulldownType pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout);
@@ -213,6 +213,9 @@ namespace openshot
213213
/// Get the current reader
214214
ReaderBase* Reader();
215215

216+
/// Set the current reader
217+
void Reader(ReaderBase *new_reader) { reader = new_reader; }
218+
216219
/// Resample audio and map channels (if needed)
217220
void ResampleMappedAudio(std::shared_ptr<Frame> frame, int64_t original_frame_number);
218221

include/QtImageReader.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ namespace openshot
6565
{
6666
private:
6767
string path;
68-
std::shared_ptr<QImage> image; ///> Original image (full quality)
69-
std::shared_ptr<QImage> cached_image; ///> Scaled for performance
70-
bool is_open;
68+
std::shared_ptr<QImage> image; ///> Original image (full quality)
69+
std::shared_ptr<QImage> cached_image; ///> Scaled for performance
70+
bool is_open; ///> Is Reader opened
71+
QSize max_size; ///> Current max_size as calculated with Clip properties
7172

7273
public:
7374

@@ -80,6 +81,8 @@ namespace openshot
8081
/// when you are inflating the object using JSON after instantiating it.
8182
QtImageReader(string path, bool inspect_reader);
8283

84+
virtual ~QtImageReader();
85+
8386
/// Close File
8487
void Close();
8588

0 commit comments

Comments
 (0)