Skip to content

Commit 600e884

Browse files
authored
Merge branch 'develop' into add-features
2 parents 7ab18fd + 8b78ddf commit 600e884

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+850
-1249
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ For more information, please visit <http://www.openshot.org/>.
4040
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
4141

4242
################ PROJECT VERSION ####################
43-
set(PROJECT_VERSION_FULL "0.2.4-dev1")
44-
set(PROJECT_SO_VERSION 18)
43+
set(PROJECT_VERSION_FULL "0.2.5-dev1")
44+
set(PROJECT_SO_VERSION 19)
4545

4646
# Remove the dash and anything following, to get the #.#.# version for project()
4747
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")

cmake/Modules/CodeCoverage.cmake

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@
5959
# 2019-12-19, FeRD (Frank Dana)
6060
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
6161
#
62+
# 2020-01-19, Bob Apthorpe
63+
# - Added gfortran support
64+
#
65+
# 2020-02-17, FeRD (Frank Dana)
66+
# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters
67+
# in EXCLUDEs, and remove manual escaping from gcovr targets
68+
#
6269
# USAGE:
6370
#
6471
# 1. Copy this file into your cmake modules path.
@@ -122,12 +129,22 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
122129
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
123130
endif()
124131
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
125-
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
132+
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
133+
# Do nothing; exit conditional without error if true
134+
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
135+
# Do nothing; exit conditional without error if true
136+
else()
137+
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
138+
endif()
126139
endif()
127140

128141
set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
129142
CACHE INTERNAL "")
130143

144+
set(CMAKE_Fortran_FLAGS_COVERAGE
145+
${COVERAGE_COMPILER_FLAGS}
146+
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
147+
FORCE )
131148
set(CMAKE_CXX_FLAGS_COVERAGE
132149
${COVERAGE_COMPILER_FLAGS}
133150
CACHE STRING "Flags used by the C++ compiler during coverage builds."
@@ -145,6 +162,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
145162
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
146163
FORCE )
147164
mark_as_advanced(
165+
CMAKE_Fortran_FLAGS_COVERAGE
148166
CMAKE_CXX_FLAGS_COVERAGE
149167
CMAKE_C_FLAGS_COVERAGE
150168
CMAKE_EXE_LINKER_FLAGS_COVERAGE
@@ -154,7 +172,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
154172
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
155173
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
156174

157-
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
175+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
158176
link_libraries(gcov)
159177
endif()
160178

@@ -242,6 +260,7 @@ function(setup_target_for_coverage_lcov)
242260

243261
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
244262
DEPENDS ${Coverage_DEPENDENCIES}
263+
VERBATIM # Protect arguments to commands
245264
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
246265
)
247266

@@ -304,9 +323,8 @@ function(setup_target_for_coverage_gcovr_xml)
304323
# Combine excludes to several -e arguments
305324
set(GCOVR_EXCLUDE_ARGS "")
306325
foreach(EXCLUDE ${GCOVR_EXCLUDES})
307-
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
308326
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
309-
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
327+
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
310328
endforeach()
311329

312330
add_custom_target(${Coverage_NAME}
@@ -321,6 +339,7 @@ function(setup_target_for_coverage_gcovr_xml)
321339
BYPRODUCTS ${Coverage_NAME}.xml
322340
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
323341
DEPENDS ${Coverage_DEPENDENCIES}
342+
VERBATIM # Protect arguments to commands
324343
COMMENT "Running gcovr to produce Cobertura code coverage report."
325344
)
326345

@@ -376,9 +395,8 @@ function(setup_target_for_coverage_gcovr_html)
376395
# Combine excludes to several -e arguments
377396
set(GCOVR_EXCLUDE_ARGS "")
378397
foreach(EXCLUDE ${GCOVR_EXCLUDES})
379-
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
380398
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
381-
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
399+
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
382400
endforeach()
383401

384402
add_custom_target(${Coverage_NAME}
@@ -393,9 +411,11 @@ function(setup_target_for_coverage_gcovr_html)
393411
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
394412
--object-directory=${PROJECT_BINARY_DIR}
395413
-o ${Coverage_NAME}/index.html
414+
396415
BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME} # report directory
397416
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
398417
DEPENDS ${Coverage_DEPENDENCIES}
418+
VERBATIM # Protect arguments to commands
399419
COMMENT "Running gcovr to produce HTML code coverage report."
400420
)
401421

@@ -410,5 +430,6 @@ endfunction() # setup_target_for_coverage_gcovr_html
410430
function(append_coverage_compiler_flags)
411431
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
412432
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
433+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
413434
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
414435
endfunction() # append_coverage_compiler_flags

include/CacheBase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ namespace openshot {
110110

111111
/// Get and Set JSON methods
112112
virtual std::string Json() = 0; ///< Generate JSON string of this object
113-
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
114-
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
115-
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
113+
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
114+
virtual Json::Value JsonValue() = 0; ///< Generate Json::Value for this object
115+
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
116116
virtual ~CacheBase() = default;
117117

118118
};

include/CacheDisk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ namespace openshot {
129129

130130
/// Get and Set JSON methods
131131
std::string Json(); ///< Generate JSON string of this object
132-
void SetJson(std::string value); ///< Load JSON string into this object
133-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
134-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
132+
void SetJson(const std::string value); ///< Load JSON string into this object
133+
Json::Value JsonValue(); ///< Generate Json::Value for this object
134+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
135135
};
136136

137137
}

include/CacheMemory.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ namespace openshot {
111111

112112
/// Get and Set JSON methods
113113
std::string Json(); ///< Generate JSON string of this object
114-
void SetJson(std::string value); ///< Load JSON string into this object
115-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
116-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
114+
void SetJson(const std::string value); ///< Load JSON string into this object
115+
Json::Value JsonValue(); ///< Generate Json::Value for this object
116+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
117117
};
118118

119119
}

include/ChunkReader.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ namespace openshot
157157
std::string Name() { return "ChunkReader"; };
158158

159159
/// Get and Set JSON methods
160-
std::string Json(); ///< Generate JSON string of this object
161-
void SetJson(std::string value); ///< Load JSON string into this object
162-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
163-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
160+
std::string Json() const override; ///< Generate JSON string of this object
161+
void SetJson(const std::string value); ///< Load JSON string into this object
162+
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
163+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
164164

165165
/// Open the reader. This is required before you can access frames or data from the reader.
166166
void Open();

include/Clip.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ namespace openshot {
187187
openshot::ReaderBase* Reader();
188188

189189
/// Override End() method
190-
float End(); ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
190+
float End() const; ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
191191
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
192192

193193
/// Get and Set JSON methods
194-
std::string Json(); ///< Generate JSON string of this object
195-
void SetJson(std::string value); ///< Load JSON string into this object
196-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
197-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
194+
std::string Json() const override; ///< Generate JSON string of this object
195+
void SetJson(const std::string value); ///< Load JSON string into this object
196+
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
197+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
198198

199199
/// Get all properties for a specific frame (perfect for a UI to display the current state
200200
/// of all properties at any time)
201-
std::string PropertiesJSON(int64_t requested_frame);
201+
std::string PropertiesJSON(int64_t requested_frame) const override;
202202

203203
/// @brief Remove an effect from the clip
204204
/// @param effect Remove an effect from the clip.

include/ClipBase.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ namespace openshot {
5656
std::string previous_properties; ///< This string contains the previous JSON properties
5757

5858
/// Generate JSON for a property
59-
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
59+
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const;
6060

6161
/// Generate JSON choice for a property (dropdown properties)
62-
Json::Value add_property_choice_json(std::string name, int value, int selected_value);
62+
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const;
6363

6464
public:
6565

@@ -73,12 +73,12 @@ namespace openshot {
7373
bool operator>= ( ClipBase& a) { return (Position() >= a.Position()); }
7474

7575
/// Get basic properties
76-
std::string Id() { return id; } ///< Get the Id of this clip object
77-
float Position() { return position; } ///< Get position on timeline (in seconds)
78-
int Layer() { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
79-
float Start() { return start; } ///< Get start position (in seconds) of clip (trim start of video)
80-
float End() { return end; } ///< Get end position (in seconds) of clip (trim end of video)
81-
float Duration() { return end - start; } ///< Get the length of this clip (in seconds)
76+
std::string Id() const { return id; } ///< Get the Id of this clip object
77+
float Position() const { return position; } ///< Get position on timeline (in seconds)
78+
int Layer() const { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
79+
float Start() const { return start; } ///< Get start position (in seconds) of clip (trim start of video)
80+
float End() const { return end; } ///< Get end position (in seconds) of clip (trim end of video)
81+
float Duration() const { return end - start; } ///< Get the length of this clip (in seconds)
8282

8383
/// Set basic properties
8484
void Id(std::string value) { id = value; } ///> Set the Id of this clip object
@@ -88,14 +88,14 @@ namespace openshot {
8888
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
8989

9090
/// Get and Set JSON methods
91-
virtual std::string Json() = 0; ///< Generate JSON string of this object
92-
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
93-
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
94-
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
91+
virtual std::string Json() const = 0; ///< Generate JSON string of this object
92+
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
93+
virtual Json::Value JsonValue() const = 0; ///< Generate Json::Value for this object
94+
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
9595

9696
/// Get all properties for a specific frame (perfect for a UI to display the current state
9797
/// of all properties at any time)
98-
virtual std::string PropertiesJSON(int64_t requested_frame) = 0;
98+
virtual std::string PropertiesJSON(int64_t requested_frame) const = 0;
9999

100100
virtual ~ClipBase() = default;
101101
};

include/Color.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ namespace openshot {
6969
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);
7070

7171
/// Get and Set JSON methods
72-
std::string Json(); ///< Generate JSON string of this object
73-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
74-
void SetJson(std::string value); ///< Load JSON string into this object
75-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
72+
std::string Json() const; ///< Generate JSON string of this object
73+
Json::Value JsonValue() const; ///< Generate Json::Value for this object
74+
void SetJson(const std::string value); ///< Load JSON string into this object
75+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
7676
};
7777

7878

include/Coordinate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ namespace openshot {
6666
Coordinate(double x, double y);
6767

6868
/// Get and Set JSON methods
69-
std::string Json(); ///< Generate JSON string of this object
70-
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
71-
void SetJson(std::string value); ///< Load JSON string into this object
72-
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
69+
std::string Json() const; ///< Generate JSON string of this object
70+
Json::Value JsonValue() const; ///< Generate Json::Value for this object
71+
void SetJson(const std::string value); ///< Load JSON string into this object
72+
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
7373
};
7474

7575
}

0 commit comments

Comments
 (0)